MunzeeMap Filter

filter for munzee map

当前为 2019-07-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MunzeeMap Filter
  3. // @namespace none
  4. // @version 2019.07.23.1130
  5. // @author technical13
  6. // @supportURL https://Discord.me/TheShoeStore
  7. // @include https://www.munzee.com/map*
  8. // @grant GM_getResourceText
  9. // @resource physicals https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/physicals.json
  10. // @resource rovers https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/rovers.json
  11. // @resource POIs https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/POIs.json
  12. // @resource noblast https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/nonblastable.json
  13. // @resource blastable https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/blastable.json
  14. // @resource special https://raw.githubusercontent.com/Technical-13/MunzeeMap-Filter/master/specials.json
  15. // @description filter for munzee map
  16. // ==/UserScript==
  17. // jshint esversion: 6
  18. // basedon: MunzeeMapFilterV3 by Czimbalmos Péter AKA CzPeet
  19. // basedon: https://greasyfork.org/en/scripts/373493-munzeemapfilterv3
  20. // basedon: MunzeeMapV2 by rynee
  21. // basedon: https://greasyfork.org/en/scripts/11662-munzeemapv2
  22. // basedon: MyMunzeeMap by pkoopmanpk
  23. // basedon: https://greasyfork.org/en/scripts/7062-mymunzeemap
  24. // basedon: MunzeeMap by Nerjuz
  25. // basedon: https://greasyfork.org/en/scripts/4750-munzeemap
  26.  
  27. var isDebug = false;
  28. var intVerbosity = 0;
  29. const ver = '2019.07.23.1130';
  30. const scriptName = 'MunzeeMap Filter v' + ver;
  31. console.info( scriptName + ' loaded' );
  32.  
  33. function log( intV, strConsole, strLog, ...arrArgs ) {
  34. if ( intV === undefined ) { intV = 0; }
  35. if ( strConsole === undefined ) { strConsole = 'log'; }
  36. if ( strLog === undefined ) { strLog = '%o'; }
  37. if ( intVerbosity >= intV && ( strConsole === 'groupEnd' ) ) { console[ strConsole ](); }
  38. if ( intV === 0 || ( isDebug && intVerbosity >= intV ) ) { console[ strConsole ]( '[%i]: %s: ' + strLog, intV, scriptName, ...arrArgs ); }
  39. }
  40.  
  41. function toBoolean( val ) {
  42. const arrTrue = [ undefined, null, '', true, 'true', 1, '1', 'on', 'yes' ];
  43. val = ( typeof( val ) === 'string' ? val.toLowerCase() : val );
  44.  
  45. log( 4, 'log', 'toBoolean() is returning: %o', ( arrTrue.indexOf( val ) !== -1 ? true : false ) );
  46. return ( arrTrue.indexOf( val ) !== -1 ? true : false );
  47. }
  48.  
  49. const intParamsStart = ( document.URL.indexOf( '?' ) + 1 );
  50. const strParams = document.URL.substr( intParamsStart );
  51. const arrParamSets = strParams.split( '&' );
  52. var objParams = {};
  53. arrParamSets.forEach( function( strParam ) {
  54. let arrParam = strParam.split( '=' );
  55. let strParamName = ( arrParam[ 0 ].toLowerCase() || '' );
  56. if ( strParamName === 'verbosity' ) {
  57. isDebug = true;
  58. intVerbosity = ( arrParam[ 1 ] ? ( parseInt( arrParam[ 1 ] ) < 0 ? 0 : ( parseInt( arrParam[ 1 ] ) > 9 ? 9 : parseInt( arrParam[ 1 ] ) ) ) : 9 );
  59. } else if ( strParamName === 'debug' ) {
  60. isDebug = toBoolean( arrParam[ 1 ] );
  61. intVerbosity = 1;
  62. }
  63. } );
  64.  
  65. log( 1, 'warn', 'Debug mode is on with verbosity level: %o', intVerbosity );
  66. log( 1, 'groupCollapsed', 'Verbosity options: (click to expand)' );
  67. log( 1, 'log', '\n\t1) Summary\n\t2) Parameters retrieved from URL\n\t3) Variables set\n\t4) Function returns\n\t9) ALL debugging info and this notice.' );
  68. log( 1, 'groupEnd' );
  69.  
  70. const arrPhysicals = JSON.parse( GM_getResourceText( 'physicals' ) ).arrPhysicals;
  71. const arrBlastables = JSON.parse( GM_getResourceText( 'blastable' ) ).arrBlastables;
  72. const arrNonBlastables = JSON.parse( GM_getResourceText( 'noblast' ) ).arrNonBlastables;
  73. const arrPOI = JSON.parse( GM_getResourceText( 'POIs' ) ).arrPOI;
  74. const arrSpecials = JSON.parse( GM_getResourceText( 'special' ) ).arrSpecials;
  75. const arrRovers = JSON.parse( GM_getResourceText( 'rovers' ) ).arrRovers;
  76. const arrDestination = [ 'https://munzee.global.ssl.fastly.net/images/pins/hotel.png', 'https://munzee.global.ssl.fastly.net/images/pins/motel.png',
  77. 'https://munzee.global.ssl.fastly.net/images/pins/timesharemunzee.png', 'https://munzee.global.ssl.fastly.net/images/pins/virtual_resort.png' ];
  78. const arrTrail = [ 'https://munzee.global.ssl.fastly.net/images/pins/trail.png', 'https://munzee.global.ssl.fastly.net/images/pins/virtual_trail.png' ];
  79. var arrReported = ( !localStorage.getItem( 'MMF' ) ? [] : JSON.parse( localStorage.getItem( 'MMF' ) ).arrReported );
  80.  
  81. // $( '#footer' ).remove();
  82. $( 'head' ).append( $( '<style>' +
  83. '.v_blast { border: 2px inset #00FF00; }' +// green
  84. '.v_non { border: 2px inset #FF0000; }' +// red
  85. '.v_poi { border: 2px inset #EA6426; }' +// POI orange
  86. '.physical { border: 2px inset #330000; }' +// maroon
  87. '.rover { border: 2px double #006600; }' +// dark green
  88. '.v_special { border: 2px inset #FF00FF; }' +// Purple
  89. '.ico_show { background-color: #88FF88; }' +
  90. '.ico_hide { opacity: 0.4; background-color: #FF8888; border-style: outset; }' +
  91. '.reported { border-width: 3px; border-style: dashed dotted; border-color: #FFFF00; }' +// yellow
  92. '.unknown_type { border-width: 3px; border-style: dashed dotted; border-color: #FF0000; }' +// red
  93. '.filter_icon { padding: 0px 1px 0px 0px; }' +
  94. '.filter_icon > div { text-align: center; }' +
  95. '.filter_icon > img { height: 30px; cursor: pointer; border-radius: 5px; }' +
  96. '.filter_icon > img.img_hide { opacity: 0.4; }' +
  97. '#filterIcons { padding: 5px; background-color: #FFFFFF; }' +
  98. '#inputbar { background-color: #FFFFFF; top: 30px; border-top: 1px solid #FFFFFF; }' +
  99. '</style>' ) );
  100. $( '.panel.panel-default' ).css( 'margin-bottom', '0px' );
  101. $( '.row' ).css( 'margin', '0px' );
  102. $( '.panel-body' ).css( 'padding-left', '0px' ).css( 'padding-right', '0px' );
  103.  
  104. var inputbar = $( '#inputbar' );
  105. var filterButtons = $( '<br style="line-height: 3em;"><div id="filterButtons" class="btn-group" data-toggle="buttons">' +
  106. '<label class="btn btn-success"><input id="check_blastable" type="checkbox">hide blastable</label>' +
  107. '<br class="visible-xs">' +
  108. '<label class="btn btn-success"><input id="check_non_blastable" type="checkbox">hide non-blastable</label>' +
  109. '<br class="visible-xs">' +
  110. '<label class="btn btn-success"><input id="check_poi" type="checkbox">hide POI</label>' +
  111. '</div>' );
  112. inputbar.append( filterButtons );
  113. var filterIcons = $( '<div id="filterIcons"></div>' );
  114. inputbar.append( filterIcons );
  115.  
  116. var objAllMunzees = {};
  117. var iconCounter = {};
  118. var objAllIcons = {};
  119. var disabledIcons = [];
  120. var imgSRC = '';
  121.  
  122. function createfilter4Map( event, xhr, settings ) {
  123. var munzeeData = xhr.responseJSON;
  124. $.each( mapMarkers, function ( key, marker ) {
  125. $.each( munzeeData, function( box_key, element ) {
  126. if ( element.munzee_id == key ) {
  127. objAllMunzees[ key ] = element;
  128. }
  129. } );
  130. } );
  131.  
  132. iconCounter = {};
  133. filterIcons.empty();
  134.  
  135. //Collection
  136. for ( var munzeeID in mapMarkers ) {
  137. //img src
  138. imgSRC = mapMarkers[ munzeeID ]._element.style.backgroundImage.replace( 'url("', '' ).replace( '")', '' );
  139. let strType = imgSRC.split( '/' )[ imgSRC.split( '/' ).length - 1 ].split( '.' )[ 0 ];
  140.  
  141. if ( typeof iconCounter[ imgSRC ] == 'undefined' ) { iconCounter[ imgSRC ] = 1; }
  142. else { iconCounter[ imgSRC ]++; }
  143.  
  144. if ( objAllIcons[ strType ] === undefined ) { objAllIcons[ strType ] = []; }
  145. objAllIcons[ strType ].push( munzeeID );
  146. }
  147.  
  148. //Creation
  149. for ( imgSRC in iconCounter ) {
  150. var isReporter = ( !localStorage.getItem( 'MMF' ) ? null : JSON.parse( localStorage.getItem( 'MMF' ) ).isReporter );
  151. let strType = imgSRC.split( '/' )[ imgSRC.split( '/' ).length - 1 ].split( '.' )[ 0 ];
  152. let isPhysical = ( arrPhysicals.indexOf( imgSRC ) >= 0 ? true : false );
  153. let isBlastable = ( arrBlastables.indexOf( imgSRC ) >= 0 ? true : false );
  154. let isNonBlastable = ( arrNonBlastables.indexOf( imgSRC ) >= 0 ? true : false );
  155. let isPOI = ( arrPOI.indexOf( imgSRC ) >= 0 ? true : false );
  156. let isSpecial = ( arrSpecials.indexOf( imgSRC ) >= 0 ? true : false );
  157. let isVirtual = ( isNonBlastable || isBlastable || isPOI || isSpecial ? true : false );
  158. let isRover = ( arrRovers.indexOf( imgSRC ) >= 0 ? true : false );
  159. let isReported = ( arrReported.indexOf( imgSRC ) >= 0 ? true : false );
  160.  
  161. let arrDebug = arrDestination.concat( arrTrail );
  162. if ( arrDebug.indexOf( imgSRC ) >= 0 ) {
  163. console.log( 'Debugging: %o', objAllMunzees[ objAllIcons[ strType ][ 0 ] ] );
  164. }
  165.  
  166. if ( isPhysical || isVirtual || isRover || isReported ) {
  167. delete objAllIcons[ strType ];
  168. if ( isReported && ( isPhysical || isVirtual || isRover ) ) {
  169. arrReported = arrReported.splice( arrReported.indexOf( imgSRC ), 1 );
  170. localStorage.setItem( 'MMF', JSON.stringify( { isReporter: isReporter, arrReported: arrReported } ) );
  171. }
  172. }
  173.  
  174. /* console.log(
  175. 'Virtual: %s\tBlastable: %s\tPOI: %s\tSpecial: %s\tDisabled: %s\tType: %s',
  176. ( isVirtual ? 'yes' : ' no' ), ( isBlastable ? 'yes' : ' no' ),
  177. ( isPOI ? 'yes' : ' no' ), ( isSpecial ? 'yes' : ' no' ),
  178. ( disabledIcons.indexOf( imgSRC ) >= 0 ? 'yes' : ' no' ), strType );//*/
  179.  
  180. //new element
  181. filterIcons.append (
  182. '<div class="pull-left filter_icon">' +
  183. '<div>' + iconCounter[ imgSRC ] + '</div>' +
  184. '<img class="haideris ' + ( isRover ? 'rover ' : ( isVirtual ? ( isBlastable ? 'v_blast ' : 'v_non ' ) + ( isPOI ? 'v_poi ' : '' ) + ( isSpecial ? 'v_special ' : '' ) : ( isPhysical ? 'physical v_non ' : ( isReported ? 'reported ' : 'unknown_type ' ) ) ) ) + ( disabledIcons.indexOf( imgSRC ) >= 0 ? 'ico_hide' : 'ico_show' ) + '" src="' + imgSRC + '" />' +
  185. '</div>'
  186. );
  187. }
  188.  
  189. filterIcons.append( '<div style="clear: both; height: 1px; overflow: hidden;"></div>' );
  190.  
  191. updateMapIcons();
  192.  
  193. // Submit GitHub issue for unknown types
  194. var arrAllIconTypes = Object.keys( objAllIcons );
  195. var intAIT = arrAllIconTypes.length;
  196. if ( intAIT > 0 ) {
  197. if ( isReporter === null ) {
  198. let beReporter = confirm( scriptName + ' has detected types of Munzees that are not indexed.\n\n\tWould you like to report these to the script owner when found?\n\nSelect OK to report or Cancel to hide these alerts forever¹.' );
  199. localStorage.setItem( 'MMF', JSON.stringify( { isReporter: beReporter } ) );
  200. isReporter = beReporter;
  201. }
  202. if ( isReporter ) {
  203. let doReport = confirm( '[ "' + arrAllIconTypes.join( '", "' ) + '" ] ' + ( intAIT === 1 ? 'is an' : 'are' ) + ' unknown Munzee type' + ( intAIT === 1 ? '' : 's' ) + ' to ' + scriptName + '.\n\n\t\t\tWould you like to let the script writter know about ' + ( intAIT === 1 ? 'it' : 'them' ) + '?' );
  204. if ( doReport ) {
  205. var arrReporting = [];
  206. var strTitle = '?title=';
  207. var strBody = '&body=' + encodeURIComponent( 'Found unknown mapMarker types:' );
  208. for ( let intTypeIndex in arrAllIconTypes ) {
  209. let strType = arrAllIconTypes[ intTypeIndex ];
  210. let arrList = objAllIcons[ strType ];
  211. let strPinURL = objAllMunzees[ arrList[ 0 ] ].type_id;
  212. arrReporting.push( strPinURL );
  213. let strPinType = ( objAllMunzees[ arrList[ 0 ] ].is_virtual == 1 ? 'virtual' : 'physical' );
  214. strTitle += encodeURIComponent( 'Unknown ' + strPinType + ' type: ' + strType );
  215. strBody += '%0A%0A' + encodeURIComponent( strPinURL + ' is a ' + strPinType + ': ![' + strType + '](' + strPinURL + ')' );
  216. for ( var intMunzeeID in arrList ) {
  217. let munzeeID = arrList[ intMunzeeID ];
  218. // console.info( 'Created link for: %o', objAllMunzees[ munzeeID ] );
  219. let strMunzeeOwnerLink = '[' + objAllMunzees[ munzeeID ].user + '](https://www.munzee.com/m/' + objAllMunzees[ munzeeID ].user + ')';
  220. // console.log( 'strMunzeeOwnerLink: %o', strMunzeeOwnerLink );
  221. let strMunzeeLink = '[' + objAllMunzees[ munzeeID ].name + '](https://www.munzee.com/m/' + objAllMunzees[ munzeeID ].user + '/' + objAllMunzees[ munzeeID ].number + ')';
  222. // console.log( 'strMunzeeLink: %o', strMunzeeLink );
  223. let strGeoHash = geohash.encode( objAllMunzees[ munzeeID ].lat, objAllMunzees[ munzeeID ].lon, 9 );
  224. // console.log( 'strGeoHash: %o', strGeoHash );
  225. let strMapLink = '[' + objAllMunzees[ munzeeID ].lat + ', ' + objAllMunzees[ munzeeID ].lon + '](https://www.munzee.com/map/' + strGeoHash + '/20.0)';
  226. // console.log( 'strMapLink: %o', strMapLink );
  227. strBody += '%0A' + encodeURIComponent( '* ' + strMunzeeLink + ' at ' + strMapLink + ' by ' + strMunzeeOwnerLink );
  228. // console.log( '+strBody: %o', '%0A' + encodeURIComponent( '* ' + strMunzeeLink + ' at ' + strMapLink + ' by ' + strMunzeeOwnerLink ) );
  229. }
  230. }
  231. window.open( 'https://github.com/Technical-13/MunzeeMap-Filter/issues/new' + strTitle + strBody, '_blank', 'menubar=no,toolbar=no,location=no,status=no,width=1000' );
  232. arrReported = arrReported.concat( arrReporting );
  233. localStorage.setItem( 'MMF', JSON.stringify( { isReporter: isReporter, arrReported: arrReported } ) );
  234. } else {
  235. console.info( 'List of unknown types detected: %o', arrAllIconTypes );
  236. let stopReporting = confirm( 'Would you like me to continue asking you to report unknown types?\n\nSelect OK to ask in the future or Cancel to hide these alerts forever¹.' );
  237. localStorage.setItem( 'MMF', JSON.stringify( { isReporter: stopReporting } ) );
  238. }
  239. } else {
  240. console.info( 'List of unknown types detected:\n\t%o\nWould you like to be a reporter when unknown types are found? If so, use the following code here in the console:\n\nlocalStorage.setItem( \'MMF\', JSON.stringify( { isReporter: true } ) );', arrAllIconTypes );
  241. }
  242. }
  243. }
  244.  
  245. function updateMapIcons() {
  246. for ( var mID in mapMarkers ) {
  247. var curr = mapMarkers[ mID ]._element.style.backgroundImage.replace( 'url("', '' ).replace( '")', '' );
  248. if ( $.inArray( curr, disabledIcons ) == -1 ) { $( "[data-index='" + mID + "']" ).css( 'display', 'block' ); }
  249. else { $( "[data-index='" + mID + "']" ).css( 'display', 'none' ); }
  250. }
  251. }
  252.  
  253. // hide
  254. $( document ).on( 'click', '.ico_show.haideris', function ( e ) {
  255. var curr = $( this ).attr( 'src' );
  256.  
  257. if ( e.ctrlKey ) {
  258. var icons = document.querySelectorAll( '.haideris' );
  259. // console.log( 'icons: %o', icons );
  260. disabledIcons = [];
  261. for ( var ic in iconCounter ) {
  262. if ( ic != curr ) { disabledIcons.push( ic ); }
  263. }
  264. // console.log( 'disabledIcons: %o', disabledIcons );
  265.  
  266. for ( var i in icons ) {
  267. // console.log( 'icons[ i ] is a: %o', typeof( icons[ i ] ) );
  268. if ( typeof( icons[ i ] ) === 'object' ) {
  269. let intIcoShowHide = -1;
  270. let strNewClass = Array.from( icons[ i ].classList );
  271. // console.log( 'Testing if `%o` != `%o`: %s', icons[ i ].src, curr, ( icons[ i ].src != curr ? 'NOT ' : '') + 'equal' );
  272. if ( icons[ i ].src != curr ) {
  273. intIcoShowHide = strNewClass.indexOf( 'ico_show' );
  274. strNewClass[ intIcoShowHide ] = 'ico_hide';
  275. } else {
  276. intIcoShowHide = strNewClass.indexOf( 'ico_hide' );
  277. strNewClass[ intIcoShowHide ] = 'ico_show';
  278. }
  279. strNewClass = strNewClass.join( ' ' );
  280. // console.log( 'Replacing classList %o with string `%s`', icons[ i ].classList, strNewClass );
  281. icons[ i ].className = strNewClass;
  282. }
  283. }
  284. }
  285. else {
  286. $( this ).removeClass( 'ico_show' ).addClass( 'ico_hide' );
  287. if ( disabledIcons.indexOf( curr ) == -1 ) { disabledIcons.push( curr ); }
  288. }
  289. updateMapIcons();
  290. } );
  291.  
  292. // show
  293. $( document ).on( 'click', '.ico_hide.haideris', function ( e ) {
  294. var curr = $( this ).attr( 'src' );
  295.  
  296. if ( e.ctrlKey ) {
  297. var icons = document.querySelectorAll( '.haideris' );
  298. // console.log( 'icons: %o', icons );
  299. disabledIcons = [];
  300. for ( var ic in iconCounter ) {
  301. if ( ic == curr ) { disabledIcons.push( ic ); }
  302. }
  303. // console.log( 'disabledIcons: %o', disabledIcons );
  304.  
  305. for ( var i in icons ) {
  306. // console.log( 'icons[ i ] is a: %o', typeof( icons[ i ] ) );
  307. if ( typeof( icons[ i ] ) === 'object' ) {
  308. let intIcoShowHide = -1;
  309. let strNewClass = Array.from( icons[ i ].classList );
  310. // console.log( 'Testing if `%o` != `%o`: %s', icons[ i ].src, curr, ( icons[ i ].src != curr ? 'NOT ' : '') + 'equal' );
  311. if ( icons[ i ].src != curr ) {
  312. intIcoShowHide = strNewClass.indexOf( 'ico_hide' );
  313. strNewClass[ intIcoShowHide ] = 'ico_show';
  314. } else {
  315. intIcoShowHide = strNewClass.indexOf( 'ico_show' );
  316. strNewClass[ intIcoShowHide ] = 'ico_hide';
  317. }
  318. strNewClass = strNewClass.join( ' ' );
  319. // console.log( 'Replacing classList %o with string `%s`', icons[ i ].classList, strNewClass );
  320. icons[ i ].className = strNewClass;
  321. }
  322. }
  323. }
  324. else {
  325. $( this ).removeClass( 'ico_hide' ).addClass( 'ico_show' );
  326. var index = disabledIcons.indexOf( curr );
  327. if ( index !== -1 ) { disabledIcons.splice( index, 1 ); }
  328. }
  329. updateMapIcons();
  330. } );
  331.  
  332. function toggleAction( target ) {
  333. let isChecked = target.checked;
  334. let strOldAction = ( isChecked ? 'hide' : 'show' );
  335. let strNewAction = ( isChecked ? 'show' : 'hide' );
  336. $( target ).parent().html( $( target ).parent().html().replace( strOldAction, strNewAction ) );
  337. }
  338.  
  339. // blastable
  340. $( document ).on( 'change', '#check_blastable', function( e ) {
  341. toggleAction( e.target );
  342. for ( var intCurr in arrBlastables ) {
  343. var curr = arrBlastables[ intCurr ];
  344. // console.log( '%d:%s: %o', intCurr, curr, arrBlastables );
  345.  
  346. if ( e.target.checked ) {
  347. // console.log( 'Hiding: %o', curr );
  348. $( '.v_blast.ico_show.haideris' ).removeClass( 'ico_show' ).addClass( 'ico_hide' );
  349. if ( disabledIcons.indexOf( curr ) == -1 ) { disabledIcons.push( curr ); }
  350. } else {
  351. // console.log( 'Showing: %o', curr );
  352. $( '.v_blast.ico_hide.haideris' ).removeClass( 'ico_hide' ).addClass( 'ico_show' );
  353. var index = disabledIcons.indexOf( curr );
  354. if ( index !== -1 ) { disabledIcons.splice( index, 1 ); }
  355. }
  356. }
  357. updateMapIcons();
  358. } );
  359.  
  360. // non-blastable
  361. $( document ).on( 'change', '#check_non_blastable', function( e ) {
  362. toggleAction( e.target );
  363. if ( $( '#check_poi' )[ 0 ].parentNode.innerText.indexOf( 'show' ) !== -1 ) {
  364. if ( !e.target.checked ) {
  365. $( '#check_poi' ).click();
  366. }
  367. } else if ( e.target.checked ) {
  368. $( '#check_poi' ).click();
  369. }
  370. var arrAllNonBlastables = arrNonBlastables.concat( arrPOI, arrPhysicals, arrRovers );
  371. for ( var intCurr in arrAllNonBlastables ) {
  372. var curr = arrAllNonBlastables[ intCurr ];
  373. // console.log( '%d:%s: %o', intCurr, curr, arrBlastables );
  374.  
  375. if ( e.target.checked ) {
  376. // console.log( 'Hiding: %o', curr );
  377. $( '.v_non.ico_show.haideris' ).removeClass( 'ico_show' ).addClass( 'ico_hide' );
  378. if ( disabledIcons.indexOf( curr ) == -1 ) { disabledIcons.push( curr ); }
  379. } else {
  380. // console.log( 'Showing: %o', curr );
  381. $( '.v_non.ico_hide.haideris' ).removeClass( 'ico_hide' ).addClass( 'ico_show' );
  382. var index = disabledIcons.indexOf( curr );
  383. if ( index !== -1 ) { disabledIcons.splice( index, 1 ); }
  384. }
  385. }
  386. updateMapIcons();
  387. } );
  388.  
  389. // POIs
  390. $( document ).on( 'change', '#check_poi', function( e ) {
  391. toggleAction( e.target );
  392. for ( var intCurr in arrPOI ) {
  393. var curr = arrPOI[ intCurr ];
  394. // console.log( '%d:%s: %o', intCurr, curr, arrBlastables );
  395.  
  396. if ( e.target.checked ) {
  397. // console.log( 'Hiding: %o', curr );
  398. $( '.v_poi.ico_show.haideris' ).removeClass( 'ico_show' ).addClass( 'ico_hide' );
  399. if ( disabledIcons.indexOf( curr ) == -1 ) { disabledIcons.push( curr ); }
  400. } else {
  401. // console.log( 'Showing: %o', curr );
  402. $( '.v_poi.ico_hide.haideris' ).removeClass( 'ico_hide' ).addClass( 'ico_show' );
  403. var index = disabledIcons.indexOf( curr );
  404. if ( index !== -1 ) { disabledIcons.splice( index, 1 ); }
  405. }
  406. }
  407. updateMapIcons();
  408. } );
  409.  
  410. $( document ).ajaxSuccess( createfilter4Map );