|
Скрипт против картинок Maximusa
Для Chrome - Tempermonkey
// ==UserScript==
// @name javascript.ru
// @namespace http://javascript.ru/
// @version 0.3
// @description enter something useful
// @match http://*javascript.ru/*
// @copyright 2012+, You
// ==/UserScript==
var on = 'addEventListener', off = 'removeEventListener',
q = function (s, e) { var q, d = document, e = e || d, a = [], f, i; if (!s) { return d };
if (typeof e == 'function') { f = e; e = d; } q = e.querySelectorAll(s);
for (i=0; i < q.length; i++) { if(f) { q[i] = f(q[i]); if(q[i]) {a.push(q[i])}} else {a.push(q[i])}} return a};
q('table td.alt1 div:first-child img', function (el) {
el.style.maxWidth = '100px';
el.style.maxHeight = '100px';
el.addEventListener('click', function (e) {
if (this.style.maxWidth == '100px') {
this.style.maxHeight = '100%';
this.style.maxWidth = '100%';
this.style.width = '600px';
}
else {
this.style.maxWidth = '100px';
this.style.maxHeight = '100px';
}
}, false);
});
Для Firefox - Gracemonkey
// ==UserScript==
// @name javascript.ru
// @namespace javascript.ru
// @include http://*javascript.ru/*
// @version 0.1
// @grant none
// ==/UserScript==
var on = 'addEventListener', off = 'removeEventListener',
q = function (s, e) { var q, d = document, e = e || d, a = [], f, i; if (!s) { return d };
if (typeof e == 'function') { f = e; e = d; } q = e.querySelectorAll(s);
for (i=0; i < q.length; i++) { if(f) { q[i] = f(q[i]); if(q[i]) {a.push(q[i])}} else {a.push(q[i])}} return a};
q('table td.alt1 div:first-child img', function (el) {
el.style.maxWidth = '100px';
el.style.maxHeight = '100px';
el.addEventListener('click', function (e) {
if (this.style.maxWidth == '100px') {
this.style.maxHeight = '100%';
this.style.maxWidth = '100%';
this.style.width = '600px';
}
else {
this.style.maxWidth = '100px';
this.style.maxHeight = '100px';
}
}, false);
});
https://github.com/seolog/corn.js |
Если убрать if (node && node.innerHTML.search(/maxi/) != -1) { то все картинки будут уменьшаться.
|
запили как расширение что ли, а еще можно просто добавить его в игнор и не будешь видить его сообщений.
|
Цитата:
https://chrome.google.com/webstore/d...mpobfkfo?hl=ru Просто вставь вышеприведенный код. |
![]() |
Maxmaxmaximus6,
у меня уже подключен скрипт и я не вижу что ты там запилил. Какой же это кайф :) |
Gozar, не, спс, закину код в расширение)
|
Gozar, у меня не работает почему то, это расширение не выполняет скрипты на странице, в настойках дал доступ к ссылкам и прописал путь, это все что бы в faq, подключил
// ==UserScript== // @name javascript.ru // @namespace javascript.ru // @include [url]http://*javascript.ru/*[/url] // @version 1 // @grant none // ==/UserScript== |
// ==UserScript==
// @name javascript.ru
// @namespace javascript.ru
// @include http://*javascript.ru/*
// @version 2
// @grant none
// ==/UserScript==
var on = 'addEventListener', off = 'removeEventListener',
q = function (s, e) { var q, d = document, e = e || d, a = [], f, i; if (!s) { return d };
if (typeof e == 'function') { f = e; e = d; } q = e.querySelectorAll(s);
for (i of q) { if(f) { i = f(i); if(i) {a.push(i)}} else {a.push(i)}} return a};
q('table td.alt1 div:first-child img').forEach(function (el) {
el.style.maxWidth = '100px';
el.style.maxHeight = '100px';
el.addEventListener('click', function (e) {
if (this.style.maxWidth == '100px') {
this.style.maxHeight = '100%';
this.style.maxWidth = '100%';
this.style.width = '600px';
}
else {
this.style.maxWidth = '100px';
this.style.maxHeight = '100px';
}
}, false);
});
Новая версия. Работает с любыми картинками, а то вдруг он ник сменит. По клику увеличивает картинку. |
Gozar, короче заработало, только твой код ошибку выкидует.
|
| Часовой пояс GMT +3, время: 09:09. |
|