您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Image Resizer for F365 Forum
当前为
- // ==UserScript==
- // @name F365 Image Resizer
- // @namespace http://f365.com/
- // @description Image Resizer for F365 Forum
- // @include http://forum.football365.com/*
- // @exclude http://forum.football365.com/boss.htm
- // @version 0.0.1.20150629150231
- // ==/UserScript==
- // styles =======================================
- var s = '.forumImage{border:10px solid #CCCCCC;}';
- var cssnode = document.createTextNode(s);
- var css=document.createElement('style');
- css.type='text/css';
- css.appendChild(cssnode);
- document.getElementsByTagName('head')[0].appendChild(css);
- // scripts ======================================
- /*
- var scr = '\
- function clickImg(o)\
- {\
- var src;\
- src = o.src;\
- window.open(src,\'new\');\
- }';
- var script=document.createElement('script');
- script.type='text/javascript';
- script.innerHTML = scr;
- document.getElementsByTagName('head')[0].appendChild(script);
- */
- // main =========================================
- window.addEventListener("load", function(e) {
- var maxSize, iHeight, iWidth, sizeGuide, size2, sizeRatio, newSize1, newSize2, x;
- var imgsrc;
- maxSize = 810;
- for (x=0; x<document.images.length; x++) {
- iHeight = document.images[x].height;
- iWidth = document.images[x].width;
- if (iHeight > iWidth){
- sizeGuide = iHeight;
- size2 = iWidth;
- } else {
- sizeGuide = iWidth;
- size2 = iHeight;
- }
- if (sizeGuide > maxSize){
- sizeRatio = sizeGuide / size2;
- newSize1 = maxSize;
- newSize2 = newSize1 / sizeRatio;
- if (iHeight > iWidth){
- document.images[x].height = newSize1;
- document.images[x].width = newSize2;
- } else {
- document.images[x].width = newSize1;
- document.images[x].height = newSize2;
- }
- document.images[x].className = 'forumImage';
- imgsrc = document.images[x].src;
- var im;
- im = document.images[x];
- im.addEventListener('click', function(thisimg){window.open(this.src,'new');}, true);
- }
- }
- }, false);