Last active
March 12, 2023 17:36
-
-
Save johnd0e/5ba9bb470ed7f0e26cf35802d79269b9 to your computer and use it in GitHub Desktop.
IITC plugin: Javascript console for mobile devices [https://gist.github.com/johnd0e/5ba9bb470ed7f0e26cf35802d79269b9/raw/debug-hnl-mobileConsole.user.js]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id iitc-plugin-debug-hnl-mobileConsole | |
// @name IITC plugin: hnl.mobileConsole | |
// @description Javascript console for mobile devices: http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/ | |
// @category Debug | |
// @version 0.3 | |
// @author jd | |
// @namespace https://gist.github.com/johnd0e | |
// @homepageURL https://gist.github.com/johnd0e/5ba9bb470ed7f0e26cf35802d79269b9 | |
// @supportURL https://gist.github.com/johnd0e/5ba9bb470ed7f0e26cf35802d79269b9#new_comment_field | |
// @downloadURL https://gist.github.com/johnd0e/5ba9bb470ed7f0e26cf35802d79269b9/raw/debug-hnl-mobileConsole.user.js | |
// @match https://intel.ingress.com/* | |
// @grant none | |
// ==/UserScript== | |
function wrapper(plugin_info) { | |
// ensure plugin framework is there, even if iitc is not yet loaded | |
if(typeof window.plugin !== 'function') window.plugin = function() {}; | |
// PLUGIN START //////////////////////////////////////////////////////// | |
// https://code.hnldesign.nl/demo/hnl.MobileConsole.v2.html | |
// https://code.hnldesign.nl/mobile-console/hnl.mobileconsole.js | |
// https://github.com/c-kick/mobileConsole | |
let link | |
function mConsole_load () { | |
let script = document.createElement('script'); | |
script.src='https://code.hnldesign.nl/mobile-console/hnl.mobileconsole.js'; | |
document.body.appendChild(script); | |
script.onload = function () { | |
mobileConsole.init(); | |
$(document.body).on('taphold','div.mobileConsole_base > div.mobileConsole_topbar',function() { | |
$(this).parent().css('display','none'); | |
}); | |
link.off(); | |
link.click(function(){ | |
const el = $('div.mobileConsole_base'); | |
el.css('display',el.css('display')==='block' ? 'none' : 'block'); | |
}); | |
}; | |
} | |
function setup () { | |
link = $('<a title="Javascript console for mobile devices">mobileConsole</a>') | |
.appendTo($('#toolbox')) | |
.click(mConsole_load); | |
} | |
// PLUGIN END ////////////////////////////////////////////////////////// | |
setup.info = plugin_info; //add the script info data to the function as a property | |
if(!window.bootPlugins) window.bootPlugins = []; | |
window.bootPlugins.push(setup); | |
// if IITC has already booted, immediately run the 'setup' function | |
if(window.iitcLoaded && typeof setup === 'function') setup(); | |
} // wrapper end | |
// inject code into site context | |
var script = document.createElement('script'); | |
var info = {}; | |
if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; | |
script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');')); | |
(document.body || document.head || document.documentElement).appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment