// ==UserScript== // @author Zaso // @name Layers Profiles // @category Controls // @version 0.1.4 // @description Saves the current enabled layers (base, overlays and hightlighter). Restore it just a click. // @id layers-profiles@Zaso // @namespace https://github.com/IITC-CE/ingress-intel-total-conversion // @updateURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/Zaso/layers-profiles.meta.js // @downloadURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/Zaso/layers-profiles.user.js // @match https://intel.ingress.com/* // @match https://intel-x.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 AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!! //(leaving them in place might break the 'About IITC' page or break update checks) plugin_info.buildName = 'ZasoItems'; plugin_info.dateTimeVersion = '2022-12-18-193146'; plugin_info.pluginId = 'layers-profiles'; //END PLUGIN AUTHORS NOTE // PLUGIN START //////////////////////////////////////////////////////// // History // 0.1.4 fix Highlighters // 0.1.3 fix Maps and Ornaments // 0.1.2 headers chnaged. Ready for IITC-CE // 0.1.1 Original script // use own namespace for plugin window.plugin.layersProfiles = function(){}; window.plugin.layersProfiles.storage = {}; window.plugin.layersProfiles.ui = {}; window.plugin.layersProfiles.dialog = {}; window.plugin.layersProfiles.data = {}; window.plugin.layersProfiles.util = {}; window.plugin.layersProfiles.action = {}; window.plugin.layersProfiles.layer = {}; window.plugin.layersProfiles.obj = {}; window.plugin.layersProfiles.obj.allLay = {b:{}, h:{}, o:{}}; window.plugin.layersProfiles.obj.currLay = {b:{}, h:{}, o:{}}; window.plugin.layersProfiles.obj.main = { settings:{b:false, h:false, o:true}, profiles:{} }; //---------------------------------------------------------------------------------- // UTIL FUNCTIONS //---------------------------------------------------------------------------------- window.plugin.layersProfiles.util.generateID = function(){ return 'uuid-'+((new Date).getTime().toString(16)+Math.floor(1E7*Math.random()).toString(16)); } window.plugin.layersProfiles.util.validateName = function(name){ var name = name.toString(); var pattern = new RegExp(/^[a-zA-Z0-9_\-\ \(\)\[\]]/); for(i=0; i'; html += 'X'; html += ''+elem.label+''; html += 'i'; html += ''; return html; } window.plugin.layersProfiles.ui.appendConfig = function(ID){ var html = window.plugin.layersProfiles.ui.htmlConfig(ID); $('#layersProfiles .configList').append(html); } window.plugin.layersProfiles.ui.deleteConfig = function(ID){ $('#layersProfiles .configList .configLay[data-layer = "'+ID+'"]').remove() } window.plugin.layersProfiles.ui.setRedConfigStyle = function(ID){ $('#layersProfiles .configList .configLay[data-layer = "'+ID+'"] a.info').addClass('red'); } //---------------------------------------------------------------------------------- // DIALOG FUNCTIONS //---------------------------------------------------------------------------------- window.plugin.layersProfiles.dialog.openMain = function(){ window.plugin.layersProfiles.layer.getAll(); var html = ''; var isCheckedB = ''; var isCheckedH = ''; var isCheckedO = ''; if(window.plugin.layersProfiles.obj.main.settings.b === true){ isCheckedB = 'checked'; } if(window.plugin.layersProfiles.obj.main.settings.h === true){ isCheckedH = 'checked'; } if(window.plugin.layersProfiles.obj.main.settings.o === true){ isCheckedO = 'checked'; } html += '
'; html += ''; html += ''; html += ''; html += ''; html += '
'; html += '
'; html += '
'; var list = '

Not saved Layers Config.

'; for(ID in window.plugin.layersProfiles.obj.main.profiles){ list = ''; html += window.plugin.layersProfiles.ui.htmlConfig(ID); } html += list; html += '
'; dialog({ title: 'Layers Profiles', html: '
'+html+'
', dialogClass: 'ui-dialog-layerprofiles-main', minWidth: 300, }); } window.plugin.layersProfiles.dialog.chooseNewLabel = function(){ var promptAction = prompt('Choose a label.\nNB: you can use only a-z, A-Z, 0-9, "() []" and " "', ''); if(promptAction !== null && promptAction !== ''){ return promptAction; }else{ window.plugin.layersProfiles.dialog.message('Failed. Choose a Name.'); return false; } } window.plugin.layersProfiles.dialog.info = function(ID){ var elem = window.plugin.layersProfiles.obj.main.profiles[ID]; var txt = window.plugin.layersProfiles.scanConfig(ID); dialog({ title: 'Layers Config - '+elem.label, html: txt, dialogClass: 'ui-dialog-layerprofiles-config', minWidth: 300, }); } window.plugin.layersProfiles.dialog.message = function(txt){ dialog({ title: 'Layers Profiles - Message', html: txt, dialogClass: 'ui-dialog-layerprofiles-msg', // minWidth: 300, }); } //---------------------------------------------------------------------------------- // CSS AND CONTROL //---------------------------------------------------------------------------------- window.plugin.layersProfiles.ui.setupCSS = function(){ $('