您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Embeds images which Discourse refuses to embed
当前为
// ==UserScript== // @name WaniKani Forums: Large Image Embedder // @namespace http://tampermonkey.net/ // @version 0.1.0 // @description Embeds images which Discourse refuses to embed // @author Kumirei // @include https://community.wanikani.com* // @require https://greatest.deepsurf.us/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012 // @grant none // ==/UserScript== (function() { 'use strict'; embedImages(); setTriggers(); var i = 0; window.onscroll = function() { if (i % 50 == 0) { embedImages(); } i++; }; })(); function embedImages() { $('.large-image-placeholder a').each(function() { console.log('swoooch'); var url = $(this).attr('href'); if (url.endsWith('giphy.gif')) { url = url.split('giphy.gif')[0] + '200w_d.gif'; } var img = document.createElement('img'); img.src = url; var elem = $(this.closest('.large-image-placeholder')); elem.empty(); elem.append(img); //$(this.closest('.large-image-placeholder')).attr('class', 'LIEimage'); }); } function initialiseScript() { waitForKeyElements(".topic-post article", function(){embedImages();}); } function setTriggers() { window.addEventListener('load', function(){initialiseScript();console.log('load');}); window.addEventListener('popstate', function(){initialiseScript();console.log('pop');}); (function(history){ var pushState = history.pushState; history.pushState = function(state) { console.log('push'); initialiseScript(); return pushState.apply(history, arguments); }; })(window.history); }