您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Speed up process sending skype credit: removed animation and remembering settings for each person.
当前为
// ==UserScript== // @name Send Skype Credit+ // @namespace V@no // @author V@no // @description Speed up process sending skype credit: removed animation and remembering settings for each person. // @include https://secure.skype.com/send-credit // @version 1.1.3 // @license MIT // @grant none // ==/UserScript== let log = console.log.bind(console), listDefault = [2, 1], list = {}, prevId, scope = this, func = loop1, fieldFocused = false, noAuto = false; o = {}; function $$(o) { return document.getElementById(o); } function ls(id, data, stringify) { let r; if (typeof(data) == "undefined") { r = localStorage.getItem(id); try { r = JSON.parse(r); } catch(e) { log(e); log([id, data, r]); } return r; } if (typeof(stringify) == "undefined" || stringify) data = JSON.stringify(data); r = localStorage.setItem(id, data); return r; } function rand(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function load() { let l = ls("last"), r = listDefault.clone(); if (!l || typeof(l) != "object") l = {}; if (!l.n) l.n = ""; if (!l[l.n]) l[l.n] = r; for (let m in l) { if (m == "n") continue; let d = l[m]; if (Array.isArray(d)) { for(let i = 0; i < r.length; i++) { if (typeof(d[i]) == typeof(r[i])) r[i] = d[i]; } l[m] = d; } else l[m] = r; } return l; } function save() { ls("last", list); } function getId(o) { if (!o) return; if(!o.id || !o.id.match("contactListId-")) return getId(o.parentNode); return o.id.replace("contactListId-", ""); } function findChild(obj, parent) { if (!obj || !parent || obj == parent) return null; if (obj.parentNode == parent) return obj; return findChild(obj.parentNode, parent); } !function init() { Object.defineProperty(Object.prototype, "clone", { value: function() { return Object.assign({}, this); } }); Object.defineProperty(Array.prototype, "clone", { value: function() { return Object.assign([], this); } }); if ($ && $.fn) { $.fn.animate = function(){}; } list = load(); return true; }() //input username function loop1() { let obj = $$("quickFilterInput"), oe = $$("searchOptions"), ih = document.querySelector("div.input-holder"), f = arguments.callee, n = f.name; function c() { if (fieldFocused) return; let f,i = 2; while(typeof(f=scope["loop"+i++]) == "function") { f(); } prevId = list.n; } if (oe && !oe._inited) { oe.addEventListener("mousedown", function(e) { if (!e.isTrusted) return; let id = getId(e.target); if (!id) return; list.n = id; if (!list[id]) list[id] = listDefault.clone(); delete list[""]; save(); prevId = null; func = f; fieldFocused = false; }, true); oe._inited = true; } if (ih && !ih._inited) { ih.addEventListener("click", function(e) { if (!e.isTrusted) return; fieldFocused = true; func = f; }, true); ih._inited = true; } if (obj && !obj._inited) { obj.addEventListener("focus", function(e) { if (!e.isTrusted) return; fieldFocused = true; }, true); obj.addEventListener("blur", function(e) { if (!e.isTrusted) return; fieldFocused = false; }, true); obj.addEventListener("input", function(e) { noAuto = true; fieldFocused = true; // list.n = null;//obj.value; if (!e.isTrusted) return; }, true); // if (obj.value == "" && !o[f.name]) if (obj.value == "") { obj.value = list.n; obj.dispatchEvent(new KeyboardEvent('keydown',{'key':'Shift'})); noAuto = false; fieldFocused = false; } obj._inited = true; o[f.name] = obj; } c(); } //pick user from list function loop2() { let f = arguments.callee, obj = $$("contactListId-" + list.n); if (!obj) return; o[f.name] = obj; if (list[list.n]) { if (!noAuto) obj.dispatchEvent(new MouseEvent('mousedown',{'button':0})); } } //select amount function loop3() { let f = arguments.callee, obj = $$("offer-selection"); if (!obj) return; if (!obj._inited) { if (list[list.n][0] < 0 || list[list.n][0] > obj.children.length - 1) list[list.n][0] = obj.children.length - 1; //log(list[list.n]); fieldFocused = false; obj.children[list[list.n][0]].click(); obj.addEventListener("click", function(e) { if (!e.isTrusted) return; fieldFocused = false; let c = findChild(e.target, obj), i = -1; if (c === null) return; while(obj.children[++i] != c); list[list.n][0] = i; save(); }, true); obj._inited = true; } o[f.name] = obj; } //select design function loop4() { let f = arguments.callee, obj = document.querySelector(".form-area.gift-card-holder"); if (!obj) return; if (!obj._inited) { let cb = document.createElement("input"), box = document.createElement("label"), r, //previous random index p = { get s () { return list[list.n]; }, get m () { return obj.children.length - 1; }, get i() { return Math.min(this.m, Math.max((this.s[1] >> 1) - 1, 0)); }, set i(d) { this.s[1] = (this.s[1] & 1) | (++d << 1); }, get r() { return this.s[1] & 1 ? true : false; }, set r(d) { if (d) this.s[1] |= 1; else this.s[1] &= ~1; } }; function sel(s) { //s = true: don't all current index get selected again let i = p.i; if (cb.checked) { let n = i; if (!s) n = r; while((i = rand(0, p.m)) == n || i == r); r = i; // i = rand(0, p.m); } fieldFocused = false; obj.children[i].click(); func = null; } cb.type = "checkbox"; cb.checked = p.r; cb.addEventListener("change", function(e) { p.r = cb.checked; sel(); }, false); sel(); box.appendChild(cb); box.appendChild(document.createTextNode("Random")); obj.parentNode.insertBefore(box, obj); obj.addEventListener("click", function(e) { fieldFocused = false; if (!e.isTrusted && cb.checked) { p.r = true; } else { let c = findChild(e.target, obj), i = -1; if (c === null) return; while(obj.children[++i] != c); p.i = i; p.r = cb.checked = false; } save(); }, true); obj._inited = true; } o[f.name] = obj; } //click confirm function loop5() { let f = arguments.callee, obj = $$("send-money"); if (!obj) return; if (!obj._inited || prevId != list.n) { setTimeout(function() { obj.scrollIntoView(false); func = null; }, 500); obj._inited = true; } o[f.name] = obj; // obj.click(); } //css let css = document.createElement("style"); css.innerHTML = ` .offer-item { height: unset; padding-top: 5px; padding-bottom: 5px; } .gift-card-span { max-width: 22%; left: unset !important; right: unset !important; margin-top: unset; } .offers-footer, .content-wrapper, #amount-selector > div.row { padding: 10px; } .gift-card-holder { margin-top: 0.2em; } #design-selector > h3 { display: inline-block; } #design-selector > label { float: right; line-height: initial; margin: 0; padding: 0; color: initial; font-weight: initial; width: initial; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } #design-selector > label, #design-selector > label > input { cursor: pointer; } `; document.head.appendChild(css); //main loop !function loop() { //log(func && func.name); if (func) { func(); } setTimeout(loop, rand(0, 1000)); }();