├── Direct_Images
├── README.md
└── direct_images.user.js
├── Direct_Links
└── direct_links.user.js
├── Dirty.ru_List_of_Best
├── README.md
└── dirty.ru_list_of_best.user.js
├── Dirty.ru_Title
└── dirty.ru_title.user.js
├── Forum_Code_Highlighter
├── README.md
├── forum_code_highlighter.user.js
└── screenshots
│ ├── akelpad.sf.net.png
│ ├── custombuttons.sf.net.png
│ └── forum.mozilla-russia.org.png
├── GisMeteo.ru_Force_old_style
├── GisMeteo.ru_Force_old_style.user.js
└── README.md
├── README.md
├── Remove_Fake_Links
├── README.md
└── remove_fake_links.user.js
├── RuTor
├── README.md
└── RuTor_invert_title.user.js
└── VseInstrumenti.ru_Load_all_favorites
├── README.md
└── VseInstrumenti.ru_Load_all_favorites.user.js
/Direct_Images/README.md:
--------------------------------------------------------------------------------
1 | Redirect from preview pages to images directly.
2 |
E.g. from http://radikal.ru/fp/783f97107edc484bbdd2a04a5784f768 to http://s41.radikal.ru/i091/1306/92/1fdf5959b046.png
--------------------------------------------------------------------------------
/Direct_Images/direct_images.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Direct Images
3 | // @version 0.7.0pre21 - 2025-02-17
4 | // @description Redirect from preview pages to images directly
5 | // @author Infocatcher
6 | // @namespace dev/null
7 | // @run-at document-start
8 | // @grant GM_getValue
9 | // @grant GM_setValue
10 | // @grant GM_log
11 |
12 | // @include about:blank?UserScripts/options/Direct_Images
13 | // @include data:,UserScripts/options/Direct_Images
14 |
15 | // Get image by id:
16 | // @match *://ipicture.ru/Gallery/Viewfull/*.html
17 | // @match *://*.ipicture.ru/Gallery/Viewfull/*.html
18 | // @match *://www.picamatic.com/view/*
19 | // @match *://download.su/photo/*
20 | // @match *://imageup.ru/img*/*.html
21 | // @include *://*pixshock.net/*.html
22 | // @include *://*image-share.com/image.php?*
23 | // @include *://*image-share.com/*.html
24 | // @include *://*10pix.ru/view/*
25 | // @match *://xmages.net/show.php*.html
26 | // @match *://opicture.ru/gallery/view/*.html
27 | // @match *://picamigo.com/show.php/*.html
28 | // @match *://pikucha.ru/*
29 | // @match *://keep4u.ru/full/*.html
30 | // @match *://www.imagebanana.com/view/*
31 | // @match *://yfrog.com/*
32 | // @match *://radikal.ua/full/*.html
33 | // @match *://radikalno.ru/full/*.html
34 | // @match *://upyourpic.org/images/*.html
35 | // @include *://*postimg.com/image/*
36 | // @match *://www.bild.me/bild.php?file=*
37 | // @match *://www.pictureshack.ru/view_*
38 | // @match *://pixs.ru/showimage/*
39 | // @match *://minus.com/*
40 | // @include *://*overpic.net/viewer.php?file=*
41 | // @match *://pictube.ru/?v=*
42 | // @match *://owely.com/*
43 | // @match *://uaimage.com/image/*
44 | // @match *://vfl.ru/fotos/*.html*
45 | // @match *://geekpics.net/view/*
46 | // @match *://grab.by/*
47 | // @match *://someimage.com/*
48 | // @match *://skrinshoter.ru/*
49 | // @match *://*.imagetitan.com/img.php?image=*
50 | // @match *://www.picshare.ru/view/*
51 | // @match *://www.turboimagehost.com/*.html*
52 |
53 | // URL-based redirect:
54 | // @match *://smages.com/*.htm
55 | // @match *://anub.ru/pic/*
56 | // @include *://*onlinedisk.ru/image/*
57 | // @include *://*onlinedisk.ru/view/*
58 | // @match *://*.fotoupload.ru/viewer.php?file=*
59 | // @match *://image.vanilla.su/viewer.php?file=*
60 | // @match *://prostofotka.ru/viewer.php?file=*
61 | // @match *://foto-screen.ru/viewer.php?file=*
62 | // @match *://foto-screen.org/viewer.php?file=*
63 | // @match *://foto-boom.org/viewer.php?file=*
64 | // @match *://pixmaster.net/viewer.php?file=*
65 | // @match *://itrash.ru/idb/*.htm*
66 | // @match *://*.itrash.ru/idb/*.htm*
67 | // @match *://*.sendpic.ru/*.html
68 | // @include *://*imget.ru/show/?img=*
69 | // @match *://fastpic.msk.ru/?v=*
70 | // @match *://youpic.su/view.php?id=*
71 | // @match *://jpegshare.net/*.html
72 | // @match *://imagelike.org/?v=*
73 | // @match *://rupix.org/viewer.php?*
74 | // @match *://all-poster.ru/?v=*
75 | // @match *://picsee.net/*.html
76 | // @match *://img.bigstream.ru/viewer.php?file=*
77 | // @match *://pix.toile-libre.org/?img=*
78 | // @match *://fast-picture.ru/images/*.html
79 | // @match *://pasteboard.co/*
80 | // @match *://img-host.org.ua/?v=*
81 | // @match *://images.gameru.net/image/*.html
82 | // @match *://imgdepo.com/show/*
83 | // @match *://stick.kz/?v=*
84 | // @match *://imagestun.com/hosting/?v=*
85 | // @match *://picua.org/?v=*
86 | // @match *://*.giphy.com/media/*
87 | // @match *://scrin.org/?v=*
88 | // @match *://lostpix.com/?v=*
89 | // @match *://picplus.ru/ful/*
90 |
91 | // Get image by src:
92 | // @include *://*imagepix.org/image/*.html
93 | // @match *://saveimg.ru/show-image.php?id=*
94 | // @match *://mediapix.ru/pic.php?id=*
95 | // @match *://pixs.ru/showimage/*
96 | // @match *://postimage.org/image/*
97 | // @match *://uaimages.com/viewer.php?*
98 | // @match *://7image.ru/v.php?*
99 | // @match *://mepic.ru/view/?*
100 | // @match *://simplest-image-hosting.net/*
101 | // @match *://pics.kz/view/*
102 | // @include *://*imagepost.ru/?v=*
103 | // @match *://imgtheif.com/show-image.php?id=*
104 | // @match *://imgtheif.com/image/*.html
105 | // @match *://hostingkartinok.com/show-image.php?*
106 | // @match *://image.kz/*
107 | // @match *://imm.io/*
108 | // @match *://narodpix.net/?v=*
109 | // @match *://www.narodpix.net/?v=*
110 | // @match *://firepic.org/?v=*
111 | // @match *://www.firepic.org/?v=*
112 | // @match *://you-logo.ru/show-image.php?*
113 | // @match *://uploadimagex.com/view.php?*
114 | // @match *://toroff.net/?v=*
115 | // @match *://clip2net.com/s/*
116 | // @match *://screencast.com/*/*
117 | // @match *://img.lastusja.ru/*
118 | // @match *://gyazo.com/*
119 | // @match *://imgchilibum.ru/*.php?id=*
120 | // @match *://imglink.ru/show-image.php?id=*
121 | // @match *://www.fotolink.su/v.php?id=*
122 | // @match *://netpics.org/image/*
123 | // @include *://*ximage.ru/index.php?id=*
124 | // @include *://*ii4.ru/image-*.html*
125 | // @match *://freescreens.ru/*/
126 | // @match *://powerlogo.ru/show-image.php?id=*
127 | // @match *://savepice.ru/full/*.html*
128 | // @match *://funkyimg.com/viewer.php?*
129 | // @match *://funkyimg.com/view/*
130 | // @match *://www.imagesnake.com/show*
131 | // @match *://*.imagevenue.com/*
132 |
133 | // Get image from thumbnail:
134 | // @match *://piccash.net/*/
135 | // @match *://pic4you.ru/*/
136 | // @match *://picforall.ru/*
137 | // @match *://payforpic.ru/*
138 | // @match *://pix-x.net/*
139 | // @match *://picclick.ru/*
140 | // @match *://imgclick.ru/*
141 | // @match *://imgbase.ru/*
142 | // @match *://picpays.ru/*
143 | // @match *://drlink.online/*
144 | // @match *://pronpic.org/*
145 |
146 | // Other:
147 | // @match *://*.imageshack.us/*
148 | // @match *://imageshack.us/photo/*
149 | // @match *://imageshack.us/f/*/
150 | // @match *://imageshack.com/photo/*
151 | // @match *://savepic.ru/*.htm
152 | // @match *://savepic.org/*.htm
153 | // @match *://savepic.net/*.htm
154 | // @match *://savepic.su/*.htm
155 | // @match *://piccy.info/*view*/*
156 | // @include *://*xtupload.com/*.html
157 | // @include *://*picatom.com/*.html
158 | // @include *://*fotosik.pl/pokaz_obrazek/*.html
159 | // @match *://fotki.yandex.ru/users/*/view/*
160 | // @match *://southwc.ru/*.htm
161 | // @match *://www.pict.com/view/*
162 | // @match *://imageban.ru/show/*
163 | // @match *://habreffect.ru/*
164 | // @match *://rghost.ru/*
165 | // @match *://rghost.net/*
166 | // @match *://rgho.st/*
167 | // @match *://itmages.ru/image/*
168 | // @match *://itmages.com/image/*
169 | // @include *://*floomby.ru/*/*
170 | // @match *://www.kinopoisk.ru/picture/*/or/1/
171 | // @match *://tenpic.ru/view.php?*
172 | // @match *://imghost.in/pt-*.html
173 | // @match *://*.binimage.org/*
174 | // @match *://forlazypeople.com/?v=*
175 | // @match *://upit.biz/?v=*
176 | // @match *://imgur.com/*
177 | // @exclude *://imgur.com/
178 | // @exclude *://imgur.com/user/*
179 | // @match *://*.goodfon.ru/download*
180 | // @match *://*.goodfon.su/download*
181 | // @match *://*.badfon.ru/download*
182 | // @include *://*image-upload.net/*.html
183 | // @match *://imageshost.ru/links/*
184 | // @match *://imageshost.ru/photo/*.html
185 | // @match *://screenshotuploader.com/s/*
186 | // @match *://prntscr.com/*
187 | // @match *://ifotki.info/*.html
188 | // @match *://*.photobucket.com/*?action=view*
189 | // @match *://*.photobucket.com/*.html*
190 | // @match *://tinypic.com/view.php?pic=*
191 | // @include *://*fotohost.by/show/*
192 | // @match *://fastpic.ru/*view/*.html*
193 | // @match *://fastpic.org/*view/*.html*
194 | // @match *://joxi.ru/*
195 | // @match *://joxi.net/*
196 | // @match *://postimg.org/image/*
197 | // @match *://i-fotki.info/*.html
198 | // @match *://4put.ru/*.php?*
199 | // @match *://fotkidepo.ru/?id=photo:*
200 | // @match *://ixbt.photo/?id=photo:*
201 | // @match *://lostpic.net/?*
202 | // @match *://lostpic.net/image/*
203 | // @match *://*.lostpic.net/image/*
204 | // @match *://pic.lg.ua/*
205 | // @match *://cardse.net/image/*
206 | // @match *://image2you.ru/*/
207 | // @match *://cl.ly/*
208 | // @match *://*.riotpixels.com/games/*/screenshots/*
209 | // @match *://prnt.sc/*
210 | // @match *://snag.gy/*.*
211 | // @match *://www.directupload.net/*.htm*
212 | // @match *://*.directupload.net/images/*
213 | // @match *://ibb.co/*
214 | // @match *://picturelol.com/*
215 | // @match *://imgdrive.net/img-*.html*
216 | // @match *://www.imagebam.com/image/*
217 | // @match *://postimg.cc/*
218 | // @match *://sasisa.org/foto/foto.php?*
219 | // @match *://radikal.host/i/*.*
220 | // ==/UserScript==
221 |
222 | (function di(event) {
223 | var allowBack = false; // default value
224 | // You can change greasemonkey.scriptvals.dev/null/Direct Images.allowBack in about:config
225 | if(typeof GM_getValue == "function") {
226 | var _allowBack = GM_getValue("allowBack", undefined);
227 | if(_allowBack == undefined)
228 | GM_setValue("allowBack", allowBack);
229 | else
230 | allowBack = _allowBack;
231 | }
232 |
233 | var loc = location.href;
234 | if(
235 | (
236 | loc == "about:blank?UserScripts/options/Direct_Images"
237 | || loc == "data:,UserScripts/options/Direct_Images"
238 | )
239 | && typeof GM_getValue == "function"
240 | ) {
241 | var t = "Direct Images Options";
242 | var optionsUI = function() {
243 | window.removeEventListener("load", optionsUI, false);
244 | document.title = t;
245 | var body = document.body || document.documentElement;
246 | body.textContent = "";
247 | var label = _e("label");
248 | label.htmlFor = "allowBack";
249 | var input = _e("input");
250 | input.id = "allowBack";
251 | input.type = "checkbox";
252 | input.checked = allowBack;
253 | var handleClick = function() {
254 | GM_setValue("allowBack", input.checked);
255 | };
256 | input.addEventListener("click", handleClick, false);
257 | label.appendChild(input);
258 | label.appendChild(document.createTextNode("Allow back (don't remove page from back/forward history)"));
259 | label.style.fontFamily = "sans-serif";
260 | body.appendChild(label);
261 | window.addEventListener("unload", function destroy(e) {
262 | window.removeEventListener("unload", destroy, false);
263 | input.removeEventListener("click", handleClick, false);
264 | }, false);
265 | };
266 | if(document.readyState == "loading")
267 | window.addEventListener("load", optionsUI, false);
268 | else
269 | optionsUI();
270 | destroy();
271 | return;
272 | }
273 |
274 | var ael = di.ael || (di.ael = window.addEventListener);
275 | var rel = di.rel || (di.rel = window.removeEventListener);
276 | var setTimeout = window.setTimeout.bind(window);
277 |
278 | var host = (function() { // a.example.com => example.com
279 | var tld = "msk.ru|org.ua"; // Only currently used TLD, for better performance
280 | var tldRe = new RegExp("[^.]+\\.(?:" + tld.replace(/\./g, "\\.") + "|[^.]+)$");
281 | return location.hostname.match(tldRe)[0];
282 | })();
283 | var _iid, _img, _src, _clearDoc;
284 | var _wait;
285 | function _e(nn) {
286 | return document.createElementNS("http://www.w3.org/1999/xhtml", nn);
287 | }
288 | function $(id) {
289 | return document.getElementById(id);
290 | }
291 | function $t(tag, node) {
292 | return (node || document).getElementsByTagName(tag);
293 | }
294 | function $c(className, node) {
295 | if(!node)
296 | node = document;
297 | if(node.getElementsByClassName)
298 | return node.getElementsByClassName(className);
299 | var classNames = className.split(/\s+/);
300 | var count = classNames.length;
301 | var regs = [];
302 | for(var i = 0; i < count; ++i)
303 | regs.push(new RegExp("(^|\\s)" + classNames[i].replace(/[\\\/.^$+*?|()\[\]{}]/g, "\\$&") + "(\\s|$)"));
304 | var out = [];
305 | var nodes = node.getElementsByTagName("*");
306 | main:
307 | for(var i = 0, l = nodes.length; i < l; ++i) {
308 | var n = nodes[i];
309 | var c = n.className;
310 | for(var j = 0; j < count; ++j)
311 | if(!regs[j].test(c))
312 | continue main;
313 | out.push(n);
314 | }
315 | return out;
316 | }
317 | function $i(mask, node, exclude) {
318 | var imgs = node
319 | ? node.getElementsByTagName("img")
320 | : document.images;
321 | for(var i = 0, len = imgs.length; i < len; ++i) {
322 | var src = imgs[i].src;
323 | if(
324 | src && mask.test(src)
325 | && (!exclude || !exclude.test(src))
326 | )
327 | return src;
328 | }
329 | return "";
330 | }
331 | function $ie(mask, exclude, node) {
332 | return $i(mask, node, exclude);
333 | }
334 | function $inp(mask, node) {
335 | var inps = (node || document).getElementsByTagName("input");
336 | for(var i = 0, len = inps.length; i < len; ++i) {
337 | var val = inps[i].value;
338 | if(mask.test(val))
339 | return val;
340 | }
341 | return "";
342 | }
343 | function $a(mask, node) {
344 | var links = (node || document).getElementsByTagName("a");
345 | for(var i = 0, len = links.length; i < len; ++i) {
346 | var link = links[i];
347 | if(mask.test(link.href))
348 | return link;
349 | }
350 | return null;
351 | }
352 | function $th(imgRe, thumbRe, replacements) {
353 | var src = $i(imgRe);
354 | if(src)
355 | return src;
356 | src = $i(thumbRe);
357 | if(src) for(var find in replacements)
358 | src = src.replace(find, replacements[find]);
359 | return src;
360 | }
361 | function $u(node) {
362 | if(node && node.nodeName.toLowerCase() == "input")
363 | return $url(node.value);
364 | return "";
365 | }
366 | function $url(s) {
367 | if(/^https?:\/\/\S+$/.test(s) && !/html?$/.test(s))
368 | return s;
369 | return "";
370 | }
371 | function $dec(url) {
372 | try {
373 | return decodeURIComponent(url);
374 | }
375 | catch(e) {
376 | }
377 | return url;
378 | }
379 | function ogImage() {
380 | var metaImg = document.querySelector && document.querySelector('meta[property="og:image"][content^="http"]');
381 | return metaImg && metaImg.getAttribute("content") || "";
382 | }
383 | function redirect(url) {
384 | if(allowBack)
385 | location.href = url;
386 | else
387 | location.replace(url);
388 | }
389 | function clearDoc(src) {
390 | window.stop();
391 |
392 | var html = _e("html");
393 | var head = _e("head");
394 | var title = _e("title");
395 | var imgName = $dec(src.match(/[^\/]*$/)[0]);
396 | title.appendChild(document.createTextNode(imgName + " - Direct Images"));
397 | head.appendChild(title);
398 | var link = _e("link");
399 | link.rel = "shortcut icon";
400 | link.href = src;
401 | head.appendChild(link);
402 | var style = _e("style");
403 | style.type = "text/css";
404 | style.appendChild(document.createTextNode("\
405 | html, html > body {\n\
406 | margin: 0; padding: 0;\n\
407 | width: auto !important; height: auto !important; /* for https://userstyles.org/styles/101141/ru-adlist-css-fixes */\n\
408 | }\n\
409 | .zoomIn { cursor: -moz-zoom-in; cursor: -webkit-zoom-in; cursor: zoom-in; }\n\
410 | .zoomOut { cursor: -moz-zoom-out; cursor: -webkit-zoom-out; cursor: zoom-out; }\n\
411 | /* From resource://gre/res/TopLevelImageDocument.css */\n\
412 | @media not print {\n\
413 | img {\n\
414 | text-align: center;\n\
415 | position: absolute;\n\
416 | margin: auto;\n\
417 | top: 0;\n\
418 | right: 0;\n\
419 | bottom: 0;\n\
420 | left: 0;\n\
421 | }\n\
422 | }"
423 | ));
424 | head.appendChild(style);
425 |
426 | var meta = _e("meta");
427 | meta.name = "viewport";
428 | meta.content = "width=device-width; height=device-height;";
429 | head.appendChild(meta);
430 |
431 | link = _e("link");
432 | link.rel = "stylesheet";
433 | link.href = "resource://gre/res/TopLevelImageDocument.css";
434 | head.appendChild(link);
435 | link = link.cloneNode(true);
436 | link.href = "chrome://global/skin/TopLevelImageDocument.css";
437 | head.appendChild(link);
438 | link = link.cloneNode(true);
439 | link.href = "chrome://global/skin/media/TopLevelImageDocument.css"; // Firefox 19.0a1
440 | head.appendChild(link);
441 |
442 | var body = _e("body");
443 | var img = _e("img");
444 | var stl = img.style;
445 | stl.maxWidth = window.innerWidth + "px";
446 | stl.maxHeight = window.innerHeight + "px";
447 |
448 | var originalSize = false;
449 |
450 | var simpleZoom, destroySimpleZoom, preventClickUnders;
451 | ael.call(window, "click", simpleZoom = function(e) {
452 | if(e.button != 0 || e.target != img)
453 | return;
454 | originalSize = !originalSize;
455 | if(originalSize) {
456 | stl.maxWidth = stl.maxHeight = null;
457 | scrollToClicked(e, img.width, img.height);
458 | }
459 | else {
460 | stl.maxWidth = window.innerWidth + "px";
461 | stl.maxHeight = window.innerHeight + "px";
462 | }
463 | e.preventDefault();
464 | e.stopPropagation();
465 | e.stopImmediatePropagation && e.stopImmediatePropagation();
466 | }, true);
467 | ael.call(window, "mouseup", preventClickUnders = function(e) {
468 | e.stopPropagation();
469 | e.stopImmediatePropagation && e.stopImmediatePropagation();
470 | }, true);
471 | ael.call(window, "unload", destroySimpleZoom = function() {
472 | rel.call(window, "unload", destroySimpleZoom, false);
473 | rel.call(window, "click", simpleZoom, true);
474 | rel.call(window, "mouseup", preventClickUnders, true);
475 | }, false);
476 |
477 | var initResizer;
478 | ael.call(img, "load", initResizer = function(e) {
479 | rel.call(img, "load", initResizer, false);
480 | destroySimpleZoom();
481 |
482 | stl.maxWidth = stl.maxHeight = null;
483 | var iw = img.width;
484 | var ih = img.height;
485 | var size = iw + " × " + ih;
486 | function fitSize(check) {
487 | var ww = window.innerWidth;
488 | var wh = window.innerHeight;
489 | var canFit = iw > ww || ih > wh;
490 | if(check)
491 | return canFit;
492 | if(canFit) {
493 | var persent = Math.min(ww/iw, wh/ih);
494 | stl.width = iw*persent + "px";
495 | stl.height = ih*persent + "px";
496 | stl.marginTop = null;
497 | persent = Math.floor(persent*100); // Inherit Firefox built-in resizer behavior...
498 | document.title = imgName + " (" + size + ", " + persent + "%)" + " - Direct Images";
499 | }
500 | else {
501 | origSize();
502 | }
503 | setCursor(canFit);
504 | return canFit;
505 | }
506 | function origSize() {
507 | stl.width = stl.height = null;
508 | document.title = imgName + " (" + size + ")" + " - Direct Images";
509 | if(ih > window.innerHeight) // Override styles from resource://gre/res/TopLevelImageDocument.css
510 | stl.marginTop = 0;
511 | }
512 | function setCursor(canFit) {
513 | if(canFit == undefined)
514 | canFit = fitSize(true);
515 | img.className = canFit
516 | ? originalSize
517 | ? "zoomOut"
518 | : "zoomIn"
519 | : "";
520 | }
521 | function toggleFitSize(e) {
522 | if(e.button != 0 || e.target != img)
523 | return;
524 | if(!fitSize(true)) { // Nothing to toggle
525 | setCursor(false);
526 | return;
527 | }
528 | originalSize = !originalSize;
529 | if(originalSize) {
530 | origSize();
531 | scrollToClicked(e, iw, ih);
532 | }
533 | else
534 | fitSize();
535 | setCursor(true);
536 | }
537 | function onResize(e) {
538 | if(!originalSize)
539 | fitSize();
540 | setCursor();
541 | }
542 | ael.call(window, "click", toggleFitSize, true);
543 | ael.call(window, "resize", onResize, false);
544 | ael.call(window, "unload", function destroy(e) {
545 | rel.call(window, e.type, destroy, false);
546 | rel.call(window, "click", toggleFitSize, true);
547 | rel.call(window, "resize", onResize, false);
548 | }, false);
549 | if(originalSize) {
550 | origSize();
551 | setCursor();
552 | }
553 | else {
554 | fitSize();
555 | }
556 | }, false);
557 | img.addEventListener("load", initResizer, false); // At least for Firefox 93
558 |
559 | function scrollToClicked(e, iw, ih) {
560 | if(!iw || !ih)
561 | return;
562 | var ww = window.innerWidth;
563 | var wh = window.innerHeight;
564 | var dx = e.clientX/ww;
565 | var dy = e.clientY/wh;
566 | window.scrollTo(
567 | Math.max(0, dx*iw - ww/2),
568 | Math.max(0, dy*ih - wh/2)
569 | );
570 | }
571 |
572 | img.src = img.alt = src;
573 | body.appendChild(img);
574 |
575 | html.appendChild(head);
576 | html.appendChild(body);
577 |
578 | for(var lc; lc = document.lastChild; )
579 | document.removeChild(lc);
580 | document.appendChild(html);
581 |
582 | // Prevent modifications, used new Function() to bypass unsafeWindow things in GreaseMonkey
583 | if(Object.defineProperty)
584 | new window.Function('var i = document.images[0]; Object.defineProperty(i, "src", { value: i.src });')();
585 | if(window.Node && Node.prototype) {
586 | var m = [
587 | "appendChild",
588 | "insertBefore",
589 | "removeChild",
590 | "replaceChild",
591 | //"setAttribute",
592 | "removeAttribute",
593 | "addEventListener"
594 | ];
595 | new window.Function("var p = Node.prototype; p." + m.join(" = p.") + " = function() {};")();
596 | }
597 | if(window.EventTarget && EventTarget.prototype)
598 | new window.Function("EventTarget.prototype.addEventListener = function() {};")();
599 | new window.Function("window.setTimeout = window.setInterval = function() {};")();
600 | var tmr = setTimeout(function checkCSS(_stopTime) {
601 | if(window.getComputedStyle(img, null).textAlign == "center")
602 | return; // Looks like all works fine
603 | // Let's reload styles...
604 | GM_log("Force reload styles");
605 | var links = document.getElementsByTagName("link");
606 | for(var i = 0, l = links.length; i < l; ++i) {
607 | var link = links[i];
608 | if(link.rel == "stylesheet")
609 | link.href = link.href.replace(/\?.*$/, "") + "?" + new Date().getTime();
610 | }
611 | var styles = document.getElementsByTagName("style");
612 | for(var i = 0, l = styles.length; i < l; ++i) {
613 | var style = styles[i];
614 | if(style.type != "text/css")
615 | continue;
616 | style.type = "text/force-reload";
617 | style.type = "text/css";
618 | }
619 | if(!_stopTime || _stopTime > new Date().getTime())
620 | setTimeout(checkCSS, 100, _stopTime || new Date().getTime() + 2e3);
621 | }, 0);
622 | GM_log("Remove timers: " + (tmr - 1));
623 | while(--tmr)
624 | clearTimeout(tmr);
625 | }
626 | hostLoop:
627 | switch(host) {
628 | // Get image by id:
629 | case "ipicture.ru": _iid = "newImg"; break;
630 | case "picamatic.com": _iid = "pic"; break;
631 | case "download.su": _iid = "thepic"; break;
632 | case "imageup.ru": _iid = "image"; break;
633 | case "pixshock.net": _iid = "mi"; break;
634 | case "image-share.com": _iid = "image"; break;
635 | case "10pix.ru": _iid = "image"; break;
636 | case "xmages.net": _iid = "img_obj"; break;
637 | case "opicture.ru": _iid = "newImg"; break;
638 | case "picamigo.com": _iid = "img_obj"; break;
639 | case "pikucha.ru": _iid = "image"; break;
640 | case "keep4u.ru": _iid = "foto"; break;
641 | case "imagebanana.com": _iid = "image"; break;
642 | case "yfrog.com": _iid = "main_image"; break;
643 | case "radikal.ua": _iid = "image"; break;
644 | case "radikalno.ru": _iid = "image"; break;
645 | case "upyourpic.org": _iid = "mainimage"; break;
646 | case "postimg.com": _iid = "image"; break;
647 | case "bild.me": _iid = "Bild"; break;
648 | case "pictureshack.ru": _iid = "image"; break;
649 | case "pixs.ru": _iid = "imgg"; break;
650 | case "minus.com": _iid = "current_image"; break;
651 | case "overpic.net": _iid = "main_img"; break;
652 | case "pictube.ru": _iid = "full_image"; break;
653 | case "owely.com": _iid = "issueImg"; break;
654 | case "uaimage.com": _iid = "im"; break;
655 | case "vfl.ru": _iid = "img_foto"; break;
656 | case "geekpics.net": _iid = "full_image"; break;
657 | case "grab.by": _iid = "thegrab"; break;
658 | case "someimage.com": _iid = "viewimage"; break;
659 | case "skrinshoter.ru": _iid = "screenshot-image"; break;
660 | case "imagetitan.com": _iid = "image"; break;
661 | case "picshare.ru": _iid = "image"; break;
662 | case "turboimagehost.com": _iid = "uImage"; break;
663 |
664 | // URL-based redirect:
665 | case "smages.com":
666 | if(/^https?:\/\/(?:www\.)?smages\.com\/(.*?)\.htm/i.test(loc))
667 | _src = "http://smages.com/i/" + RegExp.$1;
668 | break;
669 | case "anub.ru":
670 | if(/^https?:\/\/(?:www\.)?anub\.ru\/pic\/(.+)$/i.test(loc))
671 | _src = "http://anub.ru/uploads/" + RegExp.$1;
672 | break;
673 | case "onlinedisk.ru":
674 | if(/^https?:\/\/(?:www\.)?onlinedisk\.ru\/(?:image|view)\/(\d+)(?:\/.*)?$/i.test(loc))
675 | _src = "http://onlinedisk.ru/get_image.php?id=" + RegExp.$1;
676 | break;
677 | case "fotoupload.ru": //~ todo: remove?
678 | case "vanilla.su": //~ todo: remove?
679 | case "prostofotka.ru": //~ todo: remove?
680 | case "foto-screen.ru": //~ todo: remove?
681 | case "foto-screen.org":
682 | case "foto-boom.org":
683 | case "pixmaster.net":
684 | _src = loc.replace("/viewer.php?file=", "/images/");
685 | break;
686 | case "itrash.ru":
687 | case "sendpic.ru":
688 | _src = loc.replace(/\.html?$/, "");
689 | break;
690 | case "imget.ru":
691 | _src = loc.replace("/show/?img=", "");
692 | break;
693 | case "fastpic.msk.ru":
694 | _src = loc.replace("/?v=", "/images/");
695 | break;
696 | case "youpic.su":
697 | _src = loc.replace(/^(https?:\/\/).*?\?id=/, "$1");
698 | break;
699 | case "jpegshare.net":
700 | _src = loc
701 | .replace(/jpegshare\.net\//, "$&images/")
702 | .replace(/\.html$/, "");
703 | break;
704 | case "imagelike.org":
705 | _src = loc.replace("/?v=", "/images/");
706 | break;
707 | case "rupix.org":
708 | _src = loc.replace("/viewer.php?file=", "/images/");
709 | break;
710 | case "all-poster.ru":
711 | _src = loc.replace("/?v=", "/images/");
712 | break;
713 | case "picsee.net":
714 | _src = loc
715 | .replace(/^https?:\/\/(?:\w+\.)*picsee\.net\//, "$&upload/")
716 | .replace(/\.html$/, "");
717 | break;
718 | case "bigstream.ru":
719 | _src = loc.replace("/viewer.php?file=", "/i/");
720 | break;
721 | case "toile-libre.org":
722 | _src = loc.replace("/?img=", "/upload/original/");
723 | break;
724 | case "fast-picture.ru":
725 | _src = loc.replace(/\.html?$/, "");
726 | break;
727 | case "pasteboard.co":
728 | _src = loc.replace("http://pasteboard.co/", "https://cdn.pbrd.co/images/");
729 | break;
730 | case "img-host.org.ua":
731 | _src = loc.replace("/?v=", "/images/");
732 | break;
733 | case "gameru.net":
734 | _src = loc
735 | .replace("/image/", "/image/direct/")
736 | .replace(/\.html$/, "");
737 | break;
738 | case "imgdepo.com":
739 | _src = loc.replace("/show/", "/id/");
740 | break;
741 | case "stick.kz":
742 | // stick.kz/?v=2016-07-19_foo.jpg
743 | // stick.kz/img/2016-07/19/foo.jpg
744 | _src = loc.replace(/\/\?v=(\d{4}-\d\d)-(\d\d)_/, "/img/$1/$2/");
745 | break;
746 | case "imagestun.com":
747 | _src = loc.replace("/?v=", "/kartinki/");
748 | break;
749 | case "picua.org":
750 | // picua.org/?v=2016-08-06_foo.png
751 | // picua.org/img/2016-08/06/foo.png
752 | _src = loc.replace(/\/\?v=(\d{4}-\d\d)-(\d\d)_/, "/img/$1/$2/");
753 | break;
754 | case "giphy.com":
755 | // http://media1.giphy.com/media/yr7n0u3qzO9nG/giphy.gif
756 | // http://i.giphy.com/yr7n0u3qzO9nG.gif
757 | _src = loc
758 | .replace(/^https?:\/\/\w+\.giphy\.com\/media\//, "https://i.giphy.com/")
759 | .replace(/\/\w+(\.\w+)$/, "$1");
760 | break;
761 | case "scrin.org":
762 | _src = loc.replace(/\/\?v=(\w+\.\w+)/, function(s, name) {
763 | return "/i/" + name.replace(/_/g, "/");
764 | });
765 | break;
766 | case "lostpix.com":
767 | // lostpix.com/?v=2018-01-09_foo.png
768 | // lostpix.com/img/2018-01/09/foo.png
769 | _src = loc.replace(/\/\?v=(\d{4}-\d\d)-(\d\d)_/, "/img/$1/$2/");
770 | break;
771 | case "picplus.ru":
772 | _src = loc.replace("/ful/", "/img/");
773 | break;
774 |
775 | // Get image by src:
776 | case "imagepix.org":
777 | _src = $i(/^https?:\/\/(?:www\.)?imagepix\.org\/full\/\w+\.\w+$/i);
778 | break;
779 | case "saveimg.ru":
780 | _src = $i(/^https?:\/\/(?:www\.)?saveimg\.ru\/pictures\/[\w\/-]+?\/[a-f0-9]{25,}\.[a-z]+$/);
781 | break;
782 | case "mediapix.ru":
783 | _src = $i(/^https?:\/\/(?:www\.)?mediapix\.ru\/pics\/[a-f0-9]{25,}\.[a-z]+$/);
784 | break;
785 | case "pixs.ru":
786 | _src = $i(/^https?:\/\/img\.pixs\.ru\/storage\//);
787 | break;
788 | case "postimage.org":
789 | _src = $i(/^https?:\/\/\w+\.postimage.org\//);
790 | break;
791 | case "uaimages.com":
792 | _src = $i(/^https?:\/\/(?:www\.)?uaimages\.com\/images\/\w+\.\w+$/);
793 | break;
794 | case "7image.ru":
795 | _src = $i(/^https?:\/\/7image\.ru\/pics\/[^?]+\.\w+$/);
796 | break;
797 | case "mepic.ru":
798 | _src = $i(/^https?:\/\/mepic\.ru\/up\/[^?]+\.\w+$/);
799 | break;
800 | case "simplest-image-hosting.net":
801 | _src = $i(/^https?:\/\/\w+\.simplest-image-hosting\.net\/[^?]+\.\w+$/);
802 | break;
803 | case "pics.kz":
804 | _src = $i(/^https?:\/\/pics\.kz\/[^?]+\/[0-9a-f]{32,}\.\w+$/);
805 | break;
806 | case "imagepost.ru":
807 | _src = $i(/^https?:\/\/(?:www\.)?imagepost\.ru\/images\/[^?]+\.\w+$/);
808 | break;
809 | case "imgtheif.com":
810 | _src = $i(/^https?:\/\/(?:www\.)?imgtheif\.com\/pictures\/[^?]+\.\w+$/);
811 | break;
812 | case "hostingkartinok.com":
813 | _src = $i(/^https?:\/\/(?:\w+\.)?hostingkartinok\.com\/[^#]+[0-9a-f]{32,}\.\w+$/);
814 | break;
815 | case "image.kz":
816 | _src = $i(/^https?:\/\/(?:www\.)?image\.kz\/[^?]+\/[0-9a-f]{32,}\.\w+$/);
817 | break;
818 | case "imm.io":
819 | _src = $i(/^https?:\/\/(?:\w+\.)?imm\.io\/[^?]+\.\w+$/);
820 | break;
821 | case "narodpix.net":
822 | _src = $i(/^https?:\/\/(?:\w+\.)?narodpix\.net\/img\/[^?]+\.\w+$/);
823 | break;
824 | case "firepic.org":
825 | _src = $i(/^https?:\/\/(?:\w+\.)*firepic\.org\/[^?]*images\/[^?]+\.\w+$/);
826 | break;
827 | case "you-logo.ru":
828 | _src = $i(/^https?:\/\/(?:\w+\.)*you-logo\.ru\/[^?]+\/[^?\/]{32,}\.\w+$/);
829 | break;
830 | case "uploadimagex.com":
831 | _src = $i(/^https?:\/\/(?:\w+\.)*uploadimagex\.com\/uploads\/(?:[^?\/]+\/)*[^?\/]+\.\w+$/);
832 | break;
833 | case "toroff.net":
834 | _src = $i(/^https?:\/\/(?:\w+\.)*toroff\.net\/img\/(?:[^?\/]+\/)*[^?\/]{15,}\.\w+$/);
835 | break;
836 | case "clip2net.com":
837 | _src = $i(/^https?:\/\/(?:\w+\.)*clip2net\.com\/clip\/[^?]+\.\w+(?:\?nocache=\d+)?$/)
838 | .replace(/\?nocache=\d+?$/, "");
839 | break;
840 | case "screencast.com":
841 | _src = $i(/^https?:\/\/content\.screencast\.com\/[^?]+\.\w+$/);
842 | break;
843 | case "lastusja.ru":
844 | _src = $i(/^https?:\/\/(?:\w+\.)*lastusja\.ru\/images\/[^?]+\.\w+$/);
845 | break;
846 | case "gyazo.com":
847 | _src = $i(/^https?:\/\/(?:\w+\.)*gyazo\.com\/[\da-f]{32,}\.\w+$/);
848 | break;
849 | case "imgchilibum.ru":
850 | _src = $i(/^https?:\/\/imgchilibum\.ru\/[^?]+\/[\da-f]{32,}\.\w+$/);
851 | break;
852 | case "imglink.ru":
853 | _src = $i(/^https?:\/\/imglink\.ru\/pictures\/[^?]+\/[\da-f]{32,}\.\w+$/);
854 | break;
855 | case "fotolink.su":
856 | _src = $i(/^https?:\/\/(?:\w+\.)?fotolink\.su\/pic_b\/[^?]*[\da-f]{32,}\.\w+$/);
857 | _clearDoc = true;
858 | break;
859 | case "netpics.org":
860 | _src = $i(/^https?:\/\/netpics\.org\/images\/[^?]+\/\w+\.\w+$/);
861 | break;
862 | case "ximage.ru":
863 | _src = $i(/^https?:\/\/(?:\w+\.)*ximage\.ru\/data\/imgs\/[^?]+\.\w+$/);
864 | break;
865 | case "ii4.ru":
866 | _src = $i(/^https?:\/\/(?:\w+\.)*ii4\.ru\/images\/[^?]+\.\w+$/);
867 | break;
868 | case "freescreens.ru":
869 | _src = $i(/^https?:\/\/(?:\w+\.)*freescreens\.ru\/allimage\/[^?]+\.\w+$/);
870 | break;
871 | case "powerlogo.ru":
872 | _src = $i(/^https?:\/\/(?:\w+\.)*powerlogo\.ru\/pictures\/[\da-f]{32,}\.\w+$/);
873 | break;
874 | case "savepice.ru":
875 | _src = $i(/^https?:\/\/(?:\w+\.)*savepice\.ru\/uploads\/[^?]+\/[\da-f]{32,}[^?\/]+\.\w+$/);
876 | break;
877 | case "funkyimg.com":
878 | _src = $i(/^https?:\/\/(?:\w+\.)*funkyimg\.com\/i\/[^?\/]+\.\w+$/);
879 | break;
880 | case "imagesnake.com":
881 | _src = $i(/^https?:\/\/(?:\w+\.)*imagesnake\.com\/tn\/i\d+\/[^?\/]+\.\w+(?:\?id=\w+)?$/);
882 | break;
883 | case "imagevenue.com":
884 | _src = $i(/^https:\/\/cdn-images\.imagevenue\.com\/[^?]+\.\w+$/);
885 | if(!_src)
886 | _iid = "thepic";
887 | break;
888 |
889 | // Get image from thumbnail:
890 | case "piccash.net":
891 | _src = $th(
892 | /^https?:\/\/piccash\.net\/[^?]+\/img_full\/\w+\.\w+$/,
893 | /^https?:\/\/piccash\.net\/[^?]+\/img_thumb\/\w+-thumb\.\w+$/,
894 | {
895 | "/img_thumb/": "/img_full/",
896 | "-thumb.": "."
897 | }
898 | );
899 | break;
900 | case "pic4you.ru":
901 | _src = $th(
902 | /^https?:\/\/(?:\w+\.)?pic4you\.ru\/[^?]+\/\d+\.\w+$/,
903 | /^https?:\/\/(?:\w+\.)?pic4you\.ru\/[^?]+\/\d+-thumb\.\w+$/,
904 | { "-thumb.": "." }
905 | );
906 | break;
907 | case "picforall.ru":
908 | case "payforpic.ru":
909 | case "pix-x.net":
910 | case "picclick.ru":
911 | case "imgclick.ru":
912 | case "imgbase.ru":
913 | case "picpays.ru":
914 | case "drlink.online":
915 | var more = $c("more_images"); // Blocks with "similar images" (on pix-x.net)
916 | for(var i = more.length - 1; i >= 0; --i)
917 | more[i].parentNode.removeChild(more[i]);
918 | _src = $th(
919 | /^https?:\/\/[^\/]+\/allimage\/[^?]+\/\d+\.\w+$/,
920 | /^https?:\/\/[^\/]+\/allimage\/[^?]+\/\d+-thumb\.\w+$/,
921 | {
922 | "/img_thumb/": "/img_full/",
923 | "-thumb.": "."
924 | }
925 | );
926 | break;
927 | case "pronpic.org":
928 | var img = $("full_img");
929 | if(img) { // May be hidden in case of detected AdBlock!
930 | _src = img.src;
931 | break;
932 | }
933 | var th = $("small_img");
934 | if(th)
935 | _src = th.src.replace("/th_", "/");
936 | break;
937 |
938 | // Other:
939 | case "imageshack.us":
940 | case "imageshack.com":
941 | _src = $inp(/^https?:\/\/(?:\w+\.)*imageshack\.us\/(?:\w+\/)?img[^?]*\.\w+$/i);
942 | break;
943 | case "savepic.ru":
944 | case "savepic.org":
945 | case "savepic.net":
946 | case "savepic.su":
947 | var inp = $("http");
948 | if(inp) {
949 | _src = inp.value;
950 | break;
951 | }
952 | var imgs = document.images;
953 | for(var i = 0, len = imgs.length; i < len; ++i) {
954 | var img = imgs[i];
955 | var h = img.parentNode.href;
956 | var s = img.src;
957 | if(
958 | h && /^https?:\/\/(?:www\.)?savepic\.\w+\/\d+m\.htm$/.test(h)
959 | && s && /^https?:\/\/(?:www\.)?savepic\.\w+\/\d+\.[a-z0-9]{3,4}$/.test(s)
960 | ) {
961 | _src = s;
962 | break;
963 | }
964 | }
965 | break;
966 | case "piccy.info":
967 | if(/\/orig\/?$/.test(loc))
968 | _iid = "mainim";
969 | else
970 | _src = loc.replace(/(?:\/\d{2,4})?\/?$/, "/orig/");
971 | break;
972 | case "xtupload.com":
973 | var src = $inp(/^\[url=[^\[\]]+\]\[img\](http:\/\/(?:www\.)?xtupload.com\/\w+\/image-[^\[\]]+)\[\/img\]\[\/url\]/);
974 | if(src)
975 | _src = RegExp.$1;
976 | break;
977 | case "picatom.com":
978 | _img = document.getElementsByName("fred")[0];
979 | break;
980 | case "fotosik.pl":
981 | if(loc.indexOf("/pelny/") != -1)
982 | _iid = "photoDivImage";
983 | else
984 | redirect(loc.replace(/\/pokaz_obrazek\//i, "$&pelny/"));
985 | break;
986 | case "yandex.ru":
987 | var cont = $("sizes-list");
988 | if(!cont)
989 | break;
990 | var opts = cont.getElementsByTagName("div"), oLen = opts.length;
991 | if(!oLen)
992 | break;
993 | var a = opts[oLen - 1].getElementsByTagName("a");
994 | if(a.length)
995 | _src = a[0].href;
996 | if(!_src) {
997 | cont = $("fotka-view");
998 | if(!cont)
999 | break;
1000 | var imgs = cont.getElementsByTagName("img");
1001 | if(!imgs.length)
1002 | break;
1003 | _img = imgs[0];
1004 | }
1005 | break;
1006 | case "southwc.ru":
1007 | var links = $t("a");
1008 | for(var i = 0, len = links.length; i < len; ++i) {
1009 | var a = links[i];
1010 | if(a.getAttribute("rel") == "lightbox[roadtrip]") {
1011 | _src = a.href;
1012 | break;
1013 | }
1014 | }
1015 | break;
1016 | case "pict.com":
1017 | var link = $("original-link");
1018 | if(link)
1019 | _src = link.href;
1020 | break;
1021 | case "imageban.ru":
1022 | _src = $inp(/^https?:\/\/(?:\w+\.)*imageban\.ru\/out\//);
1023 | _clearDoc = true;
1024 | break;
1025 | case "habreffect.ru":
1026 | var node = $("image");
1027 | if(!node)
1028 | break;
1029 | var imgs = node.getElementsByTagName("img");
1030 | if(imgs.length == 1)
1031 | _img = imgs[0];
1032 | break;
1033 | case "rghost.ru":
1034 | case "rghost.net":
1035 | case "rgho.st":
1036 | var inp = $("direct_link");
1037 | if(inp && inp.value) //~ old?
1038 | _src = inp.value;
1039 | else if(!$("hashes") && /^https?:\/\/rgho(?:\.st|st\.\w+)(?:\/\w+)+\.view$/.test(loc))
1040 | _src = $i(/^https?:\/\/(?:\w+\.)*rgho(?:\.st|st\.\w+)\/[^?]+\/image\.\w+$/);
1041 | break;
1042 | case "itmages.ru":
1043 | case "itmages.com":
1044 | if(loc.indexOf("/preview/") != -1)
1045 | _src = loc.replace("/preview/", "/view/");
1046 | else
1047 | _iid = "image";
1048 | break;
1049 | case "floomby.ru":
1050 | if(!/\/full\/?$/.test(loc)) {
1051 | _src = loc.replace(/\/$/, "") + "/full/";
1052 | break;
1053 | }
1054 | _src = $i(/^https?:\/\/(?:\w+\.)*floomby\.\w+\/files\/share\/[^?]+\.\w+$/);
1055 | break;
1056 | case "kinopoisk.ru":
1057 | var links = $t("a");
1058 | for(var i = 0, len = links.length; i < len; ++i) {
1059 | var a = links[i];
1060 | if(!/\/picture\/\d+\//.test(a.href))
1061 | continue;
1062 | var contents = a.getElementsByTagName("*");
1063 | if(contents.length == 1 && contents[0].nodeName.toLowerCase() == "img") {
1064 | _src = contents[0].src;
1065 | break;
1066 | }
1067 | }
1068 | break;
1069 | case "tenpic.ru":
1070 | var ta = $t("textarea");
1071 | if(ta.length && /^https?:\/\/tenpic\.ru\//.test(ta[0].value))
1072 | _src = ta[0].value;
1073 | break;
1074 | case "imghost.in":
1075 | var links = $t("a");
1076 | for(var i = 0, len = links.length; i < len; ++i) {
1077 | var a = links[i];
1078 | if(!/^https?:\/\/imghost\.in\/di-\d+\.\w+$/.test(a.href))
1079 | continue;
1080 | var imgs = a.getElementsByTagName("img");
1081 | if(imgs.length == 1 && /^https?:\/\/imghost\.in\/dt-\d+\.\w+$/.test(imgs[0].src)) {
1082 | _src = a.href;
1083 | break;
1084 | }
1085 | }
1086 | break;
1087 | case "binimage.org":
1088 | var frs = document.getElementsByTagName("iframe");
1089 | if(!frs.length)
1090 | break;
1091 | var fr = frs[0];
1092 | _src = fr.getAttribute("src").charAt(0) == "/" && fr.src;
1093 | break;
1094 | case "forlazypeople.com":
1095 | case "upit.biz":
1096 | var node = $("imagen");
1097 | if(!node)
1098 | break;
1099 | var imgs = node.getElementsByTagName("img");
1100 | if(imgs.length == 1)
1101 | _img = imgs[0];
1102 | break;
1103 | case "imgur.com":
1104 | var src = ogImage()
1105 | .replace(/\?fb$/, "");
1106 | if(/^https?:\/\/(?:\w+\.)*imgur\.com\/images\/logo-/.test(src)) // Logo is useless...
1107 | src = "";
1108 | else if(/\?fbplay$/.test(src)) { // Video?
1109 | destroy();
1110 | break;
1111 | }
1112 | if(src && loc.indexOf("/a/") == -1) { // Not a gallery?
1113 | _src = src;
1114 | _clearDoc = true;
1115 | break;
1116 | }
1117 | if(!di._src) // Will be changed, remember initial value...
1118 | di._src = src;
1119 | var imgCount = $c("Gallery-Content--mediaContainer").length;
1120 | if(!imgCount) { // Not yet lazy-loaded?
1121 | _wait = true;
1122 | break;
1123 | }
1124 | if(imgCount > 1) // Many images?
1125 | break;
1126 | _src = di._src || src;
1127 | break;
1128 | case "goodfon.ru":
1129 | case "goodfon.su":
1130 | case "badfon.ru":
1131 | var a = $("im");
1132 | if(a)
1133 | _src = a.href;
1134 | break;
1135 | case "image-upload.net":
1136 | var inp = document.getElementById("codedirect");
1137 | if(inp)
1138 | _src = inp.value;
1139 | break;
1140 | case "imageshost.ru":
1141 | //_img = $("image");
1142 | //if(_img)
1143 | // break;
1144 | var content = $("content");
1145 | if(!content)
1146 | break;
1147 | var ps = content.getElementsByTagName("p");
1148 | for(var i = 0, l = ps.length; i < l; ++i)
1149 | if(ps[i].textContent == "Другие изображения из данного альбома")
1150 | break hostLoop;
1151 | _src = $i(/^https?:\/\/(?:\w+\.)?imageshost\.ru\/img\/[^?]+\.\w+$/, content);
1152 | break;
1153 | case "screenshotuploader.com":
1154 | var node = $("padd");
1155 | _img = node && node.getElementsByTagName("img")[0];
1156 | break;
1157 | case "prntscr.com":
1158 | var nodes = $c("image__pic");
1159 | if(nodes.length == 1 && nodes[0].nodeName.toLowerCase() == "img")
1160 | _img = nodes[0];
1161 | break;
1162 | case "ifotki.info":
1163 | _src = $i(/^https?:\/\/(?:\w+\.)?ifotki\.info\/([^?]+\/)?[0-9a-f]{32,}\.\w+$/);
1164 | if(!_src) {
1165 | var src = $inp(/^\[url=http:\/\/ifotki\.info\/\]\[img\](.*?)\[\/img\]\[\/url\]$/);
1166 | if(src && !/html?$/.test(RegExp.$1))
1167 | _src = RegExp.$1;
1168 | }
1169 | break;
1170 | case "photobucket.com":
1171 | if($("flashcontent"))
1172 | break;
1173 | if(/^(http:\/\/\w+\.photobucket\.com\/[^?]+).*[?&]current=([^?]+)/.test(loc))
1174 | _src = (RegExp.$1 + RegExp.$2).replace(/\/\/s/, "//i");
1175 | else {
1176 | _clearDoc = true;
1177 | _src = $u($("linksModule_ccinput_1"));
1178 | if(!_src) {
1179 | var labels = document.getElementsByTagName("label");
1180 | for(var i = 0, l = labels.length; i < l; ++i) {
1181 | var label = labels[i];
1182 | if(/(?:^|\s)Direct(?:\s|$)/i.test(label.textContent)) {
1183 | _src = $u(label.parentNode.getElementsByTagName("input")[0]);
1184 | break;
1185 | }
1186 | }
1187 | }
1188 | }
1189 | break;
1190 | case "tinypic.com":
1191 | _clearDoc = true;
1192 | _src = $u($("direct-url"));
1193 | if(!_src) {
1194 | var block = $("flash-direct-url");
1195 | var embed = block && $t("embed", block)[0];
1196 | if(embed) {
1197 | var fv = embed.getAttribute("flashvars");
1198 | if(/=(http[^\s&]+)/.test(fv))
1199 | _src = $url($dec(RegExp.$1));
1200 | }
1201 | }
1202 | break;
1203 | case "fotohost.by":
1204 | var imgs = $c("pic");
1205 | if(imgs.length == 1)
1206 | _img = imgs[0];
1207 | break;
1208 | case "fastpic.ru":
1209 | case "fastpic.org":
1210 | _img = $c("image")[0] || null;
1211 | _clearDoc = true;
1212 | break;
1213 | case "joxi.ru":
1214 | case "joxi.net":
1215 | var links = $c("js-tile-link-zoom");
1216 | if(links.length)
1217 | _src = links[0].href;
1218 | break;
1219 | case "postimg.org":
1220 | var img = $("main-image");
1221 | if(!img)
1222 | break;
1223 | if(img.hasAttribute("data-full"))
1224 | _src = location.protocol + img.getAttribute("data-full").replace(/^https?:/, "");
1225 | else
1226 | _img = img;
1227 | _clearDoc = true;
1228 | break;
1229 | case "i-fotki.info":
1230 | if($inp(/^\[URL=[^\[\]]+\]\[IMG\](https?:\/\/(?:\w+\.)*ifotki\.info\/org\/[^?]+\.\w+)\[\/IMG\]\[\/URL\]$/i))
1231 | _src = RegExp.$1;
1232 | break;
1233 | case "4put.ru":
1234 | _src = $inp(/^https?:\/\/(?:\w+\.)*4put\.ru\/pictures\/max\/[^?]+\.\w+$/);
1235 | break;
1236 | case "fotkidepo.ru":
1237 | case "ixbt.photo":
1238 | _src = $a(/^https?:\/\/(?:\w+\.)*(?:fotkidepo\.ru|ixbt\.photo)\/photo\/[^?]+\.\w+$/);
1239 | break;
1240 | case "lostpic.net":
1241 | _src = $a(/^https?:\/\/(?:\w+\.)*lostpic\.net\/orig_images[^?]*\/[0-9a-f]{32,}\.\w+$/)
1242 | || ($i(/^https?:\/\/(?:\w+\.)*lostpic\.net\/[^?]*\/[0-9a-f]{32,}(?:\.md)?\.\w+$/) || "")
1243 | .replace(/\.md(\.\w+)$/, "$1")
1244 | break;
1245 | case "lg.ua":
1246 | _src = $a(/^https?:\/\/pic\.lg\.ua\/[^?]+\.\w+$/);
1247 | break;
1248 | case "cardse.net":
1249 | _src = $inp(/^https?:\/\/cardse\.net\/[^?]+\.\w+$/);
1250 | break;
1251 | case "image2you.ru":
1252 | var btn = $("_confirm");
1253 | if(btn)
1254 | btn.click();
1255 | else
1256 | _src = $i(/^https?:\/\/image2you\.ru\/allimages\/[^?]+\.\w+$/);
1257 | break;
1258 | case "cl.ly":
1259 | _src = ogImage();
1260 | if(_src && location.protocol == "https:" && /^http:\/+/i.test(_src))
1261 | _src = "https://s3.amazonaws.com/" + RegExp.rightContext;
1262 | break;
1263 | case "riotpixels.com":
1264 | _src = $a(/^https?:\/\/(?:\w+\.)?riotpixels\.\w+\/data\/[^?]+\.\w+$/);
1265 | break;
1266 | case "prnt.sc":
1267 | case "snag.gy":
1268 | case "directupload.net":
1269 | case "ibb.co":
1270 | _src = ogImage();
1271 | if(!_src) {
1272 | var img = document.querySelector && document.querySelector('img[src="' + location.pathname + '"]');
1273 | if(img && img.src == loc && img.parentNode != document.body) {
1274 | _src = loc;
1275 | _clearDoc = true;
1276 | }
1277 | }
1278 | break;
1279 | case "picturelol.com":
1280 | _img = $c("pic")[0] || null;
1281 | _clearDoc = true;
1282 | break;
1283 | case "imgdrive.net":
1284 | _src = ogImage()
1285 | .replace("/small/", "/big/");
1286 | break;
1287 | case "imagebam.com":
1288 | _src = ogImage();
1289 | break;
1290 | case "postimg.cc":
1291 | var dl = $("download");
1292 | _src = dl && dl.href && dl.href.replace(/\?dl=1$/, "");
1293 | _clearDoc = true;
1294 | break;
1295 | case "sasisa.org":
1296 | var links = $t("a");
1297 | for(var i = 0, l = links.length; i < l; ++i) {
1298 | var a = links[i];
1299 | if(a.textContent == "Скачать оригинал") {
1300 | _src = a.href;
1301 | break;
1302 | }
1303 | }
1304 | break;
1305 | case "radikal.host":
1306 | _src = ogImage();
1307 | }
1308 | if(_iid)
1309 | _img = $(_iid);
1310 | if(_img && _img.src && _img.offsetWidth && _img.offsetHeight) //~ todo: fails sometimes on DOMContentLoaded
1311 | _src = _img.src;
1312 | if(_src && _src != loc) {
1313 | GM_log("Redirect (" + (event ? event.type : "delay") + "):\n" + loc + "\n=> " + _src);
1314 | if(_clearDoc) {
1315 | if("history" in window && "pushState" in history) try {
1316 | history[allowBack ? "pushState" : "replaceState"]("", document.title, _src);
1317 | }
1318 | catch(e) { // SecurityError: The operation is insecure
1319 | setTimeout(function() { throw e; }, 0);
1320 | allowBack && history.pushState("", document.title, loc);
1321 | }
1322 | clearDoc(_src);
1323 | }
1324 | else {
1325 | redirect(_src);
1326 | }
1327 | destroy();
1328 | }
1329 | else if(_src) {
1330 | GM_log("Clear document (" + (event ? event.type : "delay") + "):\n" + loc);
1331 | clearDoc(_src);
1332 | destroy();
1333 | }
1334 | else if(document.readyState == "loading" || _wait) {
1335 | if(!("_count" in di)) {
1336 | di._count = 0;
1337 | // With disabled scripts setTimeout doesn't work
1338 | ael.call(window, "DOMContentLoaded", di, false);
1339 | ael.call(window, "load", di, false);
1340 | }
1341 | if(++di._count < 5*60e3/10)
1342 | di._timer = setTimeout(di, 10);
1343 | }
1344 | else if(event && event.type == "load")
1345 | destroy();
1346 | function destroy() {
1347 | di._timer && clearTimeout(di._timer);
1348 | rel.call(window, "DOMContentLoaded", di, false);
1349 | rel.call(window, "load", di, false);
1350 | }
1351 | })();
--------------------------------------------------------------------------------
/Direct_Links/direct_links.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Direct Links
3 | // @version 0.2.0pre4 - 2014-02-16
4 | // @description Redirect from download pages to files directly
5 | // @author Infocatcher
6 | // @namespace dev/null
7 | // @run-at document-start
8 | // @grant GM_log
9 | // @grant GM_getValue
10 | // @grant GM_setValue
11 |
12 | // @include about:blank?UserScripts/options/Direct_Links
13 |
14 | // @include http://sourceforge.net/projects/*/download
15 | // @include https://sourceforge.net/projects/*/download
16 | // @include http://sourceforge.net/projects/*/download?*
17 | // @include https://sourceforge.net/projects/*/download?*
18 | // @include http://systemexplorer.net/downloadi.php
19 | // @include http://systemexplorer.net/downloadp.php
20 | // @include http://systemexplorer.net/download-archive/*/SystemExplorer*
21 | // ==/UserScript==
22 |
23 | (function dl(event) {
24 | // You can change
25 | // greasemonkey.scriptvals.dev/null/Direct Links.*
26 | // in about:config
27 | var allowBack = getPref("allowBack", false);
28 |
29 | var loc = location.href;
30 | if(
31 | loc == "about:blank?UserScripts/options/Direct_Links"
32 | && typeof GM_setValue == "function"
33 | ) {
34 | document.title = "Direct Links Options";
35 | var body = document.body || document.documentElement;
36 | var label = document.createElementNS("http://www.w3.org/1999/xhtml", "label");
37 | label.htmlFor = "allowBack";
38 | var input = document.createElementNS("http://www.w3.org/1999/xhtml", "input");
39 | input.id = "allowBack";
40 | input.type = "checkbox";
41 | input.checked = allowBack;
42 | var handleClick = function() {
43 | GM_setValue("allowBack", input.checked);
44 | };
45 | input.addEventListener("click", handleClick, false);
46 | label.appendChild(input);
47 | label.appendChild(document.createTextNode("Allow back (don't remove page from back/forward history)"));
48 | body.appendChild(label);
49 | window.addEventListener("unload", function destroy(e) {
50 | window.removeEventListener("unload", destroy, false);
51 | input.removeEventListener("click", handleClick, false);
52 | }, false);
53 | destroy();
54 | return;
55 | }
56 |
57 | var host = location.hostname
58 | .split(".")
59 | .slice(-2)
60 | .join("."); // a.example.com => example.com
61 | var _aid, _a, _url;
62 | function $(id) {
63 | return document.getElementById(id);
64 | }
65 | function $c(className) {
66 | return document.getElementsByClassName(className);
67 | }
68 | function $t(tag) {
69 | return document.getElementsByTagName(tag);
70 | }
71 | function $a(mask) {
72 | var links = document.links;
73 | for(var i = 0, len = links.length; i < len; ++i) {
74 | var url = links[i].href;
75 | if(url && mask.test(url))
76 | return url;
77 | }
78 | return null;
79 | }
80 | hostLoop:
81 | switch(host) {
82 | // Get link by id:
83 | // URL-based redirect:
84 | // Get link by href:
85 | case "systemexplorer.net":
86 | _url = $a(/^https?:\/\/(\w+\.)*systemexplorer\.net\/download\/[^?]+\/SystemExplorer[\w.-]*\.(?:exe|zip|7z)$/);
87 | break;
88 | // Other:
89 | case "sourceforge.net":
90 | _a = $c("direct-download")[0];
91 | }
92 |
93 | if(_aid)
94 | _a = $(_aid);
95 | if(_a && _a.href && _a.offsetWidth && _a.offsetHeight) //~ todo: fails sometimes on DOMContentLoaded
96 | _url = _a.href;
97 | if(_url && _url != loc) {
98 | if(typeof GM_log == "function") {
99 | GM_log("Redirect (" + (event ? event.type : "delay") + "):\n" + loc + "\n=> " + _url);
100 | // For Close Download Tabs extension
101 | // https://github.com/Infocatcher/Close_Download_Tabs
102 | GM_log("[Close Download Tabs] Mark URI as empty:\n" + loc);
103 | }
104 |
105 | window.stop();
106 | if(allowBack)
107 | location.href = _url;
108 | else
109 | location.replace(_url);
110 | destroy();
111 | }
112 | else if(document.readyState == "loading") {
113 | if(!("_count" in dl)) {
114 | dl._count = 0;
115 | // With disabled scripts setTimeout doesn't works
116 | window.addEventListener("DOMContentLoaded", dl, false);
117 | window.addEventListener("load", dl, false);
118 | }
119 | if(++dl._count < 5*60*1000/10)
120 | dl._timer = setTimeout(dl, 10);
121 | }
122 | else if(event && event.type == "load")
123 | destroy();
124 | function getPref(name, defaultVal) {
125 | if(typeof GM_getValue != "function")
126 | return defaultVal;
127 | var v = GM_getValue(name, undefined);
128 | if(v == undefined) {
129 | GM_setValue(name, defaultVal);
130 | return defaultVal;
131 | }
132 | return v;
133 | }
134 | function destroy() {
135 | dl._timer && clearTimeout(dl._timer);
136 | window.removeEventListener("DOMContentLoaded", dl, false);
137 | window.removeEventListener("load", dl, false);
138 | }
139 | })();
--------------------------------------------------------------------------------
/Dirty.ru_List_of_Best/README.md:
--------------------------------------------------------------------------------
1 | Show list with high rated comments on http://d3.ru/ (ex http://dirty.ru/)
--------------------------------------------------------------------------------
/Dirty.ru_List_of_Best/dirty.ru_list_of_best.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Dirty.ru List of Best
3 | // @version 0.1.4pre4 - 2015-07-18
4 | // @namespace dev/null
5 | // @include https://*.d3.ru/*
6 | // @include https://d3.ru/*/*
7 | // @exclude https://d3.ru/pages/*
8 | // @include https://*.dirty.ru/*
9 | // @include https://dirty.ru/*/*
10 | // @exclude https://dirty.ru/pages/*
11 | // @include about:blank?UserScripts/options/Dirty.ru_List_of_Best
12 | // @grant GM_getValue
13 | // @grant GM_setValue
14 | // @grant GM_registerMenuCommand
15 | // @grant GM_openInTab
16 | // ==/UserScript==
17 |
18 | (function() {
19 | // You can change
20 | // greasemonkey.scriptvals.dev/null/Dirty.ru List of Best.*
21 | // in about:config
22 |
23 | if(
24 | location.href == "about:blank?UserScripts/options/Dirty.ru_List_of_Best"
25 | && typeof GM_getValue == "function"
26 | ) {
27 | document.title = "Dirty.ru List of Best - Options";
28 | var body = document.body || document.documentElement;
29 | var numPref = function(text, pref) {
30 | var row = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
31 | var input = document.createElementNS("http://www.w3.org/1999/xhtml", "input");
32 | input.type = "number";
33 | //input.setAttribute("size", "4");
34 | input.style.width = "4.5em";
35 | input.value = input._savedPref = getPref(pref, 0);
36 | input._prefName = pref;
37 | input.addEventListener("keydown", saveItem, false);
38 | input.addEventListener("click", saveItem, false);
39 | row.appendChild(document.createTextNode(text));
40 | row.appendChild(input);
41 | body.appendChild(row);
42 | };
43 | var saveItem = function(e) {
44 | var input = e.currentTarget;
45 | setTimeout(function() {
46 | var val = input.value;
47 | if(input._savedPref != val) {
48 | input._savedPref = val;
49 | GM_setValue(input._prefName, +val);
50 | }
51 | }, 0);
52 | };
53 | numPref("Rating threshold: ", "limit");
54 | numPref("Highlight threshold #1: ", "highlight");
55 | numPref("Highlight threshold #2: ", "highlight2");
56 | numPref("Height: ", "show");
57 |
58 | window.addEventListener("unload", function destroy(e) {
59 | window.removeEventListener("unload", destroy, false);
60 | Array.prototype.forEach.call(
61 | document.getElementsByTagName("input"),
62 | function(input) {
63 | input.removeEventListener("keydown", saveItem, false);
64 | input.removeEventListener("click", saveItem, false);
65 | }
66 | );
67 | }, false);
68 | return;
69 | }
70 |
71 | if(
72 | typeof GM_registerMenuCommand == "function"
73 | && typeof GM_openInTab == "function"
74 | ) {
75 | GM_registerMenuCommand("Dirty.ru List of Best - Options", function() {
76 | GM_openInTab("about:blank?UserScripts/options/Dirty.ru_List_of_Best", false);
77 | });
78 | }
79 |
80 | var prefsVersion = 1;
81 | var v = getPref("prefsVersion", 0);
82 | var forceDefault = v == 0;
83 | var limit = getPref("limit", 20, forceDefault);
84 | var highlight = getPref("highlight", 40, forceDefault);
85 | var highlight2 = getPref("highlight2", 65, forceDefault);
86 | var show = getPref("show", 25, forceDefault);
87 | if(v != prefsVersion)
88 | setPref("prefsVersion", prefsVersion);
89 |
90 | var best = [];
91 | Array.prototype.forEach.call(
92 | document.getElementsByClassName("vote_result"),
93 | function(e, i) {
94 | if((e.parentNode.id || "").indexOf("post_id") != -1) // Post votes
95 | return;
96 | var n = e.textContent.trim();
97 | if(n < limit)
98 | return;
99 | var id = /'(\d+)'/.test(e.getAttribute("onclick")) && RegExp.$1;
100 | var title = "";
101 | for(var node = e.parentNode; node; node = node.parentNode) {
102 | if(/(?:^|\s)comment_inner(?:\s|$)/.test(node.className)) {
103 | var comment = node.getElementsByClassName("c_body")[0];
104 | if(comment) {
105 | // comment.textContent doesn't contain new lines
106 | var temp = document.createElement("div");
107 | temp.style.whiteSpace = "pre";
108 | temp.innerHTML = comment.innerHTML
109 | .replace(/\s+/g, " ")
110 | .replace(/
/g, "\n");
111 | var imgs = temp.getElementsByTagName("img");
112 | for(var j = imgs.length - 1; j >= 0; --j) {
113 | var img = imgs[j];
114 | img.parentNode.replaceChild(document.createTextNode(""), img);
115 | }
116 | title = ' title="'
117 | + temp.textContent.trimLeft()
118 | .replace(/&/g, "&")
119 | .replace(//g, ">")
121 | .replace(/"/g, """)
122 | + '"';
123 | }
124 | break;
125 | }
126 | }
127 | var clss = "__userJs__bestListAnchor";
128 | if(n >= highlight)
129 | clss += " __userJs__bestListHL";
130 | if(n >= highlight2)
131 | clss += " __userJs__bestListHL2";
132 | best.push(
133 | '