// ==UserScript== // @name 灰机汉化 滚动浏览 // @namespace http://weibo.com/unluckyninja // @version 1.0 // @description 显示模式切换按钮,点击后可切换cocos2d播放器为纯图片浏览 // @author UnluckyNinja // @include http://smp*.yoedge.com/smp-app/* // @require https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349 // @require https://code.jquery.com/jquery-3.2.1.min.js // @require https://cdn.jsdelivr.net/gh/eisbehr-/jquery.lazy@1.7.6/jquery.lazy.min.js // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here... var button = '
'; GM_addStyle("input[type=number]::-webkit-inner-spin-button, " + "input[type=number]::-webkit-outer-spin-button { " + " -webkit-appearance: none; " + "}"); function buildImages(){ var width = GM_getValue('imageWidth', 1080); var htmlList = ''; var htmlImage = ''+(i+1)+'
'); } list.insertAfter('#Cocos2dGameContainer'); $(function() { $('.lazy').Lazy(); }); } // 准备按钮 var showButton = function(){ var target = $('div#toolbar'); if(!target.length){ return; } $(button).appendTo(target); $('#enable-scrolling').click(function(){ if(!$('#image-list').length){ buildImages(); } $('#gameCanvas').toggle(); $('#image-list').toggle(); }); // 显示宽度输入框 $('#image-width-drop').click(function(){ $('#width-setting').show(); $('#image-width').attr('placeholder',GM_getValue('imageWidth', 1080)).focus(); }); // 失去焦点时自动切换宽度 保存数值 $('#image-width').blur(function(){ $('#width-setting').hide(); var value = $('#image-width').val(); if(!value){ return; } value = Math.min(Math.max(parseInt(value), 480), 4096); $('#image-list img').css('width', value); GM_setValue('imageWidth', value); $('#image-width').val(''); }); }; waitForKeyElements ("div#normal-button", showButton); })();