// ==UserScript== // @author DanielOnDiordna // @name Player Tracker add-on // @category Addon // @version 1.3.1.20240209.233200 // @updateURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/DanielOnDiordna/player-tracker-addon.meta.js // @downloadURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/DanielOnDiordna/player-tracker-addon.user.js // @description [danielondiordna-1.3.1.20240209.233200] Add-on to the player tracker plugin: Adjust history limit of 3 hours to another value. Toggle name labels, last action time, toggle/adjust player colors, focus on players, display 1 single player. Integrated Marker Label plugin and Spectrum Colorpicker 1.8.1 plugin. Supports Machina U̶͚̓̍N̴̖̈K̠͔̍͑̂͜N̞̥͋̀̉Ȯ̶̹͕̀W̶̢͚͑̚͝Ṉ̨̟̒̅' player. // @id player-tracker-addon@DanielOnDiordna // @namespace https://softspot.nl/ingress/ // @depends player-activity-tracker@breunigs // @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() {}; // use own namespace for plugin window.plugin.playerTrackerAddon = function() {}; var self = window.plugin.playerTrackerAddon; self.id = 'playerTrackerAddon'; self.title = 'Player Tracker add-on'; self.version = '1.3.1.20240209.233200'; self.author = 'DanielOnDiordna'; self.changelog = ` Changelog: version 1.3.1.20240209.233200 - minor fix to display player nickname on the labels (fix for Player Tracker version 0.12.3.20240201.073623 IITC-CE 0.37.1 beta) version 1.3.0.20230514.005600 - added Machina U̶͚̓̍N̴̖̈K̠͔̍͑̂͜N̞̥͋̀̉Ȯ̶̹͕̀W̶̢͚͑̚͝Ṉ̨̟̒̅' icons, player tracker layer and colors - reversed the changelog order to show last changes at the top version 1.2.0.20220319.231800 - added new option to hide the "on your portal" actions, which can interfere when viewing remote locations version 1.0.2.20211011.231300 - added new option to hide the date from the label if it is today, if show date+time is set - properly replaced the playerTracker publicChatDataAvailable handleData hook - fixed a console warning about a missing color during updateplayerlist when the menu is not visible - reformatted the settings menu version 1.0.1.20210724.002500 - prevent double plugin setup on hook iitcLoaded version 1.0.1.20210421.190200 - minor fix for IITC CE where runHooks iitcLoaded is executed before addHook is defined in this plugin version 1.0.1.20210328.000100 - added click event to player tracker icons while name labels are enabled to show history - changed default settings values version 1.0.0.20210119.225600 - changed description header version 1.0.0.20210119.201900 - integrated marker label plugin code, no need anymore for the separate plugin - integrated Spectrum Colorpicker 1.8.1 plugin code, no need anymore for the separate plugin - updated plugin wrapper and userscript header formatting to match IITC-CE coding version 0.0.13.20200131.220500 - problem solved, added better processNewData fix version 0.0.12.20200130.172600 - problem solved, added processNewData fix version 0.0.3.20200130.160000 version 0.0.4.20200130.160000 version 0.0.5.20200130.160000 version 0.0.6.20200130.160000 version 0.0.7.20200130.160000 version 0.0.8.20200130.160000 version 0.0.9.20200130.160000 version 0.0.10.20200130.160000 version 0.0.11.20200130.160000 - debugging for IITC CE purposes version 0.0.2.20190915.135600 - fix for ago display for iOS users - modified defaults for new users: show labels, apply random colors - changed menu order and modified some menu labels to make it more clear version 0.0.1.20181018.104200 - added plugin version on menu - added option list to set maximum events to display (default 10) - added choice to display date and time instead of default 'ago' version 0.0.1.20181030.212900 - intel URL changed from www.ingress.com to *.ingress.com `; self.namespace = 'window.plugin.' + self.id + '.'; self.pluginname = 'plugin-' + self.id; self.localstoragesettings = 'plugin-' + self.id + '-settings'; self.settings = { limit: 3, showlabels: true, applyrandomcolors: true, showcenter: false, showlastaction: true, maxdisplayevents: 10, showdatetime: true, hidedatetoday: false, hideonyourportalactions: false }; self.displayselectedplayer = false; self.selectedplayer = ''; self.drawData_backup = ''; self.ago_backup = ''; self.restoresettings = function() { if (typeof localStorage[self.localstoragesettings] != 'string' || localStorage[self.localstoragesettings] == '') return; function isObject(element) { return (typeof element == 'object' && element instanceof Object && !(element instanceof Array)); } function parseSettings(source,target) { if (!isObject(source) || !isObject(target)) return; for (const key in target) { if (key in source) { if (isObject(target[key])) { parseSettings(source[key],target[key]); } else if (typeof source[key] == typeof target[key]) { // only accept settings from default settings template of same type target[key] = source[key]; } } } } try { let settings = JSON.parse(localStorage[self.localstoragesettings]); parseSettings(settings,self.settings); // convert old settings here if needed let storechanges = false; if (localStorage['plugin-playerTrackerOverride-limit']) { self.settings.limit = parseFloat(localStorage['plugin-playerTrackerOverride-limit']); delete(localStorage['plugin-playerTrackerOverride-limit']); storechanges = true; } if (localStorage['plugin-playerTrackerOverride-showlabels']) { self.settings.showlabels = localStorage['plugin-playerTrackerOverride-showlabels'] === '1'; delete(localStorage['plugin-playerTrackerOverride-showlabels']); storechanges = true; } if (localStorage['plugin-playerTrackerOverride-color']) { self.settings.applyrandomcolors = localStorage['plugin-playerTrackerOverride-color'] === '1'; delete(localStorage['plugin-playerTrackerOverride-color']); storechanges = true; } if (!self.settings.limit) { // set a default if missing or zero self.settings.limit = window.PLAYER_TRACKER_MAX_TIME / (60*60*1000); storechanges = true; } if (storechanges) { self.storesettings(); } } catch(e) { return false; } }; self.storesettings = function() { localStorage[self.localstoragesettings] = JSON.stringify(self.settings); }; self.setlimit = function(hours) { hours = parseFloat(hours); self.settings.limit = hours; self.storesettings(); window.PLAYER_TRACKER_MAX_TIME = hours * 60*60*1000; window.plugin.playerTracker.handleData(); // call to processNewData requires data, this is fixed by rewriting that function elsewhere }; self.setmaxdisplayevents = function(max) { max = parseInt(max); self.settings.maxdisplayevents = max; self.storesettings(); self.resettracks(); }; self.makeoptionshtml = function(options,selection) { var optionslist = []; if (typeof selection !== 'string') selection = selection.toString(); if (options instanceof Array) { var cnt; for (cnt = 0; cnt < options.length; cnt++) { if (typeof options[cnt] !== 'string') options[cnt] = options[cnt].toString(); optionslist.push('' + options[cnt].replace(/&/g, "&").replace(/>/g, ">").replace(/'); } } else if (options instanceof Object) { var key; for (key of Object.keys(options).sort(function(a, b) {return -(options[b] - options[a])})) { if (typeof options[key] !== 'string') options[key] = options[key].toString(); optionslist.push(''); if (plrname === selectedname) selectednamefound = true; } self.selectedplayer = (selectednamefound?selectedname:''); return ''; }; self.setSelectedPlayerColor = function(color) { var plyrname = $('#' + self.id + '_selectplayer option:selected').val(); window.plugin.playerTracker.stored[plyrname].color = color; $('#' + self.id + '_selectplayer').css('color',color); $('#' + self.id + '_selectplayer option:selected').css('color',color); self.resettracks(); }; self.updateplayerlist = function() { if (!document.getElementById(self.id + '_selectplayer')) return; var newlist = self.playerselectlist($('#' + self.id + '_selectplayer option:selected').val()); if (newlist !== $('#' + self.id + '_selectplayer').html()) $('#' + self.id + '_selectplayer').replaceWith(newlist); $('#' + self.id + '_playercolor').spectrum('set',(window.plugin.playerTracker.stored && window.plugin.playerTracker.stored[$('#' + self.id + '_selectplayer option:selected').val()] && window.plugin.playerTracker.stored[$('#' + self.id + '_selectplayer option:selected').val()].color?window.plugin.playerTracker.stored[$('#' + self.id + '_selectplayer option:selected').val()].color:'black')); }; self.viewselectedplayer = function() { var plyrname = $('#' + self.id + '_selectplayer option:selected').val(); if (!window.plugin.playerTracker.stored || !window.plugin.playerTracker.stored[plyrname]) return; var lasteventlatlng = window.plugin.playerTracker.stored[plyrname].events[window.plugin.playerTracker.stored[plyrname].events.length-1].latlngs[0]; // map.fitBounds(window.plugin.quickdrawlinks.drawnItems.getBounds()); var position = new L.LatLng(lasteventlatlng[0],lasteventlatlng[1]); window.map.setView(position, map.getZoom()); }; self.menu = function() { var limitchoices = {'30 minutes':0.5,'1 hour':1,'2 hours':2,'3 hours (default)':3,'4 hours':4,'5 hours':5,'6 hours':6,'12 hours':12,'1 day':24,'2 days':48,'3 days':72,'4 days':96,'5 days':120,'6 days':144,'1 week':168}; var maxdisplayeventschoices = {'1':1,'5':5,'10 (default)':10,'15':15,'20':20,'25':25,'30':30,'40':40}; let container = document.createElement('div'); container.className = self.id + 'menu'; let hiddenautofocusinput = container.appendChild(document.createElement('input')); // added to prevent auto focus on first element hiddenautofocusinput.type = 'hidden'; hiddenautofocusinput.autofocus = 'autofocus'; let showlabelsarea = container.appendChild(document.createElement('label')); let showlabels = showlabelsarea.appendChild(document.createElement('input')); showlabels.type = 'checkbox'; showlabels.checked = self.settings.showlabels; showlabelsarea.appendChild(document.createTextNode('Show player name labels')); container.appendChild(document.createElement('br')); let showlastactionarea = container.appendChild(document.createElement('label')); let showlastaction = showlastactionarea.appendChild(document.createElement('input')); showlastaction.type = 'checkbox'; showlastaction.checked = self.settings.showlastaction; showlastaction.disabled = !self.settings.showlabels; showlastactionarea.appendChild(document.createTextNode('Display time on labels')); container.appendChild(document.createElement('br')); let showdatetimearea = container.appendChild(document.createElement('label')); let showdatetime = showdatetimearea.appendChild(document.createElement('input')); showdatetime.type = 'checkbox'; showdatetime.checked = self.settings.showdatetime; showdatetime.disabled = !(self.settings.showlabels && self.settings.showlastaction); showdatetimearea.appendChild(document.createTextNode("Show date+time instead of 'ago'")); container.appendChild(document.createElement('br')); let hidedatetodayarea = container.appendChild(document.createElement('label')); let hidedatetoday = hidedatetodayarea.appendChild(document.createElement('input')); hidedatetoday.type = 'checkbox'; hidedatetoday.checked = self.settings.hidedatetoday; hidedatetoday.disabled = !(self.settings.showlabels && self.settings.showlastaction && self.settings.showdatetime); hidedatetodayarea.appendChild(document.createTextNode('Hide date if it is today')); container.appendChild(document.createElement('br')); let hideonyourportalactionsarea = container.appendChild(document.createElement('label')); let hideonyourportalactions = hideonyourportalactionsarea.appendChild(document.createElement('input')); hideonyourportalactions.type = 'checkbox'; hideonyourportalactions.checked = self.settings.hideonyourportalactions; hideonyourportalactionsarea.appendChild(document.createTextNode('Hide "on your portal" actions')); showlabels.addEventListener('change', function(e) { e.preventDefault(); self.settings.showlabels = this.checked; self.storesettings(); self.labelsetup(); self.resettracks(); showlastaction.disabled = !self.settings.showlabels; showdatetime.disabled = !(self.settings.showlabels && self.settings.showlastaction); hidedatetoday.disabled = !(self.settings.showlabels && self.settings.showlastaction && self.settings.showdatetime); },false); showlastaction.addEventListener('change', function(e) { e.preventDefault(); self.settings.showlastaction = this.checked; self.storesettings(); self.labelsetup(); self.resettracks(); showlastaction.disabled = !self.settings.showlabels; showdatetime.disabled = !(self.settings.showlabels && self.settings.showlastaction); hidedatetoday.disabled = !(self.settings.showlabels && self.settings.showlastaction && self.settings.showdatetime); },false); showdatetime.addEventListener('change', function(e) { e.preventDefault(); self.settings.showdatetime = this.checked; self.storesettings(); self.labelsetup(); self.resettracks(); showlastaction.disabled = !self.settings.showlabels; showdatetime.disabled = !(self.settings.showlabels && self.settings.showlastaction); hidedatetoday.disabled = !(self.settings.showlabels && self.settings.showlastaction && self.settings.showdatetime); },false); hidedatetoday.addEventListener('change', function(e) { e.preventDefault(); self.settings.hidedatetoday = this.checked; self.storesettings(); self.labelsetup(); self.resettracks(); showlastaction.disabled = !self.settings.showlabels; showdatetime.disabled = !(self.settings.showlabels && self.settings.showlastaction); hidedatetoday.disabled = !(self.settings.showlabels && self.settings.showlastaction && self.settings.showdatetime); },false); hideonyourportalactions.addEventListener('change', function(e) { e.preventDefault(); self.settings.hideonyourportalactions = this.checked; self.storesettings(); self.resettracks(); },false); let othersettings = container.appendChild(document.createElement('div')); othersettings.className = self.id + 'menu'; othersettings.innerHTML = 'History:
' + 'History lines:
' + '
' + ' Adjust color for selected player:
' + self.playerselectlist() + '
' + '
' + '
' + 'Focus on selected player' + 'Show list of stored players'; let author = container.appendChild(document.createElement('div')); author.className = self.id + 'author'; author.textContent = self.title + ' version ' + self.version + ' by ' + self.author; dialog({ id: 'ui-dialog-' + self.id, html: container, dialogClass: 'ui-dialog-' + self.id + 'Set', title: self.title }).dialog('option', 'buttons', { 'Changelog': function() { alert(self.changelog); }, 'Close': function() { $(this).dialog('close'); } }); // need to initialise the 'spectrum' color picker $('#' + self.id + '_playercolor').spectrum({ flat: false, showInput: true, showButtons: true, showPalette: true, showSelectionPalette: true, allowEmpty: false, palette: [ ['#004000','#008000','#00C000'], ['#00FF00','#80FF80','#C0FFC0'], ['#000040','#000080','#0000C0'], ['#4040FF','#8080FF','#C0C0FF'], ['#6A3400','#964A00','#C05F00'], ['#E27000','#FF8309','#FFC287',window.PLAYER_TRACKER_LINE_COLOUR], ['#a24ac3','#514ac3','#4aa8c3','#51c34a'], ['#c1c34a','#c38a4a','#c34a4a','#c34a6f'], ['#000000','#666666','#bbbbbb','#ffffff'] ], change: function(color) { self.setSelectedPlayerColor(color.toHexString()); }, color: self.getPlayerColor($('#' + self.id + '_selectplayer option:selected').val()), }); }; self.setupMarkerlabel = function() { /* Leaflet.iconlabel (https://github.com/jacobtoye/Leaflet.iconlabel) Copyright 2012 Jacob Toye Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ L.Icon.Label = L.Icon.extend({ options: { /* labelAnchor: (Point) (top left position of the label within the wrapper, default is right) wrapperAnchor: (Point) (position of icon and label relative to Lat/Lng) iconAnchor: (Point) (top left position of icon within wrapper) labelText: (String) (label's text component, if this is null the element will not be created) */ /* Icon options: iconUrl: (String) (required) iconSize: (Point) (can be set through CSS) iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins) popupAnchor: (Point) (if not specified, popup opens in the anchor point) shadowUrl: (Point) (no shadow by default) shadowSize: (Point) */ labelClassName: '' }, initialize: function (options) { L.Util.setOptions(this, options); L.Icon.prototype.initialize.call(this, this.options); }, setLabelAsHidden: function () { this._labelHidden = true; }, createIcon: function () { return this._createLabel(L.Icon.prototype.createIcon.call(this)); }, createShadow: function () { if (!this.options.shadowUrl) { return null; } var shadow = L.Icon.prototype.createShadow.call(this); //need to reposition the shadow if (shadow) { shadow.style.marginLeft = (-this.options.wrapperAnchor.x) + 'px'; shadow.style.marginTop = (-this.options.wrapperAnchor.y) + 'px'; } return shadow; }, updateLabel: function (icon, text) { if (icon.nodeName.toUpperCase() === 'DIV') { icon.childNodes[1].innerHTML = text; this.options.labelText = text; } }, showLabel: function (icon) { if (!this._labelTextIsSet()) { return; } icon.childNodes[1].style.display = 'block'; }, hideLabel: function (icon) { if (!this._labelTextIsSet()) { return; } icon.childNodes[1].style.display = 'none'; }, _createLabel: function (img) { if (!this._labelTextIsSet()) { return img; } var wrapper = document.createElement('div'), label = document.createElement('span'); // set up wrapper anchor wrapper.style.marginLeft = (-this.options.wrapperAnchor.x) + 'px'; wrapper.style.marginTop = (-this.options.wrapperAnchor.y) + 'px'; wrapper.className = 'leaflet-marker-icon-wrapper leaflet-zoom-animated'; // set up label label.className = 'leaflet-marker-iconlabel ' + this.options.labelClassName; label.innerHTML = this.options.labelText; label.style.marginLeft = this.options.labelAnchor.x + 'px'; label.style.marginTop = this.options.labelAnchor.y + 'px'; if (this._labelHidden) { label.style.display = 'none'; // Ensure that the pointer cursor shows img.style.cursor = 'pointer'; } img.className = 'leaflet-interactive'; //reset icons margins (as super makes them -ve) img.style.marginLeft = this.options.iconAnchor.x + 'px'; img.style.marginTop = this.options.iconAnchor.y + 'px'; wrapper.appendChild(img); wrapper.appendChild(label); return wrapper; }, _labelTextIsSet: function () { return typeof this.options.labelText !== 'undefined' && this.options.labelText !== null; } }); L.Icon.Label.Default = L.Icon.Label.extend({ options: { //This is the top left position of the label within the wrapper. By default it will display at the right //middle position of the default icon. x = width of icon + padding //If the icon height is greater than the label height you will need to set the y value. //y = (icon height - label height) / 2 labelAnchor: new L.Point(29, 8), //This is the position of the wrapper div. Use this to position icon + label relative to the Lat/Lng. //By default the point of the default icon is anchor wrapperAnchor: new L.Point(13, 41), //This is now the top left position of the icon within the wrapper. //If the label height is greater than the icon you will need to set the y value. //y = (label height - icon height) / 2 iconAnchor: new L.Point(0, 0), //label's text component, if this is null the element will not be created labelText: null, /* From L.Icon.Default */ iconUrl: L.Icon.Default.imagePath + '/marker-icon.png', iconSize: new L.Point(25, 41), popupAnchor: new L.Point(0, -33), shadowUrl: L.Icon.Default.imagePath + '/marker-shadow.png', shadowSize: new L.Point(41, 41) } }); L.Marker.Label = L.Marker.extend({ updateLabel: function (text) { this.options.icon.updateLabel(this._icon, text); }, _initIcon: function () { if (!(this.options.icon instanceof L.Icon.Label)) { throw new Error('Icon must be an instance of L.Icon.Label.'); } // Ensure that the label is hidden to begin with if (this.options.revealing) { this.options.icon.setLabelAsHidden(); } L.Marker.prototype._initIcon.call(this); }, _removeIcon: function () { if (this.options.revealing) { L.DomEvent .off(this._icon, 'mouseover', this._showLabel) .off(this._icon, 'mouseout', this._hideLabel); } L.Marker.prototype._removeIcon.call(this); }, _initInteraction: function () { L.Marker.prototype._initInteraction.call(this); if (!this.options.revealing) { return; } L.DomEvent .on(this._icon, 'mouseover', this._showLabel, this) .on(this._icon, 'mouseout', this._hideLabel, this); }, _showLabel: function () { this.options.icon.showLabel(this._icon); }, _hideLabel: function () { this.options.icon.hideLabel(this._icon); } }); // ' font: 9px/0.5 Arial;' + // ' font: 12px/1.5 Arial;' + $('head').append( ''); }; // end self.setupMarkerlabel self.setupColorpickerSpectrum = function() { // source: https://github.com/bgrins/spectrum // minified with https://www.minifier.org/ // Spectrum Colorpicker v1.8.1 // https://github.com/bgrins/spectrum // Author: Brian Grinstead // License: MIT (function(factory){"use strict";if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof exports=="object"&&typeof module=="object"){module.exports=factory(require('jquery'))}else{factory(jQuery)}})(function($,undefined){"use strict";var defaultOpts={beforeShow:noop,move:noop,change:noop,show:noop,hide:noop,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},spectrums=[],IE=!!/msie/i.exec(window.navigator.userAgent),rgbaSupport=(function(){function contains(str,substr){return!!~(''+str).indexOf(substr)} var elem=document.createElement('div');var style=elem.style;style.cssText='background-color:rgba(0,0,0,.5)';return contains(style.backgroundColor,'rgba')||contains(style.backgroundColor,'hsla')})(),replaceInput=["
","
","
","
"].join(''),markup=(function(){var gradientFix="";if(IE){for(var i=1;i<=6;i++){gradientFix+="
"}} return["
","
","
","
","","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
","
",gradientFix,"
","
","
","
","
","","
","
","
","","","
","
","
"].join("")})();function paletteTemplate(p,color,className,opts){var html=[];for(var i=0;i')}else{var cls='sp-clear-display';html.push($('
').append($('').attr('title',opts.noColorSelectedText)).html())}} return"
"+html.join('')+"
"} function hideAll(){for(var i=0;iMath.abs(dragY-oldDragY);shiftMovementDirection=furtherFromX?"x":"y"} var setSaturation=!shiftMovementDirection||shiftMovementDirection==="x";var setValue=!shiftMovementDirection||shiftMovementDirection==="y";if(setSaturation){currentSaturation=parseFloat(dragX/dragWidth)} if(setValue){currentValue=parseFloat((dragHeight-dragY)/dragHeight)} isEmpty=!1;if(!opts.showAlpha){currentAlpha=1} move()},dragStart,dragStop);if(!!initialColor){set(initialColor);updateUI();currentPreferredFormat=opts.preferredFormat||tinycolor(initialColor).format;addColorToSelectionPalette(initialColor)}else{updateUI()} if(flat){show()} function paletteElementClick(e){if(e.data&&e.data.ignore){set($(e.target).closest(".sp-thumb-el").data("color"));move()}else{set($(e.target).closest(".sp-thumb-el").data("color"));move();if(opts.hideAfterPaletteSelect){updateOriginalInput(!0);hide()}else{updateOriginalInput()}} return!1} var paletteEvent=IE?"mousedown.spectrum":"click.spectrum touchstart.spectrum";paletteContainer.on(paletteEvent,".sp-thumb-el",paletteElementClick);initialColorContainer.on(paletteEvent,".sp-thumb-el:nth-child(1)",{ignore:!0},paletteElementClick)} function updateSelectionPaletteFromStorage(){if(localStorageKey&&window.localStorage){try{var oldPalette=window.localStorage[localStorageKey].split(",#");if(oldPalette.length>1){delete window.localStorage[localStorageKey];$.each(oldPalette,function(i,c){addColorToSelectionPalette(c)})}}catch(e){} try{selectionPalette=window.localStorage[localStorageKey].split(";")}catch(e){}}} function addColorToSelectionPalette(color){if(showSelectionPalette){var rgb=tinycolor(color).toRgbString();if(!paletteLookup[rgb]&&$.inArray(rgb,selectionPalette)===-1){selectionPalette.push(rgb);while(selectionPalette.length>maxSelectionSize){selectionPalette.shift()}} if(localStorageKey&&window.localStorage){try{window.localStorage[localStorageKey]=selectionPalette.join(";")}catch(e){}}}} function getUniqueSelectionPalette(){var unique=[];if(opts.showPalette){for(var i=0;iviewWidth&&viewWidth>dpWidth)?Math.abs(offsetLeft+dpWidth-viewWidth):0);offsetTop-=Math.min(offsetTop,((offsetTop+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight-extraY):extraY));return{top:offsetTop,bottom:offset.bottom,left:offsetLeft,right:offset.right,width:offset.width,height:offset.height}} function noop(){} function stopPropagation(e){e.stopPropagation()} function bind(func,obj){var slice=Array.prototype.slice;var args=slice.call(arguments,2);return function(){return func.apply(obj,args.concat(slice.call(arguments)))}} function draggable(element,onmove,onstart,onstop){onmove=onmove||function(){};onstart=onstart||function(){};onstop=onstop||function(){};var doc=document;var dragging=!1;var offset={};var maxHeight=0;var maxWidth=0;var hasTouch=('ontouchstart' in window);var duringDragEvents={};duringDragEvents.selectstart=prevent;duringDragEvents.dragstart=prevent;duringDragEvents["touchmove mousemove"]=move;duringDragEvents["touchend mouseup"]=stop;function prevent(e){if(e.stopPropagation){e.stopPropagation()} if(e.preventDefault){e.preventDefault()} e.returnValue=!1} function move(e){if(dragging){if(IE&&doc.documentMode<9&&!e.button){return stop()} var t0=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0];var pageX=t0&&t0.pageX||e.pageX;var pageY=t0&&t0.pageY||e.pageY;var dragX=Math.max(0,Math.min(pageX-offset.left,maxWidth));var dragY=Math.max(0,Math.min(pageY-offset.top,maxHeight));if(hasTouch){prevent(e)} onmove.apply(element,[dragX,dragY,e])}} function start(e){var rightclick=(e.which)?(e.which==3):(e.button==2);if(!rightclick&&!dragging){if(onstart.apply(element,arguments)!==!1){dragging=!0;maxHeight=$(element).height();maxWidth=$(element).width();offset=$(element).offset();$(doc).on(duringDragEvents);$(doc.body).addClass("sp-dragging");move(e);prevent(e)}}} function stop(){if(dragging){$(doc).off(duringDragEvents);$(doc.body).removeClass("sp-dragging");setTimeout(function(){onstop.apply(element,arguments)},0)} dragging=!1} $(element).on("touchstart mousedown",start)} function throttle(func,wait,debounce){var timeout;return function(){var context=this,args=arguments;var throttler=function(){timeout=null;func.apply(context,args)};if(debounce)clearTimeout(timeout);if(debounce||!timeout)timeout=setTimeout(throttler,wait)}} function inputTypeColorSupport(){return $.fn.spectrum.inputTypeColorSupport()} var dataID="spectrum.id";$.fn.spectrum=function(opts,extra){if(typeof opts=="string"){var returnValue=this;var args=Array.prototype.slice.call(arguments,1);this.each(function(){var spect=spectrums[$(this).data(dataID)];if(spect){var method=spect[opts];if(!method){throw new Error("Spectrum: no such method: '"+opts+"'")} if(opts=="get"){returnValue=spect.get()}else if(opts=="container"){returnValue=spect.container}else if(opts=="option"){returnValue=spect.option.apply(spect,args)}else if(opts=="destroy"){spect.destroy();$(this).removeData(dataID)}else{method.apply(spect,args)}}});return returnValue} return this.spectrum("destroy").each(function(){var options=$.extend({},$(this).data(),opts);var spect=spectrum(this,options);$(this).data(dataID,spect.id)})};$.fn.spectrum.load=!0;$.fn.spectrum.loadOpts={};$.fn.spectrum.draggable=draggable;$.fn.spectrum.defaults=defaultOpts;$.fn.spectrum.inputTypeColorSupport=function inputTypeColorSupport(){if(typeof inputTypeColorSupport._cachedResult==="undefined"){var colorInput=$("")[0];inputTypeColorSupport._cachedResult=colorInput.type==="color"&&colorInput.value!==""} return inputTypeColorSupport._cachedResult};$.spectrum={};$.spectrum.localization={};$.spectrum.palettes={};$.fn.spectrum.processNativeColorInputs=function(){var colorInputs=$("input[type=color]");if(colorInputs.length&&!inputTypeColorSupport()){colorInputs.spectrum({preferredFormat:"hex6"})}};(function(){var trimLeft=/^[\s,#]+/,trimRight=/\s+$/,tinyCounter=0,math=Math,mathRound=math.round,mathMin=math.min,mathMax=math.max,mathRandom=math.random;var tinycolor=function(color,opts){color=(color)?color:'';opts=opts||{};if(color instanceof tinycolor){return color} if(!(this instanceof tinycolor)){return new tinycolor(color,opts)} var rgb=inputToRGB(color);this._originalInput=color;this._r=rgb.r;this._g=rgb.g;this._b=rgb.b;this._a=rgb.a;this._roundA=mathRound(1000*this._a)/1000;this._format=opts.format||rgb.format;this._gradientType=opts.gradientType;if(this._r<1){this._r=mathRound(this._r)} if(this._g<1){this._g=mathRound(this._g)} if(this._b<1){this._b=mathRound(this._b)} this._ok=rgb.ok;this._tc_id=tinyCounter++};tinycolor.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var rgb=this.toRgb();return(rgb.r*299+rgb.g*587+rgb.b*114)/1000},setAlpha:function(value){this._a=boundAlpha(value);this._roundA=mathRound(1000*this._a)/1000;return this},toHsv:function(){var hsv=rgbToHsv(this._r,this._g,this._b);return{h:hsv.h*360,s:hsv.s,v:hsv.v,a:this._a}},toHsvString:function(){var hsv=rgbToHsv(this._r,this._g,this._b);var h=mathRound(hsv.h*360),s=mathRound(hsv.s*100),v=mathRound(hsv.v*100);return(this._a==1)?"hsv("+h+", "+s+"%, "+v+"%)":"hsva("+h+", "+s+"%, "+v+"%, "+this._roundA+")"},toHsl:function(){var hsl=rgbToHsl(this._r,this._g,this._b);return{h:hsl.h*360,s:hsl.s,l:hsl.l,a:this._a}},toHslString:function(){var hsl=rgbToHsl(this._r,this._g,this._b);var h=mathRound(hsl.h*360),s=mathRound(hsl.s*100),l=mathRound(hsl.l*100);return(this._a==1)?"hsl("+h+", "+s+"%, "+l+"%)":"hsla("+h+", "+s+"%, "+l+"%, "+this._roundA+")"},toHex:function(allow3Char){return rgbToHex(this._r,this._g,this._b,allow3Char)},toHexString:function(allow3Char){return'#'+this.toHex(allow3Char)},toHex8:function(){return rgbaToHex(this._r,this._g,this._b,this._a)},toHex8String:function(){return'#'+this.toHex8()},toRgb:function(){return{r:mathRound(this._r),g:mathRound(this._g),b:mathRound(this._b),a:this._a}},toRgbString:function(){return(this._a==1)?"rgb("+mathRound(this._r)+", "+mathRound(this._g)+", "+mathRound(this._b)+")":"rgba("+mathRound(this._r)+", "+mathRound(this._g)+", "+mathRound(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:mathRound(bound01(this._r,255)*100)+"%",g:mathRound(bound01(this._g,255)*100)+"%",b:mathRound(bound01(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return(this._a==1)?"rgb("+mathRound(bound01(this._r,255)*100)+"%, "+mathRound(bound01(this._g,255)*100)+"%, "+mathRound(bound01(this._b,255)*100)+"%)":"rgba("+mathRound(bound01(this._r,255)*100)+"%, "+mathRound(bound01(this._g,255)*100)+"%, "+mathRound(bound01(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){if(this._a===0){return"transparent"} if(this._a<1){return!1} return hexNames[rgbToHex(this._r,this._g,this._b,!0)]||!1},toFilter:function(secondColor){var hex8String='#'+rgbaToHex(this._r,this._g,this._b,this._a);var secondHex8String=hex8String;var gradientType=this._gradientType?"GradientType = 1, ":"";if(secondColor){var s=tinycolor(secondColor);secondHex8String=s.toHex8String()} return"progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"},toString:function(format){var formatSet=!!format;format=format||this._format;var formattedString=!1;var hasAlpha=this._a<1&&this._a>=0;var needsAlphaFormat=!formatSet&&hasAlpha&&(format==="hex"||format==="hex6"||format==="hex3"||format==="name");if(needsAlphaFormat){if(format==="name"&&this._a===0){return this.toName()} return this.toRgbString()} if(format==="rgb"){formattedString=this.toRgbString()} if(format==="prgb"){formattedString=this.toPercentageRgbString()} if(format==="hex"||format==="hex6"){formattedString=this.toHexString()} if(format==="hex3"){formattedString=this.toHexString(!0)} if(format==="hex8"){formattedString=this.toHex8String()} if(format==="name"){formattedString=this.toName()} if(format==="hsl"){formattedString=this.toHslString()} if(format==="hsv"){formattedString=this.toHsvString()} return formattedString||this.toHexString()},_applyModification:function(fn,args){var color=fn.apply(null,[this].concat([].slice.call(args)));this._r=color._r;this._g=color._g;this._b=color._b;this.setAlpha(color._a);return this},lighten:function(){return this._applyModification(lighten,arguments)},brighten:function(){return this._applyModification(brighten,arguments)},darken:function(){return this._applyModification(darken,arguments)},desaturate:function(){return this._applyModification(desaturate,arguments)},saturate:function(){return this._applyModification(saturate,arguments)},greyscale:function(){return this._applyModification(greyscale,arguments)},spin:function(){return this._applyModification(spin,arguments)},_applyCombination:function(fn,args){return fn.apply(null,[this].concat([].slice.call(args)))},analogous:function(){return this._applyCombination(analogous,arguments)},complement:function(){return this._applyCombination(complement,arguments)},monochromatic:function(){return this._applyCombination(monochromatic,arguments)},splitcomplement:function(){return this._applyCombination(splitcomplement,arguments)},triad:function(){return this._applyCombination(triad,arguments)},tetrad:function(){return this._applyCombination(tetrad,arguments)}};tinycolor.fromRatio=function(color,opts){if(typeof color=="object"){var newColor={};for(var i in color){if(color.hasOwnProperty(i)){if(i==="a"){newColor[i]=color[i]}else{newColor[i]=convertToPercentage(color[i])}}} color=newColor} return tinycolor(color,opts)};function inputToRGB(color){var rgb={r:0,g:0,b:0};var a=1;var ok=!1;var format=!1;if(typeof color=="string"){color=stringInputToObject(color)} if(typeof color=="object"){if(color.hasOwnProperty("r")&&color.hasOwnProperty("g")&&color.hasOwnProperty("b")){rgb=rgbToRgb(color.r,color.g,color.b);ok=!0;format=String(color.r).substr(-1)==="%"?"prgb":"rgb"}else if(color.hasOwnProperty("h")&&color.hasOwnProperty("s")&&color.hasOwnProperty("v")){color.s=convertToPercentage(color.s);color.v=convertToPercentage(color.v);rgb=hsvToRgb(color.h,color.s,color.v);ok=!0;format="hsv"}else if(color.hasOwnProperty("h")&&color.hasOwnProperty("s")&&color.hasOwnProperty("l")){color.s=convertToPercentage(color.s);color.l=convertToPercentage(color.l);rgb=hslToRgb(color.h,color.s,color.l);ok=!0;format="hsl"} if(color.hasOwnProperty("a")){a=color.a}} a=boundAlpha(a);return{ok:ok,format:color.format||format,r:mathMin(255,mathMax(rgb.r,0)),g:mathMin(255,mathMax(rgb.g,0)),b:mathMin(255,mathMax(rgb.b,0)),a:a}} function rgbToRgb(r,g,b){return{r:bound01(r,255)*255,g:bound01(g,255)*255,b:bound01(b,255)*255}} function rgbToHsl(r,g,b){r=bound01(r,255);g=bound01(g,255);b=bound01(b,255);var max=mathMax(r,g,b),min=mathMin(r,g,b);var h,s,l=(max+min)/2;if(max==min){h=s=0}else{var d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p} if(s===0){r=g=b=l}else{var q=l<0.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)} return{r:r*255,g:g*255,b:b*255}} function rgbToHsv(r,g,b){r=bound01(r,255);g=bound01(g,255);b=bound01(b,255);var max=mathMax(r,g,b),min=mathMin(r,g,b);var h,s,v=max;var d=max-min;s=max===0?0:d/max;if(max==min){h=0}else{switch(max){case r:h=(g-b)/d+(g>1))+720)%360;--results;){hsl.h=(hsl.h+part)%360;ret.push(tinycolor(hsl))} return ret} function monochromatic(color,results){results=results||6;var hsv=tinycolor(color).toHsv();var h=hsv.h,s=hsv.s,v=hsv.v;var ret=[];var modification=1/results;while(results--){ret.push(tinycolor({h:h,s:s,v:v}));v=(v+modification)%1} return ret} tinycolor.mix=function(color1,color2,amount){amount=(amount===0)?0:(amount||50);var rgb1=tinycolor(color1).toRgb();var rgb2=tinycolor(color2).toRgb();var p=amount/100;var w=p*2-1;var a=rgb2.a-rgb1.a;var w1;if(w*a==-1){w1=w}else{w1=(w+a)/(1+w*a)} w1=(w1+1)/2;var w2=1-w1;var rgba={r:rgb2.r*w1+rgb1.r*w2,g:rgb2.g*w1+rgb1.g*w2,b:rgb2.b*w1+rgb1.b*w2,a:rgb2.a*p+rgb1.a*(1-p)};return tinycolor(rgba)};tinycolor.readability=function(color1,color2){var c1=tinycolor(color1);var c2=tinycolor(color2);var rgb1=c1.toRgb();var rgb2=c2.toRgb();var brightnessA=c1.getBrightness();var brightnessB=c2.getBrightness();var colorDiff=(Math.max(rgb1.r,rgb2.r)-Math.min(rgb1.r,rgb2.r)+Math.max(rgb1.g,rgb2.g)-Math.min(rgb1.g,rgb2.g)+Math.max(rgb1.b,rgb2.b)-Math.min(rgb1.b,rgb2.b));return{brightness:Math.abs(brightnessA-brightnessB),color:colorDiff}};tinycolor.isReadable=function(color1,color2){var readability=tinycolor.readability(color1,color2);return readability.brightness>125&&readability.color>500};tinycolor.mostReadable=function(baseColor,colorList){var bestColor=null;var bestScore=0;var bestIsReadable=!1;for(var i=0;i125&&readability.color>500;var score=3*(readability.brightness/125)+(readability.color/500);if((readable&&!bestIsReadable)||(readable&&bestIsReadable&&score>bestScore)||((!readable)&&(!bestIsReadable)&&score>bestScore)){bestIsReadable=readable;bestScore=score;bestColor=tinycolor(colorList[i])}} return bestColor};var names=tinycolor.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var hexNames=tinycolor.hexNames=flip(names);function flip(o){var flipped={};for(var i in o){if(o.hasOwnProperty(i)){flipped[o[i]]=i}} return flipped} function boundAlpha(a){a=parseFloat(a);if(isNaN(a)||a<0||a>1){a=1} return a} function bound01(n,max){if(isOnePointZero(n)){n="100%"} var processPercent=isPercentage(n);n=mathMin(max,mathMax(0,parseFloat(n)));if(processPercent){n=parseInt(n*max,10)/100} if((math.abs(n-max)<0.000001)){return 1} return(n%max)/parseFloat(max)} function clamp01(val){return mathMin(1,mathMax(0,val))} function parseIntFromHex(val){return parseInt(val,16)} function isOnePointZero(n){return typeof n=="string"&&n.indexOf('.')!=-1&&parseFloat(n)===1} function isPercentage(n){return typeof n==="string"&&n.indexOf('%')!=-1} function pad2(c){return c.length==1?'0'+c:''+c} function convertToPercentage(n){if(n<=1){n=(n*100)+"%"} return n} function convertDecimalToHex(d){return Math.round(parseFloat(d)*255).toString(16)} function convertHexToDecimal(h){return(parseIntFromHex(h)/255)} var matchers=(function(){var CSS_INTEGER="[-\\+]?\\d+%?";var CSS_NUMBER="[-\\+]?\\d*\\.\\d+%?";var CSS_UNIT="(?:"+CSS_NUMBER+")|(?:"+CSS_INTEGER+")";var PERMISSIVE_MATCH3="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?";var PERMISSIVE_MATCH4="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?";return{rgb:new RegExp("rgb"+PERMISSIVE_MATCH3),rgba:new RegExp("rgba"+PERMISSIVE_MATCH4),hsl:new RegExp("hsl"+PERMISSIVE_MATCH3),hsla:new RegExp("hsla"+PERMISSIVE_MATCH4),hsv:new RegExp("hsv"+PERMISSIVE_MATCH3),hsva:new RegExp("hsva"+PERMISSIVE_MATCH4),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function stringInputToObject(color){color=color.replace(trimLeft,'').replace(trimRight,'').toLowerCase();var named=!1;if(names[color]){color=names[color];named=!0}else if(color=='transparent'){return{r:0,g:0,b:0,a:0,format:"name"}} var match;if((match=matchers.rgb.exec(color))){return{r:match[1],g:match[2],b:match[3]}} if((match=matchers.rgba.exec(color))){return{r:match[1],g:match[2],b:match[3],a:match[4]}} if((match=matchers.hsl.exec(color))){return{h:match[1],s:match[2],l:match[3]}} if((match=matchers.hsla.exec(color))){return{h:match[1],s:match[2],l:match[3],a:match[4]}} if((match=matchers.hsv.exec(color))){return{h:match[1],s:match[2],v:match[3]}} if((match=matchers.hsva.exec(color))){return{h:match[1],s:match[2],v:match[3],a:match[4]}} if((match=matchers.hex8.exec(color))){return{a:convertHexToDecimal(match[1]),r:parseIntFromHex(match[2]),g:parseIntFromHex(match[3]),b:parseIntFromHex(match[4]),format:named?"name":"hex8"}} if((match=matchers.hex6.exec(color))){return{r:parseIntFromHex(match[1]),g:parseIntFromHex(match[2]),b:parseIntFromHex(match[3]),format:named?"name":"hex"}} if((match=matchers.hex3.exec(color))){return{r:parseIntFromHex(match[1]+''+match[1]),g:parseIntFromHex(match[2]+''+match[2]),b:parseIntFromHex(match[3]+''+match[3]),format:named?"name":"hex"}} return!1} window.tinycolor=tinycolor})();$(function(){if($.fn.spectrum.load){$.fn.spectrum.processNativeColorInputs()}})}); $('head').append(''); }; // end setupColorpickerSpectrum self.setup = function() { if ('pluginloaded' in self) { console.log('IITC plugin already loaded: ' + self.title + ' version ' + self.version); return; } else { self.pluginloaded = true; } if (!window.plugin.playerTracker) { console.log('IITC plugin ERROR: ' + self.title + ' version ' + self.version + ' - window.plugin.playerTracker required'); return; } self.setupMarkerlabel(); self.setupColorpickerSpectrum(); self.restoresettings(); // override original time display function, to enable display of time in minutes, hours or days: window.plugin.playerTracker.ago = function(time, now) { var s = (now-time) / 1000; var m = Math.floor((s % 3600) / 60); var h = Math.floor(s / 3600); var d = Math.floor(h / 24); var returnVal = m + 'm'; if (h > 24) { h = Math.floor(h % 24); } if (h > 0) { returnVal = h + 'h' + returnVal; } if (d > 0) { returnVal = d + 'd' + returnVal; } return returnVal; }; // inject code for Machina: if (!window.plugin.playerTracker.iconMac) { var iconMacImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAAB3RJTUUH5wUNFhQMwqySiwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAARnQU1BAACxjwv8YQUAAAnMSURBVHjalVcLcFTlFf7+e+/efW8em2TzfpFASAIRUAsIKAgxCSgo6ChaRdFiO1ptRxzbWkalHbVVOlq1M4FiX1YePhitlaGxtQqYRiKBNARCyJOQbN7JZrPPe0/PbqjaaQLxzPz5J3f/e77/vL5zrsDUYuSVl66qZaXZuSknLnStbPSN28NEcAjAaXHoA35fvUZ0NN4Z9+E5t7uZzwcmUyQmeSbxyhRCbAJhg0EgL0bIiqpr0lWZWeL67GzsP16H0yE/jLKs+4OhkEZ6M8niLTWA/W6EzvL7wa8rlCe5fYUE8RPGv1sSSDFDKA6JJBM/uK24CGvTUhE2KvikqwsGRRWCSGGQRMjSotFwaIUJ0mAI1MR6tKncs5EtaGXzNAFBRkkmhyyojPeqinI6NCOfwl/U0e7MHLovJ5dWW+10q0GldMVA8QZeqlG3Ggyt7IqNeRP6/kfUKADAAEJnS2gCRCKHJGib2UrB6mp69b5N5LBY6Hf330/ux39M1QxW70qmZ00mylEUimGwBJNZZ/taTZK08aLeL2NSNMtm32PV9KILPq+IOHREkmDgIFewz1alpaPSZoXB6kBZSQkOVB+BScjIbD+PnHAAm1UFHwU1vBQIgF9DXlwitQ32N7SGg7d7gYaomxjpqeXJKf49d95FjwiJtkoKJfG+PjGJSp1JpMoybU1IIs/ZJvLzCvb20k/LK0jlc8tjY+m11DRq57O7zCZ6KS6O3r3rHqqwWv1xBsNTrN8UCXyBwiCFgVByV/+gWL/5XqxLT8VyjxfV7gtIjY/Ha+vXo+NUI6596CGOVhiSxYKFZxpxc3oKzrR34ot+N5YWFWHpqlIY5xThnboTyJVluXZwMCc3I+dMBOQe/rNhlk6KfXwMsteL/NQM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5Bbdsw9h/qAidiHwKg/X4mumpS9MiP+qreILj1GUHo5EeQiYwIijZSmUsxr1i3KLM3okjBjF+wlT5ANtFOQ2nt/yG5Gvzm6/iSJOm64ozr9KxCjAsYRFoeOwDqVJwSm+Pv8PHw6UnA+b/dkJSVTB+VeN3EzSA7y2kEokv5oEh0kRxypUhrQI1Yxeo4l3lYIhmCODB4khuxNLqSgYjVhu9sKpHLlI5bDl3fz9r3m4e9U3kOVr+8hnWoT9BfZZjD4VRQeFLj0IswR6Qe8o4+sVPnfd3atomko8xd3arwupQ+0bWcRpB63iyOysVB3u0D7joLCOdRimc5ZwtvkHz7sOvphK7OHmHvZ9q/DFxPDftW+aAg61NvYn2OsOPdQxtfNfPv6D3Xfw+BDk2Bzu8ST7tq+TN/5fFKEgjm9/xP4me+ofrx8qvP6h1R+8v/twyHC4LOK0dvTifQu+GCaftcY3gtSh9o195FBzME5f6eCu4yLHfcGz17DfSiVaD9f7D6dFHIg5Qeo99uZ/c5sDQ2fNZtPhfPdhVeRg28X+HP45W3Fg5NCQRfgaDPc/rYjjvK+gN4L9I/4dQvg359rh8o1D7bD5yKHmZGf6ipMkHcrFWinHSpzWc1CJ/2Xv/CZZ/D+iCHoVcfzAyS3OOs5K9MJoNfuf2LcejrzxH1HkYASLozdzOwGglv2v7M7HrczhtobT/g9EEZU6CVNwdwAAAABJRU5ErkJggg=='; window.plugin.playerTracker.iconMac = window.L.Icon.Default.extend({options: { iconUrl: iconMacImage, iconRetinaUrl: iconMacRetImage }}); } // inject code for Machina: if (!window.plugin.playerTracker.drawnTracesMac) { window.plugin.playerTracker.drawnTracesMac = new window.L.LayerGroup(); if ('addOverlay' in window.layerChooser) { window.layerChooser.addOverlay(window.plugin.playerTracker.drawnTracesMac, 'Player Tracker U̶͚̓̍N̴̖̈K̠͔̍͑̂͜N̞̥͋̀̉Ȯ̶̹͕̀W̶̢͚͑̚͝Ṉ̨̟̒̅',{default: true}); } else { // before IITC 0.34: window.addLayerGroup('Player Tracker U̶͚̓̍N̴̖̈K̠͔̍͑̂͜N̞̥͋̀̉Ȯ̶̹͕̀W̶̢͚͑̚͝Ṉ̨̟̒̅', window.plugin.playerTracker.drawnTracesMac, true); } window.map.on('layeradd',function(obj) { if(obj.layer === window.plugin.playerTracker.drawnTracesMac) { obj.layer.eachLayer(function(marker) { if(marker._icon) window.setupTooltips($(marker._icon)); }); } }); } try { self.labelsetup(); self.colorsetup(); self.actionssetup(); self.centersetup(); self.modify_ago(); self.resettracks(); } catch(e) { console.log('PLAYERTRACKERADDON - ERROR: setup failed'); return; } // inject code for Machina: if (!window.plugin.playerTracker.closeIconTooltips.toString().match(/Mac/)) { let original_closeIconTooltips = window.plugin.playerTracker.closeIconTooltips; window.plugin.playerTracker.closeIconTooltips = function() { original_closeIconTooltips(); window.plugin.playerTracker.drawnTracesMac.eachLayer(function(layer) { if ($(layer._icon)) { $(layer._icon).tooltip('close');} }); }; let original_zoomListener = window.plugin.playerTracker.zoomListener; window.plugin.playerTracker.zoomListener = function() { original_zoomListener(); if(window.map.getZoom() < window.PLAYER_TRACKER_MIN_ZOOM) { window.plugin.playerTracker.drawnTracesMac.clearLayers(); } }; let drawData_string = window.plugin.playerTracker.drawData.toString(); drawData_string = drawData_string.replace(/(var polyLineByAgeRes.*?\n)/s,'$1var polyLineByAgeMac = {};\n'); drawData_string = drawData_string.replace(/(else\n)/s,'else if(playerData.team === \'NEUTRAL\')\n { if (!polyLineByAgeMac[plrname]) polyLineByAgeMac[plrname] = [[], [], [], []]; polyLineByAgeMac[plrname][ageBucket].push(line); }\n $1'); drawData_string = drawData_string.replace(/(addClass\('nickname.*?)('enl')/,'$1(playerData.team === \'NEUTRAL\' ? \'mac\' : $2)'); drawData_string = drawData_string.replace(/(var icon =.*?) : (.*?);/s,'$1 : (playerData.team === \'NEUTRAL\' ? new plugin.playerTracker.iconMac({ labelText: (plrname || playerData.nick) + (window.plugin.playerTrackerAddon.settings.showlastaction?\', \' + window.plugin.playerTracker.ago(playerData.events[playerData.events.length - 1].time,now):\'\') }) : $2);'); drawData_string = drawData_string.replace(/(m.addTo\(.*?) : (.*?);/s,'$1 : (playerData.team === \'NEUTRAL\' ? plugin.playerTracker.drawnTracesMac : $2);\n'); drawData_string = drawData_string.replace(/\}$/s,` $.each(polyLineByAgeMac, function(plrname, polyLineByAge) { $.each(polyLineByAge, function(i, polyLine) { if(polyLine.length === 0) return true; var opts = { weight: 2-0.25*i, color: window.plugin.playerTracker.stored[plrname].color, interactive: false, opacity: 1-0.2*i, dashArray: "5,8" }; $.each(polyLine, function(ind,poly) { L.polyline(poly, opts).addTo(plugin.playerTracker.drawnTracesMac); }); }); }); //console.log('NEUTRAL PLAYER INJECTED'); }`); //console.log(drawData_string); try { eval('window.plugin.playerTracker.drawData = ' + drawData_string); } catch(e) { console.log('PLAYERTRACKERADDON - ERROR: injecting code for drawData failed'); } } // inject an extra function into the playerTracker publicChatDataAvailable handleData hook: var handleData_override = window.plugin.playerTracker.handleData.toString(); handleData_override = handleData_override.replace('}',' ' + self.namespace + 'updateplayerlist();\n}'); if (!handleData_override.match(/drawnTracesMac/)) { handleData_override = handleData_override.replace(/(clearLayers.*?\n)/s,'$1 window.plugin.playerTracker.drawnTracesMac.clearLayers();\n'); } eval('window.plugin.playerTracker.handleData = ' + handleData_override); for (let callback of window._hooks.publicChatDataAvailable) { if (callback.toString().match('playerTracker')) { window.removeHook('publicChatDataAvailable',callback); break; } } addHook('publicChatDataAvailable',window.plugin.playerTracker.handleData); self.setlimit(self.settings.limit); //add options menu let toolboxlink = document.getElementById('toolbox').appendChild(document.createElement('a')); toolboxlink.textContent = self.title; toolboxlink.addEventListener('click', function(e) { e.preventDefault(); self.menu(); }, false); var stylesheet = document.body.appendChild(document.createElement('style')); stylesheet.innerHTML = ''; stylesheet.innerHTML += '.' + self.id + 'menu > a { display:block; color:#ffce00; border:1px solid #ffce00; padding:3px 0; margin:10px auto; width:80%; text-align:center; background:rgba(8,48,78,.9); }'; stylesheet.innerHTML += '.' + self.id + 'menu > label { user-select: none; }'; stylesheet.innerHTML += '.' + self.id + 'author { margin-top: 14px; font-style: italic; font-size: smaller; }'; console.log('IITC plugin loaded: ' + self.title + ' version ' + self.version); }; var setup = function() { (window.iitcLoaded?self.setup():window.addHook('iitcLoaded',self.setup)); }; 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);