// ==UserScript== // @id portals-gallery@nerotu // @name IITC plugin: Portals Gallery // @description Creates the gallery of portals that can be used to solve the First Saturday passcode. // @author Kofirs2634 aka Nerotu // @category Info // @version 1.2.1 // @match https://intel.ingress.com/* // @match https://intel-x.ingress.com/* // @grant none // @downloadURL https://github.com/Kofirs2634/IITC-Portals-Gallery/raw/main/portals_gallery_script.js // @updateURL https://github.com/Kofirs2634/IITC-Portals-Gallery/raw/main/portals_gallery_script.js // ==/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 //////////////////////////////////////////////////////// // use own namespace for plugin window.plugin.portalsGallery = () => {}; window.plugin.portalsGallery.storage = []; window.plugin.portalsGallery.sortmode = 't'; window.plugin.portalsGallery.imagesPerRow = 3; /** * Collects the data of rendered portals * @public */ window.plugin.portalsGallery.collect = () => { var self = window.plugin.portalsGallery; self.storage = []; for (var i in window.portals) { var path = portals[i].options.data; if (path.title && path.image) self.storage.push({ n: path.title, p: { lt: path.latE6 / 1e6, ln: path.lngE6 / 1e6 }, u: path.image, g: portals[i].options.guid }) } } /** * Opens the gallery dialog box * @public */ window.plugin.portalsGallery.open = () => { var self = window.plugin.portalsGallery; if ('iitc_gallery_row_length' in localStorage) { let rowLength = localStorage['iitc_gallery_row_length'] if (rowLength === undefined || rowLength === 'undefined' || rowLength === null || rowLength === "null" || rowLength === ""){ rowLength = 3; localStorage['iitc_gallery_row_length'] = rowLength; } window.plugin.portalsGallery.imagesPerRow = localStorage['iitc_gallery_row_length']; } else { console.log("not found in local storage") localStorage['iitc_gallery_row_length'] = window.plugin.portalsGallery.imagesPerRow; } self.collect(); const width = (self.imagesPerRow * 250) + 150; dialog({ html: '', title: 'Portals Gallery', dialogClass: 'gallery-dialog', width: width, position: { my: 'left top', at: 'left+50 top+50'} }); $('#gallery-cnt') .append($('
', { id: 'gallery-cnt-div', class: 'controls' }) .append($('