From 05903c90db3ed9b77d8c05e1959bfe34c040d36b Mon Sep 17 00:00:00 2001 From: Peter Dietrich Date: Fri, 7 Jun 2013 03:33:37 +0300 Subject: [PATCH 001/104] Required update to work with latest version of IPAS Adjustments in passing of the shields, to comply with "old" and "new" shields --- plugins/ipas-link.user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/ipas-link.user.js b/plugins/ipas-link.user.js index 682f3083..20610a9c 100644 --- a/plugins/ipas-link.user.js +++ b/plugins/ipas-link.user.js @@ -45,10 +45,18 @@ window.plugin.ipasLink.getHash = function (d) { hashParts = []; $.each(d.portalV2.linkedModArray, function (ind, mod) { //shields only, so far... + var modCodes={ + c: "cs", + r: "rs", + v: "vrs" + }; + var s = "0"; if (mod) { if (mod.type === "RES_SHIELD") { s = mod.rarity.charAt(0).toLowerCase(); + s=modCodes[s]; + s = s + mod.stats.MITIGATION; } } hashParts.push(s); From 508c2543f41a9c692848104af4f77e074078bc5c Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 7 Jun 2013 05:35:18 +0100 Subject: [PATCH 002/104] only clear and refresh past chat messages if the bounding box has changed by over 10% - reduces network requests for chat data after small map movements --- code/chat.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/code/chat.js b/code/chat.js index 2f029556..dabc3685 100644 --- a/code/chat.js +++ b/code/chat.js @@ -41,16 +41,22 @@ window.chat._oldBBox = null; window.chat.genPostData = function(isFaction, storageHash, getOlderMsgs) { if(typeof isFaction !== 'boolean') throw('Need to know if public or faction chat.'); + // get window bounds, and extend to the minimum chat radius chat._localRangeCircle.setLatLng(map.getCenter()); var b = map.getBounds().extend(chat._localRangeCircle.getBounds()); - var ne = b.getNorthEast(); - var sw = b.getSouthWest(); - // round bounds in order to ignore rounding errors - var bbs = $.map([ne.lat, ne.lng, sw.lat, sw.lng], function(x) { return Math.round(x*1E4) }).join(); - if(chat._oldBBox && chat._oldBBox !== bbs) { + // set a current bounding box if none set so far + if (!chat._oldBBox) chat._oldBBox = b; + + // to avoid unnecessary chat refreshes, a small difference compared to the previous bounding box + // is not considered different + var CHAT_BOUNDINGBOX_SAME_FACTOR = 0.1; + // if the old and new box contain each other, after expanding by the factor, don't reset chat + if (!(b.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(chat._oldBBox) && chat._oldBBox.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(b))) { + console.log('Bounding Box changed, chat will be cleared (old: '+chat._oldBBox.toBBoxString()+'; new: '+b.toBBoxString()+')'); + $('#chat > div').data('needsClearing', true); - console.log('Bounding Box changed, chat will be cleared (old: '+chat._oldBBox+' ; new: '+bbs+' )'); + // need to reset these flags now because clearing will only occur // after the request is finished – i.e. there would be one almost // useless request. @@ -61,8 +67,9 @@ window.chat.genPostData = function(isFaction, storageHash, getOlderMsgs) { chat._public.data = {}; chat._public.oldestTimestamp = -1; chat._public.newestTimestamp = -1; + + chat._oldBBox = b; } - chat._oldBBox = bbs; var ne = b.getNorthEast(); var sw = b.getSouthWest(); From ffbf82a44eef818dca66be14a6d7023f10803898 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 7 Jun 2013 17:49:10 +0100 Subject: [PATCH 003/104] updated bookmarks plugin, as submitted by the author with stylesheet fixes (some non-standard indentation at the moment though) --- plugins/bookmarks-by-zaso.css | 624 +++++++++++++++-------------- plugins/bookmarks-by-zaso.user.js | 646 +++++++++++++++--------------- 2 files changed, 637 insertions(+), 633 deletions(-) diff --git a/plugins/bookmarks-by-zaso.css b/plugins/bookmarks-by-zaso.css index d15231bd..9ce13c7e 100644 --- a/plugins/bookmarks-by-zaso.css +++ b/plugins/bookmarks-by-zaso.css @@ -1,368 +1,380 @@ -#bookmarksBox * { - display: block; - width: auto; - height: auto; - font-family: Verdana,Geneva,sans-serif; - font-size: 13px; - line-height: 22px; - text-indent: 0; - text-decoration: none; - margin: 0; - padding: 0; + +#bookmarksBox *{ + display:block; + padding:0; + margin:0; + width:auto; + height:auto; + font-family:Verdana, Geneva, sans-serif; + font-size:13px; + line-height:22px; + text-indent:0; + text-decoration:none; } -#bookmarksBox { - margin-top: -100%; - position: absolute!important; - z-index: 4001; - top: 100px; - left: 100px; + +#bookmarksBox{ + margin-top:-100%; + position:absolute !important; + z-index:4001; + top:100px; + left:100px; +} +#bookmarksBox .addForm, +#bookmarksBox #bookmarksTypeBar, +#bookmarksBox h5{ + height:28px; + overflow:hidden; + color:#fff; + font-size:14px; } -#bookmarksBox .addForm,#bookmarksBox #bookmarksTypeBar,#bookmarksBox h5 { - height: 28px; - overflow: hidden; - color: #fff; - font-size: 14px; + +#bookmarksBox #topBar, +#bookmarksBox #topBar *{ + height:15px !important; } -#bookmarksBox #topBar,#bookmarksBox #topBar * { - height: 15px!important; +#bookmarksBox #topBar *{ + float:left !important; +} +#bookmarksBox .handle{ + text-indent:-20px; + width:209px; + text-align:center; + color:#fff; + line-height:8px; + cursor:move; } -#bookmarksBox #topBar * { - float: left!important; +#bookmarksBox #topBar .btn{ + display:block; + width:19px; + cursor:pointer; + color:#20a8b1; +} +#bookmarksBox #topBar #bookmarksMin{ + font-weight:bold; + text-align:center; + line-height:14px; + font-size:18px; +} +#bookmarksBox #topBar #bookmarksMin:hover{ + color:gold; } -#bookmarksBox .handle { - text-indent: -20px; - width: 209px; - text-align: center; - color: #fff; - line-height: 8px; - cursor: move; +#bookmarksBox #bookmarksTypeBar{ + clear:both; } -#bookmarksBox #topBar .btn { - display: block; - width: 19px; - cursor: pointer; - color: #20a8b1; +#bookmarksBox h5{ + padding:4px 0; + width:114px; + text-align:center; + color:#788; } -#bookmarksBox #topBar #bookmarksMin { - font-weight: 700; - text-align: center; - line-height: 14px; - font-size: 18px; +#bookmarksBox h5.current{ + cursor:default; + background:none; + color:#fff !important; +} +#bookmarksBox h5:hover{ + color:gold; + background:rgba(0,0,0,0); } -#bookmarksBox #topBar #bookmarksMin: hover { - color: #FFD700; +#bookmarksBox #topBar .btn, +#bookmarksBox .addForm, +#bookmarksBox .handle, +#bookmarksBox #bookmarksTypeBar, +#bookmarksBox .bookmarkList li.bookmarksEmpty, +#bookmarksBox .bookmarkList li.bkmrk a, +#bookmarksBox .bookmarkList li.bkmrk:hover{ + background-color:rgba(8,48,78,.85); } -#bookmarksBox #bookmarksTypeBar { - clear: both; +#bookmarksBox h5, +#bookmarksBox .bookmarkList li.bkmrk:hover .bookmarksLink, +#bookmarksBox .addForm *{ + background:rgba(0,0,0,.3); } -#bookmarksBox h5 { - width: 114px; - text-align: center; - color: #788; - padding: 4px 0; +#bookmarksBox .addForm *{ + display:block; + float:left; + padding:4px 8px 3px; } -#bookmarksBox h5.current { - cursor: default; - background: 0; - color: #fff!important; +#bookmarksBox .addForm a{ + cursor:pointer; + color:#20a8b1; + font-size:12px; + width:65px; + text-align:center; + line-height:20px; + padding:4px 0 3px; } -#bookmarksBox h5: hover { - color: #FFD700; - background: rgba(0,0,0,0); +#bookmarksBox .addForm a:hover{ + background:gold; + color:#000; + text-decoration:none; } -#bookmarksBox #topBar .btn,#bookmarksBox .addForm,#bookmarksBox .handle,#bookmarksBox #bookmarksTypeBar,#bookmarksBox .bookmarkList li.bookmarksEmpty,#bookmarksBox .bookmarkList li.bkmrk a,#bookmarksBox .bookmarkList li.bkmrk: hover { - background-color: rgba(8,48,78,.85); +#bookmarksBox .addForm input{ + font-size:11px !important; + color:#ffce00; + width:81px; + line-height:11px; + font-size:12px; + -webkit-box-sizing:content-box; + -moz-box-sizing:content-box; + box-sizing:content-box; } -#bookmarksBox h5,#bookmarksBox .bookmarkList li.bkmrk: hover .bookmarksLink,#bookmarksBox .addForm * { - background: rgba(0,0,0,.3); +#bookmarksBox #bkmrk_portals .addForm input{ + width:147px; } -#bookmarksBox .addForm * { - display: block; - float: left; - padding: 4px 8px 3px; +#bookmarksBox .addForm input:hover, +#bookmarksBox .addForm input:focus{ + outline:0; + background:rgba(0,0,0,.6); } -#bookmarksBox .addForm a { - cursor: pointer; - color: #20a8b1; - font-size: 12px; - width: 65px; - text-align: center; - line-height: 20px; - padding: 4px 0 3px; +#bookmarksBox .bookmarkList > ul{ + width:231px; + clear:both; + list-style-type:none; + color:#fff; + overflow:hidden; + max-height:550px; } -#bookmarksBox .addForm a: hover { - background: #FFD700; - color: #000; - text-decoration: none; +#bookmarksBox .sortable-placeholder{ + background:rgba(8,48,78,.55); + box-shadow:inset 1px 0 0 #20a8b1; +} +#bookmarksBox .ui-sortable-helper{ + border-top-width:1px; } -#bookmarksBox .addForm input { - font-size: 11px!important; - color: #ffce00; - width: 81px; - line-height: 11px; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; +#bookmarksBox .bookmarkList{ display:none; } +#bookmarksBox .bookmarkList.current{ display:block; } + +#bookmarksBox h5, +#bookmarksBox .addForm *, +#bookmarksBox ul li.bkmrk, +#bookmarksBox ul li.bkmrk a{ + height:22px; } -#bookmarksBox #bkmrk_portals .addForm input { - width: 147px; +#bookmarksBox h5, +#bookmarksBox ul li.bkmrk a{ + overflow:hidden; + cursor:pointer; + float:left; +} +#bookmarksBox ul .bookmarksEmpty{ text-indent:27px; color:#eee; } +#bookmarksBox ul .bookmarksRemoveFrom{ width:19px; text-align:center; color:#fff; } +#bookmarksBox ul .bookmarksLink{ width:171px; padding:0 10px 0 8px; color:gold; } +#bookmarksBox ul .bookmarksLink.selected{ color:#03fe03; } +#bookmarksBox ul .othersBookmarks .bookmarksLink{ width:190px; } + +#bookmarksBox ul .bookmarksLink:hover{ color:#03fe03; } +#bookmarksBox ul .bookmarksRemoveFrom:hover{ color:#fff; background:#e22; } + +/************************************/ + +#bookmarksBox, +#bookmarksBox * +{ border-color:#20a8b1; border-style:solid; border-width:0; } + +#bookmarksBox #topBar +, #bookmarksBox ul .bookmarkFolder +{ border-top-width:1px; } + +#bookmarksBox #topBar +, #bookmarksBox #bookmarksTypeBar +, #bookmarksBox .addForm +, #bookmarksBox ul .bookmarkFolder .folderLabel +, #bookmarksBox ul li.bkmrk +{ border-bottom-width:1px; } + +#bookmarksBox ul .bookmarkFolder +, #bookmarksBox ul .bookmarksRemoveFrom +{ border-right-width:1px; border-left-width:1px; } + +#bookmarksBox #topBar * +, #bookmarksBox #bookmarksTypeBar * +, #bookmarksBox .addForm * +{ border-left-width:1px; } + +#bookmarksBox #topBar +, #bookmarksBox #bookmarksTypeBar +, #bookmarksBox .addForm +{ border-right-width:1px; } + +#bookmarksBox ul .othersBookmarks .bookmarksRemoveFrom +, #bookmarksBox ul .bookmarkFolder .folderLabel .bookmarksRemoveFrom +{ border-left-width:0px; } + +/************************************/ + +#bookmarksShow{ + display:block; + position:absolute; + top:0; + left:250px; + width:47px; + margin-top:-36px; + height:64px; + cursor:pointer; + z-index:4005; + + background-position:center bottom; + background-repeat:no-repeat; + transition:margin-top 100ms ease-in-out; + background-image:url(@@INCLUDEIMAGE:plugins/bookmarks-by-zaso-logo.png@@); +} +#bookmarksShow:hover{ + margin-top:0px !important; } -#bookmarksBox .addForm input: hover,#bookmarksBox .addForm input: focus { - outline: 0; - background: rgba(0,0,0,.6); +#bookmarkStar{ + display:inline-block; + position:relative; + top:1px; + margin-right:3px; + width:16px; + height:15px; + overflow:hidden; + background-image:url(@@INCLUDEIMAGE:plugins/bookmarks-by-zaso-star.png@@); + background-position:left center; + background-repeat:no-repeat; +} +#bookmarkStar:hover, +#bookmarkStar.favorite{ + background-position:right center; } -#bookmarksBox .bookmarkList>ul { - width: 231px; - clear: both; - list-style-type: none; - color: #fff; - overflow: hidden; - max-height: 550px; +#bookmarksBox .handleScroll{ + cursor:s-resize; + width:3px; + right:3px; + background:gold; + opacity:.7; } -#bookmarksBox .sortable-placeholder { - background: rgba(8,48,78,.55); - box-shadow: inset 1px 0 0 #20a8b1; +/************************************/ + +#bookmarksBox .bookmarkList .bookmarkFolder{ + overflow:hidden; + margin-top:-1px; + height:auto; + background:rgba(8,58,78,.7); } -#bookmarksBox .bookmarkList { - display: none; +#bookmarksBox .bookmarkList ul li.sortable-placeholder{ + box-shadow:inset -1px 0 0 #20a8b1, inset 1px 0 0 #20a8b1, 0 -1px 0 #20a8b1; + background:rgba(8,58,78,.9); } -#bookmarksBox h5,#bookmarksBox .addForm *,#bookmarksBox ul li.bkmrk,#bookmarksBox ul li.bkmrk a { - height: 22px; +#bookmarksBox .bookmarkList .bkmrk.ui-sortable-helper{ + border-right-width:1px; + border-left-width:1px; +} +#bookmarksBox .bookmarkList ul li ul li.sortable-placeholder{ + height:23px; + box-shadow:inset 0 -1px 0 #20a8b1, inset 1px 0 0 #20a8b1; } -#bookmarksBox h5,#bookmarksBox ul li.bkmrk a { - overflow: hidden; - cursor: pointer; - float: left; +#bookmarksBox .bookmarkList ul li.bookmarkFolder.ui-sortable-helper, +#bookmarksBox .bookmarkList ul li.othersBookmarks ul, +#bookmarksBox .bookmarkList ul li.othersBookmarks ul li.sortable-placeholder{ + box-shadow:inset 0 -1px 0 #20a8b1; } -#bookmarksBox ul .bookmarksEmpty { - text-indent: 27px; - color: #eee; +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span, +#bookmarksBox .bookmarkList .triangle{ + width:0px; + height:0px; } -#bookmarksBox ul .bookmarksRemoveFrom { - width: 19px; - text-align: center; - color: #fff; +/************************************/ + +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel{ + overflow:visible; + height:25px; + cursor:pointer; + background:#069; + text-indent:0px; +} +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > *{ + height:25px; + float:left; +} +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor{ + line-height:25px; + color:#fff; + width:209px; +} +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{ + float:left; + border-width:5px 0 5px 7px; + border-color:transparent transparent transparent white; + margin:7px 7px 0 6px; +} +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel .bookmarksAnchor span{ + margin:9px 5px 0 5px; + border-width:7px 5px 0 5px; + border-color:white transparent transparent transparent; } -#bookmarksBox ul .bookmarksLink { - width: 171px; - color: #FFD700; - padding: 0 10px 0 8px; +/************************************************************************************************************/ + +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ + display:none; + border-width:0px 12px 10px 0; + border-color:transparent #20a8b1 transparent transparent; + margin:-20px 0 0; + position:relative; + top:21px; + left:219px; +} +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ + top:18px; + left:0px; + border-width:0px 10px 9px 0; + border-color:transparent #069 transparent transparent; +} +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel > span, +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel > span > span{ + display:block; +} +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel:hover > span > span{ + border-color:transparent #036 transparent transparent; } -#bookmarksBox ul .othersBookmarks .bookmarksLink { - width: 190px; +/************************************************************************************************************/ + +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel:hover .bookmarksAnchor{ + background:#036; } -#bookmarksBox ul .bookmarksRemoveFrom: hover { - color: #fff; - background: #e22; +#bookmarksBox .bookmarkList .bookmarkFolder ul{ + display:none; + margin-left:19px; +} +#bookmarksBox .bookmarkList .bookmarkFolder.active ul{ + display:block; + min-height:22px; } -#bookmarksBox,#bookmarksBox * { - border-color: #20a8b1; - border-style: solid; - border-width: 0; -} - -#bookmarksBox #topBar,#bookmarksBox #bookmarksTypeBar,#bookmarksBox .addForm,#bookmarksBox ul .bookmarkFolder .folderLabel,#bookmarksBox ul li.bkmrk { - border-bottom-width: 1px; -} - -#bookmarksBox #topBar *,#bookmarksBox #bookmarksTypeBar *,#bookmarksBox .addForm * { - border-left-width: 1px; -} - -#bookmarksBox #topBar,#bookmarksBox #bookmarksTypeBar,#bookmarksBox .addForm { - border-right-width: 1px; -} - -#bookmarksBox ul .othersBookmarks .bookmarksRemoveFrom,#bookmarksBox ul .bookmarkFolder .folderLabel .bookmarksRemoveFrom { - border-left-width: 0; -} - -#bookmarksShow { - display: block; - position: absolute; - top: 0; - left: 250px; - width: 47px; - margin-top: -100%; - height: 64px; - cursor: pointer; - z-index: 4005; - background-position: center bottom; - background-repeat: no-repeat; - transition: margin-top 100ms ease-in-out; - background-image: url(@@INCLUDEIMAGE:plugins/bookmarks-by-zaso-logo.png@@); -} - -#bookmarksShow: hover { - margin-top: 0!important; -} - -#bookmarkStar { - display: inline-block; - position: relative; - top: 1px; - margin-right: 3px; - width: 16px; - height: 15px; - overflow: hidden; - background-image: url(@@INCLUDEIMAGE:plugins/bookmarks-by-zaso-star.png@@); - background-position: left center; - background-repeat: no-repeat; -} - -#bookmarkStar: hover,#bookmarkStar.favorite { - background-position: right center; -} - -#bookmarksBox .handleScroll { - cursor: s-resize; - width: 3px; - right: 3px; - background: #FFD700; - opacity: .7; -} - -#bookmarksBox .bookmarkList .bookmarkFolder { - overflow: hidden; - margin-top: -1px; - height: auto; - background: rgba(8,58,78,.7); -} - -#bookmarksBox .bookmarkList ul li.sortable-placeholder { - box-shadow: inset -1px 0 0 #20a8b1,inset 1px 0 0 #20a8b1,0 -1px 0 #20a8b1; - background: rgba(8,58,78,.9); -} - -#bookmarksBox .bookmarkList ul li ul li.sortable-placeholder { - height: 23px; - box-shadow: inset 0 -1px 0 #20a8b1,inset 1px 0 0 #20a8b1; -} - -#bookmarksBox .bookmarkList ul li.bookmarkFolder.ui-sortable-helper,#bookmarksBox .bookmarkList ul li.othersBookmarks ul,#bookmarksBox .bookmarkList ul li.othersBookmarks ul li.sortable-placeholder { - box-shadow: inset 0 -1px 0 #20a8b1; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span,#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span,#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span,#bookmarksBox .bookmarkList .triangle { - width: 0; - height: 0; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel { - overflow: visible; - height: 25px; - cursor: pointer; - background: #069; - text-indent: 0; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>* { - height: 25px; - float: left; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor { - line-height: 25px; - color: #fff; - width: 209px; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span { - float: left; - border-color: transparent transparent transparent #FFF; - border-width: 5px 0 5px 7px; - margin: 7px 7px 0 6px; -} - -#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel .bookmarksAnchor span { - border-color: #FFF transparent transparent; - border-width: 7px 5px 0; - margin: 9px 5px 0; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span,#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span { - display: none; - position: relative; - top: 21px; - left: 219px; - border-color: transparent #20a8b1 transparent transparent; - border-width: 0 12px 10px 0; - margin: -20px 0 0; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span { - top: 18px; - left: 0; - border-color: transparent #069 transparent transparent; - border-width: 0 10px 9px 0; -} - -#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel: hover>span>span { - border-color: transparent #036 transparent transparent; -} - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel: hover .bookmarksAnchor { - background: #036; -} - -#bookmarksBox .bookmarkList .bookmarkFolder ul { - display: none; - margin-left: 19px; -} - -#bookmarksBox .bookmarkList .bookmarkFolder.active ul { - display: block; - min-height: 22px; -} - -#bookmarksBox .bookmarkFolder.othersBookmarks ul { - margin-left: 0; -} - -#bookmarksBox .ui-sortable-helper,#bookmarksBox #topBar,#bookmarksBox ul .bookmarkFolder { - border-top-width: 1px; -} - -#bookmarksBox .bookmarkList.current,#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel>span,#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel>span>span { - display: block; -} - -#bookmarksBox ul .bookmarksLink.selected,#bookmarksBox ul .bookmarksLink: hover { - color: #03fe03; -} - -#bookmarksBox ul .bookmarkFolder,#bookmarksBox ul .bookmarksRemoveFrom,#bookmarksBox .bookmarkList .bkmrk.ui-sortable-helper { - border-right-width: 1px; - border-left-width: 1px; -} +#bookmarksBox .bookmarkFolder.othersBookmarks ul{ + margin-left:0; +} \ No newline at end of file diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index df6c715e..75142533 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -5,384 +5,376 @@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ -// @description [@@BUILDNAME@@-@@BUILDDATE@@] Save your favorite Maps and Portals. +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Save your favorite Maps and Portals and move the intelmap view in a second. The ingress world just a click. // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* // @match http://www.ingress.com/intel* // ==/UserScript== -function wrapper() { -// ensure plugin framework is there, even if iitc is not yet loaded -if(typeof window.plugin !== 'function') window.plugin = function() {}; +function wrapper(){ + // 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.bookmarks = function(){}; -// PLUGIN START //////////////////////////////////////////////////////// + window.plugin.bookmarks.KEY_OTHER_BKMRK = 'idOthers'; + window.plugin.bookmarks.LOCAL_STORAGE_status_box = 'plugin-bookmarks-status-box'; + window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_portals = 'plugin-bookmarks-portals-data'; + window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_maps = 'plugin-bookmarks-maps-data'; + window.plugin.bookmarks.bkmrk_portals = {}; + window.plugin.bookmarks.bkmrk_maps = {}; -// use own namespace for plugin -window.plugin.bookmarks = function() {}; - -window.plugin.bookmarks.KEY_OTHER_BKMRK = 'idOthers'; -window.plugin.bookmarks.LOCAL_STORAGE_status_box = 'plugin-bookmarks-status-box'; -window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_portals = 'plugin-bookmarks-portals-data'; -window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_maps = 'plugin-bookmarks-maps-data'; - -window.plugin.bookmarks.bkmrk_portals = {}; -window.plugin.bookmarks.bkmrk_maps = {}; - -window.plugin.bookmarks.disabledMessage; -window.plugin.bookmarks.contentStarHTML; -window.plugin.bookmarks.bkmrkBox; -window.plugin.bookmarks.bkmrkRibbon; -window.plugin.bookmarks.loadList; -window.plugin.bookmarks.setupJS; + window.plugin.bookmarks.disabledMessage; + window.plugin.bookmarks.contentStarHTML; + window.plugin.bookmarks.bkmrkBox; + window.plugin.bookmarks.bkmrkRibbon; + window.plugin.bookmarks.loadList; + window.plugin.bookmarks.setupJS; /***************************************************************************************************************************************************************/ -window.plugin.bookmarks.addStarToSidebar = function() { - if(typeof(Storage) === "undefined") { $('#portaldetails > .imgpreview').after(plugin.bookmarks.disabledMessage); return; } - var title = $('#portaldetails > h3').text(); - $('#portaldetails > h3').html(plugin.bookmarks.contentStarHTML+title); - plugin.bookmarks.updateStarPortal(); -} -window.plugin.bookmarks.updateStarPortal = function() { - window.plugin.bookmarks.loadBookmarks('bkmrk_portals'); - var guid = window.selectedPortal; - var list = plugin.bookmarks['bkmrk_portals']; - $('#bookmarkStar').removeClass('favorite'); - $('.bkmrk a.bookmarksLink.selected').removeClass('selected'); - for(var idFolders in list) { - for(var idBkmrk in list[idFolders]['bkmrk']) { - var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; - if(guid == portalGuid) { - $('#bookmarkStar').addClass('favorite'); - $('.bkmrk#'+idBkmrk+' a.bookmarksLink').addClass('selected'); - } - } - } -} -window.plugin.bookmarks.switchStarPortal = function() { - var guid = window.selectedPortal; + window.plugin.bookmarks.addStarToSidebar = function(){ + if(typeof(Storage) === "undefined"){ $('#portaldetails > .imgpreview').after(plugin.bookmarks.disabledMessage); return; } + var title = $('#portaldetails > h3').text(); + $('#portaldetails > h3').html(plugin.bookmarks.contentStarHTML+title); + plugin.bookmarks.updateStarPortal(); + } + window.plugin.bookmarks.updateStarPortal = function(){ + window.plugin.bookmarks.loadBookmarks('bkmrk_portals'); + var guid = window.selectedPortal; + var list = plugin.bookmarks['bkmrk_portals']; + $('#bookmarkStar').removeClass('favorite'); + $('.bkmrk a.bookmarksLink.selected').removeClass('selected'); - if($('#bookmarkStar').hasClass('favorite')) { - var list = plugin.bookmarks['bkmrk_portals']; + //If current portal is into bookmarks: select bookmark portal from portals list and select the star in sideabar + for(var idFolders in list){ + for(var idBkmrk in list[idFolders]['bkmrk']){ + var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; + if(guid == portalGuid){ + $('#bookmarkStar').addClass('favorite'); + $('.bkmrk#'+idBkmrk+' a.bookmarksLink').addClass('selected'); + } + } + } + } + window.plugin.bookmarks.switchStarPortal = function(){ + var guid = window.selectedPortal; - for(var idFolders in list) { - for(var idBkmrk in list[idFolders]['bkmrk']) { - var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; - if(guid == portalGuid) { - delete list[idFolders]['bkmrk'][idBkmrk]; - $('.bkmrk#'+idBkmrk+'').remove(); - } - } - } - } - else { - var linka = $('#portaldetails .linkdetails aside a:contains("Portal link")').attr('href'); - var namePortal = $('#portaldetails h3').text(); + //Remove portal from bookmarks + if($('#bookmarkStar').hasClass('favorite')){ + var list = plugin.bookmarks['bkmrk_portals']; - var ID = window.plugin.bookmarks.generateID(); + for(var idFolders in list){ + for(var idBkmrk in list[idFolders]['bkmrk']){ + var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; + if(guid == portalGuid){ + delete list[idFolders]['bkmrk'][idBkmrk]; + $('.bkmrk#'+idBkmrk+'').remove(); + } + } + } + } + //Add portal into bookmarks + else{ + var linka = $('#portaldetails .linkdetails aside a:contains("Portal link")').attr('href'); + var namePortal = $('#portaldetails h3').text(); - var spac = linka.split('pll='); - var latlng = spac[1] ; - plugin.bookmarks['bkmrk_portals'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"guid":guid,"latlng":latlng,"label":namePortal}; - $('#bkmrk_portals li.othersBookmarks ul').append('
  • X'+namePortal+'
  • '); - } - window.plugin.bookmarks.storeBookmarks('bkmrk_portals'); - window.plugin.bookmarks.updateStarPortal(); -} -window.plugin.bookmarks.addBookmarkMap = function(elem) { - var mapLink = $(elem).attr('href'); - var pars = new RegExp('[\\?&]ll=([^&#]*)[&]z=([^&#]*)').exec(mapLink); - var res = pars[1].split(','); - res[2] = pars[2]; - var latlng = res[0]+','+res[1]; - var zoom = res[2]; + var ID = window.plugin.bookmarks.generateID(); - var ID = window.plugin.bookmarks.generateID(); + var spac = linka.split('pll='); + var latlng = spac[1] ; + plugin.bookmarks['bkmrk_portals'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"guid":guid,"latlng":latlng,"label":namePortal}; + $('#bkmrk_portals li.othersBookmarks ul').append('
  • X'+namePortal+'
  • '); + } + window.plugin.bookmarks.storeBookmarks('bkmrk_portals'); + window.plugin.bookmarks.updateStarPortal(); + } + window.plugin.bookmarks.addBookmarkMap = function(elem){ + var mapLink = $(elem).attr('href'); + var pars = new RegExp('[\\?&]ll=([^&#]*)[&]z=([^&#]*)').exec(mapLink); + var res = pars[1].split(','); + res[2] = pars[2]; + var latlng = res[0]+','+res[1]; + var zoom = res[2]; - var nameMap = $(elem).siblings('input').val(); - nameMap = nameMap.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); + var ID = window.plugin.bookmarks.generateID(); - if(nameMap == '') { nameMap = ''; } - $(elem).siblings('input').val(''); + var nameMap = $(elem).siblings('input').val(); + nameMap = nameMap.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); - plugin.bookmarks['bkmrk_maps'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"label":nameMap,"latlng":latlng,"z":parseInt(zoom)}; - plugin.bookmarks.storeBookmarks('bkmrk_maps'); + if(nameMap == ''){ nameMap = ''; } + $(elem).siblings('input').val(''); - if(nameMap=='') { nameMap = latlng+' ['+zoom+']'; } - $('#bkmrk_maps li.othersBookmarks ul').append('
  • X'+nameMap+'
  • '); -} + plugin.bookmarks['bkmrk_maps'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"label":nameMap,"latlng":latlng,"z":parseInt(zoom)}; + plugin.bookmarks.storeBookmarks('bkmrk_maps'); + + if(nameMap==''){ nameMap = latlng+' ['+zoom+']'; } + $('#bkmrk_maps li.othersBookmarks ul').append('
  • X'+nameMap+'
  • '); + } /***************************************************************************************************************************************************************/ -window.plugin.bookmarks.generateID = function() { - var d = new Date(); - var ID = d.getTime()+(Math.floor(Math.random()*99)+1); - var ID = 'id'+ID.toString(); - return ID; -} + window.plugin.bookmarks.generateID = function(){ + var d = new Date(); + var ID = d.getTime()+(Math.floor(Math.random()*99)+1); + var ID = 'id'+ID.toString(); + return ID; + } -window.plugin.bookmarks.openFolder = function(elem) { - var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); - var ID = $(elem).parent().parent('li').attr('id'); - var newFlag; - var flag = plugin.bookmarks[typeList][ID]['state']; - if(flag) { newFlag = 0; } - else if(!flag) { newFlag = 1; } - window.plugin.bookmarks[typeList][ID]['state'] = newFlag; - window.plugin.bookmarks.storeBookmarks(typeList); -} -window.plugin.bookmarks.addFolder = function(typeList) { - var ID = window.plugin.bookmarks.generateID(); - var input = '#'+typeList+' .addForm input'; - var nameFolder = $(input).val(); - nameFolder = nameFolder.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); - if(nameFolder == '') { nameFolder = 'Folder'; } - $(input).val(''); + window.plugin.bookmarks.openFolder = function(elem){ + var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); + var ID = $(elem).parent().parent('li').attr('id'); + var newFlag; + var flag = plugin.bookmarks[typeList][ID]['state']; + if(flag){ newFlag = 0; } + else if(!flag){ newFlag = 1; } + window.plugin.bookmarks[typeList][ID]['state'] = newFlag; + window.plugin.bookmarks.storeBookmarks(typeList); + } + window.plugin.bookmarks.addFolder = function(typeList){ + var ID = window.plugin.bookmarks.generateID(); + var input = '#'+typeList+' .addForm input'; + var nameFolder = $(input).val(); + nameFolder = nameFolder.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); + if(nameFolder == ''){ nameFolder = 'Folder'; } + $(input).val(''); - plugin.bookmarks[typeList][ID] = {"label":nameFolder,"state":0,"bkmrk":{}}; - plugin.bookmarks.storeBookmarks(typeList); + plugin.bookmarks[typeList][ID] = {"label":nameFolder,"state":0,"bkmrk":{}}; + plugin.bookmarks.storeBookmarks(typeList); - $('#'+typeList+' li.othersBookmarks').before('
  • X'+nameFolder+'
    • '); -} -window.plugin.bookmarks.deletBookmark = function(elem) { - var typeList = $(elem).parent().parent().parent().parent().parent('div').attr('id'); - var ID = $(elem).parent('li').attr('id'); - var IDfold = $(elem).parent().parent().parent('li').attr('id'); - delete window.plugin.bookmarks[typeList][IDfold]['bkmrk'][ID]; - window.plugin.bookmarks.storeBookmarks(typeList); - if(typeList == 'bkmrk_portals') { window.plugin.bookmarks.updateStarPortal(); } -} -window.plugin.bookmarks.deletFolder = function(elem) { - var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); - var ID = $(elem).parent().parent('li').attr('id'); - delete plugin.bookmarks[typeList][ID]; - window.plugin.bookmarks.storeBookmarks(typeList); - if(typeList == 'bkmrk_portals') { window.plugin.bookmarks.updateStarPortal(); } -} + $('#'+typeList+' li.othersBookmarks').before('
    • X'+nameFolder+'
      • '); + } + window.plugin.bookmarks.deletBookmark = function(elem){ + var typeList = $(elem).parent().parent().parent().parent().parent('div').attr('id'); + var ID = $(elem).parent('li').attr('id'); + var IDfold = $(elem).parent().parent().parent('li').attr('id'); + delete window.plugin.bookmarks[typeList][IDfold]['bkmrk'][ID]; + window.plugin.bookmarks.storeBookmarks(typeList); + if(typeList == 'bkmrk_portals'){ window.plugin.bookmarks.updateStarPortal(); } + } + window.plugin.bookmarks.deletFolder = function(elem){ + var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); + var ID = $(elem).parent().parent('li').attr('id'); + delete plugin.bookmarks[typeList][ID]; + window.plugin.bookmarks.storeBookmarks(typeList); + if(typeList == 'bkmrk_portals'){ window.plugin.bookmarks.updateStarPortal(); } + } -window.plugin.bookmarks.sortBookmarksFolder = function(typeList) { - window.plugin.bookmarks.loadBookmarks(typeList); - var newArr = {}; - $('#'+typeList+' li.bookmarkFolder').each(function() { - var idFold = $(this).attr('id'); - newArr[idFold] = window.plugin.bookmarks[typeList][idFold]; - }); - window.plugin.bookmarks[typeList] = newArr; - window.plugin.bookmarks.storeBookmarks(typeList); -} -window.plugin.bookmarks.sortBookmarks = function(typeList) { - window.plugin.bookmarks.loadBookmarks(typeList); - var list = window.plugin.bookmarks[typeList]; - var newArr = {}; + window.plugin.bookmarks.sortBookmarksFolder = function(typeList){ + window.plugin.bookmarks.loadBookmarks(typeList); + var newArr = {}; + $('#'+typeList+' li.bookmarkFolder').each(function(){ + var idFold = $(this).attr('id'); + newArr[idFold] = window.plugin.bookmarks[typeList][idFold]; + }); + window.plugin.bookmarks[typeList] = newArr; + window.plugin.bookmarks.storeBookmarks(typeList); + } + window.plugin.bookmarks.sortBookmarks = function(typeList){ + window.plugin.bookmarks.loadBookmarks(typeList); + var list = window.plugin.bookmarks[typeList]; + var newArr = {}; - $('#'+typeList+' li.bookmarkFolder').each(function() { - var idFold = $(this).attr('id'); - newArr[idFold] = window.plugin.bookmarks[typeList][idFold]; - newArr[idFold].bkmrk = {}; - }); + $('#'+typeList+' li.bookmarkFolder').each(function(){ + var idFold = $(this).attr('id'); + newArr[idFold] = window.plugin.bookmarks[typeList][idFold]; + newArr[idFold].bkmrk = {}; + }); - $('#'+typeList+' li.bkmrk').each(function() { - window.plugin.bookmarks.loadBookmarks(typeList); - var idFold = $(this).parent().parent('li').attr('id'); - var id = $(this).attr('id'); + $('#'+typeList+' li.bkmrk').each(function(){ + window.plugin.bookmarks.loadBookmarks(typeList); + var idFold = $(this).parent().parent('li').attr('id'); + var id = $(this).attr('id'); - var list = window.plugin.bookmarks[typeList]; - for(var idFoldersOrigin in list) { - for(var idBkmrk in list[idFoldersOrigin]['bkmrk']) { - if(idBkmrk == id) { - newArr[idFold].bkmrk[id] = window.plugin.bookmarks[typeList][idFoldersOrigin].bkmrk[id]; - } - } - } - }); - window.plugin.bookmarks[typeList] = newArr; - window.plugin.bookmarks.storeBookmarks(typeList); -} + var list = window.plugin.bookmarks[typeList]; + for(var idFoldersOrigin in list){ + for(var idBkmrk in list[idFoldersOrigin]['bkmrk']){ + if(idBkmrk == id){ + newArr[idFold].bkmrk[id] = window.plugin.bookmarks[typeList][idFoldersOrigin].bkmrk[id]; + } + } + } + }); + window.plugin.bookmarks[typeList] = newArr; + window.plugin.bookmarks.storeBookmarks(typeList); + } -window.plugin.bookmarks.storeBookmarks = function(typeList) { - var bookmarksObject = {}; - bookmarksObject[typeList] = plugin.bookmarks[typeList]; - var bookmarksObjectJSON = JSON.stringify(bookmarksObject); - localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]] = bookmarksObjectJSON; -} -window.plugin.bookmarks.loadBookmarks = function(typeList) { - var bookmarksObjectJSON = localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]]; - if(!bookmarksObjectJSON) return; - var bookmarksObject = JSON.parse(bookmarksObjectJSON); - plugin.bookmarks[typeList] = bookmarksObject[typeList]; -} -window.plugin.bookmarks.loadList = function(typeList) { - window.plugin.bookmarks.loadBookmarks(typeList); - var element = ''; + window.plugin.bookmarks.storeBookmarks = function(typeList){ + var bookmarksObject = {}; + bookmarksObject[typeList] = plugin.bookmarks[typeList]; + var bookmarksObjectJSON = JSON.stringify(bookmarksObject); + localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]] = bookmarksObjectJSON; + } + window.plugin.bookmarks.loadBookmarks = function(typeList){ + var bookmarksObjectJSON = localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]]; + if(!bookmarksObjectJSON) return; + var bookmarksObject = JSON.parse(bookmarksObjectJSON); + plugin.bookmarks[typeList] = bookmarksObject[typeList]; + } + window.plugin.bookmarks.loadList = function(typeList){ + window.plugin.bookmarks.loadBookmarks(typeList); + var element = ''; - var list = window.plugin.bookmarks[typeList]; - for(var idFolders in list) { - var folders = list[idFolders]; - var active = ''; + var list = window.plugin.bookmarks[typeList]; + for(var idFolders in list){ + var folders = list[idFolders]; + var active = ''; - var folderLabel = 'X'; - folderLabel += ''+folders['label']+''; + var folderLabel = 'X'; + folderLabel += ''+folders['label']+''; - if(folders['state']) { active = ' active'; } - if(idFolders == window.plugin.bookmarks.KEY_OTHER_BKMRK) { folderLabel = ''; active= ' othersBookmarks active' } - element += '
      • '+folderLabel+'
          '; + if(folders['state']){ active = ' active'; } + if(idFolders == window.plugin.bookmarks.KEY_OTHER_BKMRK){ folderLabel = ''; active= ' othersBookmarks active' } + element += '
        • '+folderLabel+'
            '; - var fold = folders['bkmrk']; - for(var idBkmrk in fold) { - var btn_link; - var btn_remove = 'X'; - var bkmrk = fold[idBkmrk]; - var label = bkmrk['label']; - var latlng = bkmrk['latlng']; + var fold = folders['bkmrk']; + for(var idBkmrk in fold){ + var btn_link; + var btn_remove = 'X'; + var bkmrk = fold[idBkmrk]; + var label = bkmrk['label']; + var latlng = bkmrk['latlng']; - if(typeList == 'bkmrk_maps') { - if(bkmrk['label']=='') { label = bkmrk['latlng']+' ['+bkmrk['z']+']'; } - btn_link = ''+label+''; - } - else if(typeList == 'bkmrk_portals') { - var guid = bkmrk['guid']; - var btn_link = ''+label+''; - } - element += '
          • '+btn_remove+btn_link+'
          • '; - } - element += '
          '; - } - $('#'+typeList+' ul').html(element); -} + if(typeList == 'bkmrk_maps'){ + if(bkmrk['label']==''){ label = bkmrk['latlng']+' ['+bkmrk['z']+']'; } + btn_link = ''+label+''; + } + else if(typeList == 'bkmrk_portals'){ + var guid = bkmrk['guid']; + var btn_link = ''+label+''; + } + element += '
        • '+btn_remove+btn_link+'
        • '; + } + element += '
        '; + } + $('#'+typeList+' ul').html(element); + } /***************************************************************************************************************************************************************/ -window.plugin.bookmarks.setupJS = function() { - $(document).ready(function() { - //ENABLED THE DRAGGABLE PROPERTY OF THE BOX - $('#bookmarksBox').draggable({ handle:'.handle', containment:'window' }); - $("#bookmarksBox #bookmarksMin , #bookmarksBox ul li, #bookmarksBox ul li a, #bookmarksBox h5, #bookmarksBox .addForm a").disableSelection(); - - //SWICTH VISIBILITY OF THE BOX - $('#bookmarksMin').click(function() { $('#bookmarksBox').animate({marginTop:'-100%'}, {duration:400, queue:false}); $('#bookmarksShow').animate({marginTop:-36}, {duration:400, queue:false}); localStorage[window.plugin.bookmarks['LOCAL_STORAGE_status_box']] = 0; }); - $('#bookmarksShow').click(function() { $('#bookmarksBox').animate({marginTop:0}, {duration:400, queue:false}); $('#bookmarksShow').animate({marginTop:-100}, {duration:400, queue:false}); localStorage[window.plugin.bookmarks['LOCAL_STORAGE_status_box']]= 1; }); - if(localStorage[window.plugin.bookmarks['LOCAL_STORAGE_status_box']] == 1) { $('#bookmarksShow').trigger('click'); }else { $('#bookmarksMin').trigger('click'); } - - //SWITCH LIST (MAPS/PORTALS) - $('#bookmarksBox h5').click(function() {$('h5').removeClass('current');$(this).addClass('current');var sectList = '#'+$(this).attr('class').replace(' current', '');$('#bookmarksBox .bookmarkList').removeClass('current');$(sectList).addClass('current');}); - - //ACTIVE VERTICAL SCROLL-BAR ON THE LONG LISTS - $('.bookmarkList > ul').enscroll({ showOnHover: true, verticalTrackClass: 'trackScroll', verticalHandleClass: 'handleScroll', minScrollbarLength:28 }); - - //ENABLED THE SORTABLE PROPERTY OF THE FOLDERS AND BOOKMARKS - $(".bookmarkList > ul").sortable({items:"li.bookmarkFolder:not(.othersBookmarks)",handle:".bookmarksAnchor",placeholder:"sortable-placeholder",forcePlaceholderSize:true, - update:function(event, ui) { - var typeList = $('#'+ui.item.context.id).parent().parent('.bookmarkList').attr('id'); - window.plugin.bookmarks.sortBookmarksFolder(typeList); - } - }); - $(".bookmarkList ul li ul").sortable({items:"li.bkmrk",connectWith:".bookmarkList ul ul",handle:".bookmarksLink",placeholder:"sortable-placeholder",forcePlaceholderSize:true, - update:function(event, ui) { - var typeList = $('#'+ui.item.context.id).parent().parent().parent().parent('.bookmarkList').attr('id'); - window.plugin.bookmarks.sortBookmarks(typeList); - } - }); - - //REMOVE FOLDER - $('.bookmarkList').on('click', '.folderLabel .bookmarksRemoveFrom', function(e) { - window.plugin.bookmarks.deletFolder(this); - $(this).parent().parent('li').remove(); - e.preventDefault(); - }); - - //REMOVE BOOKMARK - $('.bookmarkList').on('click', '.bkmrk .bookmarksRemoveFrom', function(e) { - window.plugin.bookmarks.deletBookmark(this); - $(this).parent('li').remove(); - e.preventDefault(); - }); - - //OPEN/CLOSE FOLDER - $('#bookmarksBox').on('click', '.bookmarksAnchor', function(e) { - window.plugin.bookmarks.openFolder(this); - $(this).parent().parent('li').toggleClass('active'); - e.preventDefault(); - }); - - //ADD BOOKMARK/FOLDER - $('#bookmarksBox .addForm a').click(function(e) { - var typeList = $(this).parent().parent('div').attr('id'); - if($(this).hasClass('newMap')) { window.plugin.bookmarks.addBookmarkMap(this); } - else { window.plugin.bookmarks.addFolder(typeList); } - - //REFRESS SORTABLE EVENT FOR BKMRK - $(".bookmarkList ul li ul").sortable({items:"li.bkmrk",connectWith:".bookmarkList ul ul",handle:".bookmarksLink",placeholder:"sortable-placeholder",forcePlaceholderSize:true, - update:function(event, ui) { - var typeList = $('#'+ui.item.context.id).parent().parent().parent().parent('.bookmarkList').attr('id'); - window.plugin.bookmarks.sortBookmarks(typeList); - } - }); - e.preventDefault(); - }); - }); -} + window.plugin.bookmarks.setupJS = function(){$(document).ready(function(){ + //ENABLED THE DRAGGABLE PROPERTY OF THE BOX + $('#bookmarksBox').draggable({ handle:'.handle', containment:'window' }); + $("#bookmarksBox #bookmarksMin , #bookmarksBox ul li, #bookmarksBox ul li a, #bookmarksBox h5, #bookmarksBox .addForm a").disableSelection(); -window.plugin.bookmarks.setupCSS = function() { - $("'); + + +}; + +var setup = window.plugin.miniMap.setup; + +// PLUGIN END ////////////////////////////////////////////////////////// + +if(window.iitcLoaded && typeof setup === 'function') { + setup(); +} else { + if(window.bootPlugins) + window.bootPlugins.push(setup); + else + window.bootPlugins = [setup]; +} +} // wrapper end +// inject code into site context +var script = document.createElement('script'); +script.appendChild(document.createTextNode('('+ wrapper +')();')); +(document.body || document.head || document.documentElement).appendChild(script); From b3a42783fad2e42289db9d9a1f6caab9ca1a7230 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 11 Jun 2013 01:21:36 +0200 Subject: [PATCH 021/104] close dialogs onBackPressed (fixes #363) --- code/dialog.js | 5 +++++ .../cradle/iitc_mobile/IITC_JSInterface.java | 6 ++++++ .../com/cradle/iitc_mobile/IITC_Mobile.java | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/code/dialog.js b/code/dialog.js index 81c196d5..96595b3d 100644 --- a/code/dialog.js +++ b/code/dialog.js @@ -55,6 +55,11 @@ window.dialog = function(options) { var jqID = '#' + id; var html = ''; + // hint for iitc mobile that a dialog was opened + if (typeof android !== 'undefined' && android && android.dialogOpened) { + android.dialogOpened(id); + } + // Convert text to HTML if necessary if(options.text) { html = window.convertTextToTableMagic(options.text); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 70011373..284d624a 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -74,6 +74,12 @@ public class IITC_JSInterface { } }); } + + @JavascriptInterface + public void dialogOpened(String id) { + ((IITC_Mobile) context).dialogOpened(id); + } + // get layers and list them in a dialog @JavascriptInterface public void setLayers(String base_layer, String overlay_layer) { diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 3c5c5339..a9297f44 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -47,6 +47,7 @@ public class IITC_Mobile extends Activity { private MenuItem searchMenuItem; private boolean desktop = false; private boolean reload_needed = false; + private ArrayList dialogStack = new ArrayList(); // Used for custom back stack handling private ArrayList backStack = new ArrayList(); @@ -264,6 +265,17 @@ public class IITC_Mobile extends Activity { // we want a self defined behavior for the back button @Override public void onBackPressed() { + // first kill all open iitc dialogs + if (!dialogStack.isEmpty()) { + int last = dialogStack.size() - 1; + String id = dialogStack.get(last); + dialogStack.remove(last); + iitc_view.loadUrl("javascript: " + + "var selector = $(window.DIALOGS['" + id + "']); " + + "selector.dialog('close'); " + + "selector.remove();"); + return; + } // exit fullscreen mode if it is enabled and action bar is disabled or the back stack is empty if (fullscreen_mode && (backStack.isEmpty() || fullscreen_actionbar)) { this.toggleFullscreen(); @@ -522,4 +534,10 @@ public class IITC_Mobile extends Activity { item = menu.findItem(R.id.menu_debug); item.setVisible(!desktop); } + + // called by the javascript interface + public void dialogOpened(String id) { + Log.d("iitcm", "Dialog " + id + " added"); + dialogStack.add(id); + } } From e85a01b2848a6e9ad30fa4c39e5d8a23d4ca3a21 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 12 Jun 2013 05:27:07 +0100 Subject: [PATCH 022/104] minimap plugin - move to bottom-right on mobile --- plugins/minimap.user.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/minimap.user.js b/plugins/minimap.user.js index 68a34e01..2c64401f 100644 --- a/plugins/minimap.user.js +++ b/plugins/minimap.user.js @@ -44,8 +44,13 @@ window.plugin.miniMap.setup = function() { var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxZoom: 18, subdomains: mqSubdomains}; var mqMap = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt); - new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map); - + if(!isSmartphone()) { + // desktop mode - bottom-left, so it doesn't clash with the sidebar + new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map); + } else { + // mobile mode - bottom-right - so it floats above the map copyright text + new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map); + } $('head').append(''); From 2f427ce26b72a579aa296be50594631bc5a9e237 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 12 Jun 2013 16:15:52 +0100 Subject: [PATCH 023/104] make portal mod display much more generic. should handle all the new mods, and likely to handle any future mods too for #373 --- code/portal_detail_display_tools.js | 56 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 60585b77..896dceb0 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -30,29 +30,49 @@ window.getModDetails = function(d) { var modsTitle = []; var modsColor = []; $.each(d.portalV2.linkedModArray, function(ind, mod) { - if(!mod) { - mods.push(''); - modsTitle.push(''); - modsColor.push('#000'); - } else if(mod.type === 'RES_SHIELD') { + var modName = ''; + var modTooltip = ''; + var modColor = '#000'; - var title = mod.rarity.capitalize() + ' ' + mod.displayName + '\n'; - title += 'Installed by: '+ getPlayerName(mod.installingUser); + if (mod) { + // all mods seem to follow the same pattern for the data structure + // but let's try and make this robust enough to handle possible future differences - title += '\nStats:'; - for (var key in mod.stats) { - if (!mod.stats.hasOwnProperty(key)) continue; - title += '\n+' + mod.stats[key] + ' ' + key.capitalize().replace(/_/g,' '); + if (mod.displayName) { + modName = mod.displayName; + } else if (mod.type) { + modName = mod.type; + } else { + modName = '(unknown mod)'; } - mods.push(mod.rarity.capitalize().replace('_', ' ') + ' ' + mod.displayName); - modsTitle.push(title); - modsColor.push(COLORS_MOD[mod.rarity]); - } else { - mods.push(mod.type); - modsTitle.push('Unknown mod. No further details available.'); - modsColor.push('#FFF'); + if (mod.rarity) { + modName = mod.rarity.capitalize().replace(/_/g,' ') + ' ' + modName; + } + + modTooltip = modName + '\n'; + if (mod.installingUser) { + modTooltip += 'Installed by: '+ getPlayerName(mod.installingUser) + '\n'; + } + + if (mod.stats) { + modTooltip += 'Stats:'; + for (var key in mod.stats) { + if (!mod.stats.hasOwnProperty(key)) continue; + modTooltip += '\n+' + mod.stats[key] + ' ' + key.capitalize().replace(/_/g,' '); + } + } + + if (mod.rarity) { + modColor = COLORS_MOD[mod.rarity]; + } else { + modColor = '#fff'; + } } + + mods.push(modName); + modsTitle.push(modTooltip); + modsColor.push(modColor); }); var t = ''+mods[0]+'' From 50edc8924c569be0f7c24d494fe7627941c481ae Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 12 Jun 2013 18:06:03 +0100 Subject: [PATCH 024/104] update website for 0.12.1 --- website/page/home.php | 24 +++++++++++------------- website/page/news.php | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/website/page/home.php b/website/page/home.php index 07a8b8e1..cf17c7ad 100644 --- a/website/page/home.php +++ b/website/page/home.php @@ -13,21 +13,19 @@ offers many more features. It is available for

        Latest news

        - -

        22nd May 2013

        +

        12th June 2013

        -IITC version 0.12.0 has been released. This contains quite a few changes and new features, including +IITC version 0.12.1 released, and IITC Mobile 0.4.6. Changes include:

          -
        • Portal highlighter system - and many portal highlighter plugins
        • -
        • Dialogs - can be kept open and dragged while viewing the map
        • -
        • Layers - the enabled layers are now remembered when you next load the intel site
        • -
        • Improved request limits - more improvements have been made in this area
        • -
        • Sync plugin - to sync data from the 'Keys' addon to multiple computers via Google Drive
        • -
        • ... and many other tweaks, bug fixes, etc
        • +
        • Display details about the new portal mods
        • +
        • Updated Leaflet.js version - may reduce issues found on some Samsung devices running Android 4.1 (Jellybean)
        • +
        • Fix resolving a large number of player names in one go
        • +
        • Prevent refreshing old chat messages on small map movements - can vastly reduce repeated requests in some cases
        • +
        • Various improvements/tweaks to the mobile version
        • +
        • AP list plugin: fixed shield mitigation calculation
        • +
        • New basemap plugins: OpenStreetMap, OpenCycleMap, Yandex (Russian), and a template for CloudMade.com to restore the original blue map
        • +
        • Guess player level plugin: attempt to spot when a Jarvis Virus/ADA Refactor has been used and ignore that player's resonators when guessing the level
        • +
        • Max links plugin: optimisations and dashed lines
        -IITC Mobile 0.4.0 is also released. THis has also had major work. Along with the above, it includes a -new in-app layer chooser and chat/map switcher, and authentication has been revamped to use the native -Android authentication rather than entering your password. -

        Older news diff --git a/website/page/news.php b/website/page/news.php index fdec6933..3aa86b68 100644 --- a/website/page/news.php +++ b/website/page/news.php @@ -1,5 +1,20 @@

        News

        +

        12th June 2013

        +

        +IITC version 0.12.1 released, and IITC Mobile 0.4.6. Changes include: +

          +
        • Display details about the new portal mods
        • +
        • Updated Leaflet.js version - may reduce issues found on some Samsung devices running Android 4.1 (Jellybean)
        • +
        • Fix resolving a large number of player names in one go
        • +
        • Prevent refreshing old chat messages on small map movements - can vastly reduce repeated requests in some cases
        • +
        • Various improvements/tweaks to the mobile version
        • +
        • AP list plugin: fixed shield mitigation calculation
        • +
        • New basemap plugins: OpenStreetMap, OpenCycleMap, Yandex (Russian), and a template for CloudMade.com to restore the original blue map
        • +
        • Guess player level plugin: attempt to spot when a Jarvis Virus/ADA Refactor has been used and ignore that player's resonators when guessing the level
        • +
        • Max links plugin: optimisations and dashed lines
        • +
        +

        22nd May 2013

        IITC version 0.12.0 has been released. This contains quite a few changes and new features, including From ec8d305bcb9f53146d7fe5c4c5bca9d1f3174a60 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 12 Jun 2013 18:12:39 +0100 Subject: [PATCH 025/104] bump version after 0.12.1 release, in preperation for the future --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 1f45ddcb..47e9022f 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@jonatkins // @name IITC: Ingress intel map total conversion -// @version 0.12.1.@@DATETIMEVERSION@@ +// @version 0.12.2.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ From 5322b2148d6e96dcc8b2bc0e0564daaa13be191c Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 12 Jun 2013 18:26:48 +0100 Subject: [PATCH 026/104] fix download path for plugins - oops --- website/page/code/desktop-download.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/page/code/desktop-download.php b/website/page/code/desktop-download.php index baa0cdf7..c91986c0 100644 --- a/website/page/code/desktop-download.php +++ b/website/page/code/desktop-download.php @@ -69,6 +69,8 @@ function iitcDesktopPluginDownloadTable ( $build ) $empty = True; foreach ( $plugins as $basename => $details ) { + $path = "$build/plugins/$basename.user.js"; + $this_category = array_key_exists('@category',$details) ? $details['@category'] : 'Misc'; if ( $category != $this_category ) From 1b3ef846e7b81077875c230699475fd66252dacb Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 12 Jun 2013 19:46:03 +0200 Subject: [PATCH 027/104] use gps location for 'get location' if 'display user location' is enabled. this provides a better location without any costs --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index a9297f44..cdec065c 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -37,7 +37,8 @@ public class IITC_Mobile extends Activity { private IITC_WebView iitc_view; private OnSharedPreferenceChangeListener listener; private String intel_url = "https://www.ingress.com/intel"; - private boolean user_loc = false; + private boolean is_loc_enabled = false; + private Location last_location = null; private LocationManager loc_mngr = null; private LocationListener loc_listener = null; private boolean fullscreen_mode = false; @@ -92,7 +93,7 @@ public class IITC_Mobile extends Activity { invalidateOptionsMenu(); } if (key.equals("pref_user_loc")) - user_loc = sharedPreferences.getBoolean("pref_user_loc", + is_loc_enabled = sharedPreferences.getBoolean("pref_user_loc", false); if (key.equals("pref_fullscreen_actionbar")) { fullscreen_actionbar = sharedPreferences.getBoolean("pref_fullscreen_actionbar", @@ -120,6 +121,7 @@ public class IITC_Mobile extends Activity { // Called when a new location is found by the network location // provider. drawMarker(location); + last_location = location; } public void onStatusChanged(String provider, int status, @@ -133,8 +135,8 @@ public class IITC_Mobile extends Activity { } }; - user_loc = sharedPref.getBoolean("pref_user_loc", false); - if (user_loc == true) { + is_loc_enabled = sharedPref.getBoolean("pref_user_loc", false); + if (is_loc_enabled == true) { // Register the listener with the Location Manager to receive // location updates loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, @@ -196,7 +198,7 @@ public class IITC_Mobile extends Activity { iitc_view.loadUrl("javascript: window.renderUpdateStatus()"); iitc_view.updateCaching(); - if (user_loc == true) { + if (is_loc_enabled == true) { // Register the listener with the Location Manager to receive // location updates loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, @@ -247,7 +249,7 @@ public class IITC_Mobile extends Activity { } Log.d("iitcm", "stopping iitcm"); - if (user_loc == true) + if (is_loc_enabled == true) loc_mngr.removeUpdates(loc_listener); super.onStop(); @@ -377,7 +379,16 @@ public class IITC_Mobile extends Activity { // get the users current location and focus it on map case R.id.locate: iitc_view.loadUrl("javascript: window.show('map');"); - iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 15});"); + // get location from network by default + if (!is_loc_enabled) { + iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 15});"); + // if gps location is displayed we can use a better location without any costs + } else { + if (last_location != null) + iitc_view.loadUrl("javascript: window.map.setView(new L.LatLng(" + + last_location.getLatitude() + "," + + last_location.getLongitude() + "), 15);"); + } actionBar.setTitle(getString(R.string.app_name)); backStackUpdate(android.R.id.home); return true; From b98a9a1d0cf31e0cb5f116cc26c44c7e31187597 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 12 Jun 2013 21:12:39 +0200 Subject: [PATCH 028/104] changed wrapper to stay consistent with other plugins (see #357) --- plugins/bookmarks-by-zaso.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index 75142533..df2c3209 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -12,7 +12,7 @@ // @match http://www.ingress.com/intel* // ==/UserScript== -function wrapper(){ +function wrapper() { // ensure plugin framework is there, even if iitc is not yet loaded if(typeof window.plugin !== 'function') window.plugin = function(){}; From 0f92d694e6e014bd131d19d738e8fcac7ec1b6e6 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 12 Jun 2013 21:13:45 +0200 Subject: [PATCH 029/104] added iitc source preference summary to strings --- mobile/res/values/strings.xml | 1 + mobile/res/xml/preferences.xml | 2 +- .../src/com/cradle/iitc_mobile/IITC_SettingsFragment.java | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index a942710d..0dbabb95 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -49,6 +49,7 @@ If enabled, all IITC sources will be loaded from external storage of the Android device. Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/. IITC source + Load IITC main script from url or use local script. Currently used source: Chat Full diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 09251435..3d96a98e 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -37,10 +37,10 @@ + Date: Wed, 12 Jun 2013 21:44:07 +0200 Subject: [PATCH 030/104] use above declared strings for plugin js replacements --- .../src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java index 50ccf792..39dfcd54 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java @@ -256,14 +256,11 @@ public class IITC_WebViewClient extends WebViewClient { "script.appendChild(document.createTextNode('('+ wrapper +')();'));\n" + "(document.body || document.head || document.documentElement).appendChild(script);"; if (js.contains(wrapper_start) && js.contains(wrapper_end) && js.contains(injection_code)) { - js = js.replace("function wrapper() {", ""); + js = js.replace(wrapper_start, ""); // remove the wrapper function - js = js.replace("} // wrapper end", ""); + js = js.replace(wrapper_end, ""); // and the code injection - js = js.replace("// inject code into site context\n" + - "var script = document.createElement('script');\n" + - "script.appendChild(document.createTextNode('('+ wrapper +')();'));\n" + - "(document.body || document.head || document.documentElement).appendChild(script);", ""); + js = js.replace(injection_code, ""); } else { Log.d("iitcm", "Removal of wrapper/injection code failed for " + file); return ""; From 9a7856e28e8fc283e891f6e4d57c136220a84a62 Mon Sep 17 00:00:00 2001 From: teo96 Date: Wed, 12 Jun 2013 22:40:33 +0200 Subject: [PATCH 031/104] 0.0.14: Add support to new mods (S:Shield - T:Turret - LA:Link Amp - H:Heat-sink - M:Multi-hack - FA:Force Amp) --- plugins/portals-list.user.js | 74 ++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js index 38b3023e..f5923b41 100644 --- a/plugins/portals-list.user.js +++ b/plugins/portals-list.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-portals-list@teo96 // @name IITC plugin: show list of portals // @category Info -// @version 0.0.13.@@DATETIMEVERSION@@ +// @version 0.0.14.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -15,6 +15,7 @@ // ==/UserScript== /* whatsnew +* 0.0.14: Add support to new mods (S:Shield - T:Turret - LA:Link Amp - H:Heat-sink - M:Multi-hack - FA:Force Amp) * 0.0.12: Use dialog() instead of alert so the user can drag the box around * 0.0.11: Add nominal energy column and # links, fix sort bug when opened even amounts of times, nits * 0.0.10: Fixed persistent css problem with alert @@ -95,19 +96,44 @@ window.plugin.portalslist.getPortals = function() { // Sort resonators array by resonator level resonators.sort(function (a, b) {return b[0] - a[0]}); - //get shield informations - var shields = []; + //get mods informations + var mods = []; $.each(d.portalV2.linkedModArray, function(ind, mod) { - if (mod) { - //shields[ind] = mod.rarity.capitalize().replace('_', ' '); - shields[ind] = [mod.rarity.substr(0,1).capitalize(), getPlayerName(mod.installingUser)] ; - } else { - shields[ind] = ['', '']; - } + var modShortName=''; + if (mod) { + switch (mod.displayName) { + case 'Portal Shield': + modShortName = 'S'; + break; + case 'Force Amp': + modShortName = 'FA'; + break; + case 'Link Amp': + modShortName = 'LA'; + break; + case 'Heat Sink': + modShortName = 'H'; + break; + case 'Multi-hack': + modShortName = 'M'; + break; + case 'Turret': + modShortName = 'T'; + break; + default: + modShortName = ''; + break; + } + if (modShortName === '') { + mods[ind] = ['', '', '']; + } else { + mods[ind] = [mod.rarity, getPlayerName(mod.installingUser), modShortName, mod.displayName]; + } + }else { mods[ind] = ['', '', '']; } }); - + console.log(mods); var APgain= getAttackApGain(d).enemyAp; - var thisPortal = {'portal': d, 'name': name, 'team': team, 'level': level, 'guid': guid, 'resonators': resonators, 'energyratio': maxenergy ? Math.floor(energy/maxenergy*100) : 0, 'shields': shields, 'APgain': APgain, 'EAP': (energy/APgain).toFixed(2), 'energy': energy, 'maxenergy': maxenergy, 'links': d.portalV2.linkedEdges.length, 'lat': portal._latlng.lat, 'lng': portal._latlng.lng, 'address': address, 'img': img}; + var thisPortal = {'portal': d, 'name': name, 'team': team, 'level': level, 'guid': guid, 'resonators': resonators, 'energyratio': maxenergy ? Math.floor(energy/maxenergy*100) : 0, 'mods': mods, 'APgain': APgain, 'EAP': (energy/APgain).toFixed(2), 'energy': energy, 'maxenergy': maxenergy, 'links': d.portalV2.linkedEdges.length, 'lat': portal._latlng.lat, 'lng': portal._latlng.lng, 'address': address, 'img': img}; window.plugin.portalslist.listPortals.push(thisPortal); }); @@ -200,16 +226,16 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) { retVal = b.resonators[7][0] - a.resonators[7][0]; break; case 's1': - retVal = a.shields[0].toLowerCase() > b.shields[0].toLowerCase() ? -1 : 1; + retVal = a.mods[0][2] > b.mods[0][2] ? -1 : 1; break; case 's2': - retVal = a.shields[1].toLowerCase() > b.shields[1].toLowerCase() ? -1 : 1; + retVal = a.mods[1][2] > b.mods[1][2] ? -1 : 1; break; case 's3': - retVal = a.shields[2].toLowerCase() > b.shields[2].toLowerCase() ? -1 : 1; + retVal = a.mods[2][2] > b.mods[2][2] ? -1 : 1; break; case 's4': - retVal = a.shields[3].toLowerCase() > b.shields[3].toLowerCase() ? -1 : 1; + retVal = a.mods[3][2] > b.mods[3][2] ? -1 : 1; break; default: retVal = b[sortBy] - a[sortBy]; @@ -236,10 +262,10 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) { + 'Energy' + '%' + 'Links' - + 'S1' - + 'S2' - + 'S3' - + 'S4' + + 'M1' + + 'M2' + + 'M3' + + 'M4' + 'AP Gain' + 'E/AP'; @@ -264,13 +290,13 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) { }); - html += '' + prettyEnergy(portal.energy) + '' + html += '' + prettyEnergy(portal.energy) + '' + '' + portal.energyratio + '%' + '' + portal.links + '' - + '' + portal.shields[0][0] + '' - + '' + portal.shields[1][0] + '' - + '' + portal.shields[2][0] + '' - + '' + portal.shields[3][0] + '' + + '' + portal.mods[0][2] + '' + + '' + portal.mods[1][2] + '' + + '' + portal.mods[2][2] + '' + + '' + portal.mods[3][2] + '' + '' + portal.APgain + '' + '' + portal.EAP + ''; From 561de8e4e0e209a297a8d2959d2abc9c8c75d7e8 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Thu, 13 Jun 2013 12:15:57 +0200 Subject: [PATCH 032/104] let favorite portal plugin work on mobile --- plugins/favorite-portals.user.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/favorite-portals.user.js b/plugins/favorite-portals.user.js index 6e6c0ed2..501f6339 100644 --- a/plugins/favorite-portals.user.js +++ b/plugins/favorite-portals.user.js @@ -181,5 +181,4 @@ if(window.iitcLoaded && typeof setup === 'function') { // inject code into site context var script = document.createElement('script'); script.appendChild(document.createTextNode('('+ wrapper +')();')); - -(document.body || document.head || document.documentElement).appendChild(script); \ No newline at end of file +(document.body || document.head || document.documentElement).appendChild(script); From 6df39749f599d94543da825ee72fe02153b114bb Mon Sep 17 00:00:00 2001 From: Giacinto Garcea Date: Thu, 13 Jun 2013 22:05:21 +0200 Subject: [PATCH 033/104] Bookmarks 0.1.55: add support to IITC_MOBILE - the plugin work on mobile (the open/close folders script is disabled); - add a category plugin: "Controls"; - fixed on firefox accidental click event on the bookmark's link when the bookmark is dragged - edit z-index of the ribbon: now it's shown below the chat; --- ....css => bookmarks-by-zaso-css-desktop.css} | 236 +++++------ plugins/bookmarks-by-zaso-css-mobile.css | 136 +++++++ plugins/bookmarks-by-zaso.user.js | 379 +++++++++++++----- 3 files changed, 498 insertions(+), 253 deletions(-) rename plugins/{bookmarks-by-zaso.css => bookmarks-by-zaso-css-desktop.css} (57%) create mode 100644 plugins/bookmarks-by-zaso-css-mobile.css diff --git a/plugins/bookmarks-by-zaso.css b/plugins/bookmarks-by-zaso-css-desktop.css similarity index 57% rename from plugins/bookmarks-by-zaso.css rename to plugins/bookmarks-by-zaso-css-desktop.css index 9ce13c7e..aecbdea1 100644 --- a/plugins/bookmarks-by-zaso.css +++ b/plugins/bookmarks-by-zaso-css-desktop.css @@ -1,4 +1,3 @@ - #bookmarksBox *{ display:block; padding:0; @@ -11,8 +10,6 @@ text-indent:0; text-decoration:none; } - - #bookmarksBox{ margin-top:-100%; position:absolute !important; @@ -20,21 +17,15 @@ top:100px; left:100px; } -#bookmarksBox .addForm, -#bookmarksBox #bookmarksTypeBar, -#bookmarksBox h5{ +#bookmarksBox .addForm, #bookmarksBox #bookmarksTypeBar, #bookmarksBox h5{ height:28px; overflow:hidden; color:#fff; font-size:14px; } - - -#bookmarksBox #topBar, -#bookmarksBox #topBar *{ +#bookmarksBox #topBar, #bookmarksBox #topBar *{ height:15px !important; } - #bookmarksBox #topBar *{ float:left !important; } @@ -46,7 +37,6 @@ line-height:8px; cursor:move; } - #bookmarksBox #topBar .btn{ display:block; width:19px; @@ -62,50 +52,35 @@ #bookmarksBox #topBar #bookmarksMin:hover{ color:gold; } - #bookmarksBox #bookmarksTypeBar{ clear:both; } - #bookmarksBox h5{ padding:4px 0; width:114px; text-align:center; color:#788; } - #bookmarksBox h5.current{ cursor:default; - background:none; + background:0; color:#fff !important; } #bookmarksBox h5:hover{ color:gold; background:rgba(0,0,0,0); } - -#bookmarksBox #topBar .btn, -#bookmarksBox .addForm, -#bookmarksBox .handle, -#bookmarksBox #bookmarksTypeBar, -#bookmarksBox .bookmarkList li.bookmarksEmpty, -#bookmarksBox .bookmarkList li.bkmrk a, -#bookmarksBox .bookmarkList li.bkmrk:hover{ +#bookmarksBox #topBar .btn, #bookmarksBox .addForm, #bookmarksBox .handle, #bookmarksBox #bookmarksTypeBar, #bookmarksBox .bookmarkList li.bookmarksEmpty, #bookmarksBox .bookmarkList li.bkmrk a, #bookmarksBox .bookmarkList li.bkmrk:hover{ background-color:rgba(8,48,78,.85); } - -#bookmarksBox h5, -#bookmarksBox .bookmarkList li.bkmrk:hover .bookmarksLink, -#bookmarksBox .addForm *{ +#bookmarksBox h5, #bookmarksBox .bookmarkList li.bkmrk:hover .bookmarksLink, #bookmarksBox .addForm *{ background:rgba(0,0,0,.3); } - #bookmarksBox .addForm *{ display:block; float:left; padding:4px 8px 3px; } - #bookmarksBox .addForm a{ cursor:pointer; color:#20a8b1; @@ -115,13 +90,11 @@ line-height:20px; padding:4px 0 3px; } - #bookmarksBox .addForm a:hover{ background:gold; color:#000; text-decoration:none; } - #bookmarksBox .addForm input{ font-size:11px !important; color:#ffce00; @@ -132,26 +105,21 @@ -moz-box-sizing:content-box; box-sizing:content-box; } - #bookmarksBox #bkmrk_portals .addForm input{ width:147px; } - -#bookmarksBox .addForm input:hover, -#bookmarksBox .addForm input:focus{ +#bookmarksBox .addForm input:hover, #bookmarksBox .addForm input:focus{ outline:0; background:rgba(0,0,0,.6); } - -#bookmarksBox .bookmarkList > ul{ +#bookmarksBox .bookmarkList>ul{ width:231px; clear:both; list-style-type:none; color:#fff; - overflow:hidden; + overflow:hidden; max-height:550px; } - #bookmarksBox .sortable-placeholder{ background:rgba(8,48,78,.55); box-shadow:inset 1px 0 0 #20a8b1; @@ -159,69 +127,71 @@ #bookmarksBox .ui-sortable-helper{ border-top-width:1px; } - -#bookmarksBox .bookmarkList{ display:none; } -#bookmarksBox .bookmarkList.current{ display:block; } - -#bookmarksBox h5, -#bookmarksBox .addForm *, -#bookmarksBox ul li.bkmrk, -#bookmarksBox ul li.bkmrk a{ +#bookmarksBox .bookmarkList{ + display:none; +} +#bookmarksBox .bookmarkList.current{ + display:block; +} +#bookmarksBox h5, #bookmarksBox .addForm *, #bookmarksBox ul li.bkmrk, #bookmarksBox ul li.bkmrk a{ height:22px; } - -#bookmarksBox h5, -#bookmarksBox ul li.bkmrk a{ +#bookmarksBox h5, #bookmarksBox ul li.bkmrk a{ overflow:hidden; cursor:pointer; float:left; } -#bookmarksBox ul .bookmarksEmpty{ text-indent:27px; color:#eee; } -#bookmarksBox ul .bookmarksRemoveFrom{ width:19px; text-align:center; color:#fff; } -#bookmarksBox ul .bookmarksLink{ width:171px; padding:0 10px 0 8px; color:gold; } -#bookmarksBox ul .bookmarksLink.selected{ color:#03fe03; } -#bookmarksBox ul .othersBookmarks .bookmarksLink{ width:190px; } - -#bookmarksBox ul .bookmarksLink:hover{ color:#03fe03; } -#bookmarksBox ul .bookmarksRemoveFrom:hover{ color:#fff; background:#e22; } - -/************************************/ - -#bookmarksBox, -#bookmarksBox * -{ border-color:#20a8b1; border-style:solid; border-width:0; } - -#bookmarksBox #topBar -, #bookmarksBox ul .bookmarkFolder -{ border-top-width:1px; } - -#bookmarksBox #topBar -, #bookmarksBox #bookmarksTypeBar -, #bookmarksBox .addForm -, #bookmarksBox ul .bookmarkFolder .folderLabel -, #bookmarksBox ul li.bkmrk -{ border-bottom-width:1px; } - -#bookmarksBox ul .bookmarkFolder -, #bookmarksBox ul .bookmarksRemoveFrom -{ border-right-width:1px; border-left-width:1px; } - -#bookmarksBox #topBar * -, #bookmarksBox #bookmarksTypeBar * -, #bookmarksBox .addForm * -{ border-left-width:1px; } - -#bookmarksBox #topBar -, #bookmarksBox #bookmarksTypeBar -, #bookmarksBox .addForm -{ border-right-width:1px; } - -#bookmarksBox ul .othersBookmarks .bookmarksRemoveFrom -, #bookmarksBox ul .bookmarkFolder .folderLabel .bookmarksRemoveFrom -{ border-left-width:0px; } - -/************************************/ - +#bookmarksBox ul .bookmarksEmpty{ + text-indent:27px; + color:#eee; +} +#bookmarksBox ul .bookmarksRemoveFrom{ + width:19px; + text-align:center; + color:#fff; +} +#bookmarksBox ul .bookmarksLink{ + width:171px; + padding:0 10px 0 8px; + color:gold; +} +#bookmarksBox ul .bookmarksLink.selected{ + color:#03fe03; +} +#bookmarksBox ul .othersBookmarks .bookmarksLink{ + width:190px; +} +#bookmarksBox ul .bookmarksLink:hover{ + color:#03fe03; +} +#bookmarksBox ul .bookmarksRemoveFrom:hover{ + color:#fff; + background:#e22; +} +#bookmarksBox, #bookmarksBox *{ + border-color:#20a8b1; + border-style:solid; + border-width:0; +} +#bookmarksBox #topBar, #bookmarksBox ul .bookmarkFolder{ + border-top-width:1px; +} +#bookmarksBox #topBar, #bookmarksBox #bookmarksTypeBar, #bookmarksBox .addForm, #bookmarksBox ul .bookmarkFolder .folderLabel, #bookmarksBox ul li.bkmrk{ + border-bottom-width:1px; +} +#bookmarksBox ul .bookmarkFolder, #bookmarksBox ul .bookmarksRemoveFrom{ + border-right-width:1px; + border-left-width:1px; +} +#bookmarksBox #topBar *, #bookmarksBox #bookmarksTypeBar *, #bookmarksBox .addForm *{ + border-left-width:1px; +} +#bookmarksBox #topBar, #bookmarksBox #bookmarksTypeBar, #bookmarksBox .addForm{ + border-right-width:1px; +} +#bookmarksBox ul .othersBookmarks .bookmarksRemoveFrom, #bookmarksBox ul .bookmarkFolder .folderLabel .bookmarksRemoveFrom{ + border-left-width:0; +} #bookmarksShow{ display:block; position:absolute; @@ -231,22 +201,22 @@ margin-top:-36px; height:64px; cursor:pointer; - z-index:4005; - + z-index:2999; background-position:center bottom; background-repeat:no-repeat; transition:margin-top 100ms ease-in-out; background-image:url(@@INCLUDEIMAGE:plugins/bookmarks-by-zaso-logo.png@@); } #bookmarksShow:hover{ - margin-top:0px !important; + margin-top:0 !important; +} +#sidebar #portaldetails h3.title{ + width:auto; } - #bookmarkStar{ display:inline-block; - position:relative; - top:1px; - margin-right:3px; + float:left; + margin:3px 1px 0 4px; width:16px; height:15px; overflow:hidden; @@ -254,11 +224,9 @@ background-position:left center; background-repeat:no-repeat; } -#bookmarkStar:hover, -#bookmarkStar.favorite{ +#bookmarkStar:hover, #bookmarkStar.favorite{ background-position:right center; } - #bookmarksBox .handleScroll{ cursor:s-resize; width:3px; @@ -266,21 +234,16 @@ background:gold; opacity:.7; } - -/************************************/ - #bookmarksBox .bookmarkList .bookmarkFolder{ overflow:hidden; margin-top:-1px; height:auto; background:rgba(8,58,78,.7); } - #bookmarksBox .bookmarkList ul li.sortable-placeholder{ box-shadow:inset -1px 0 0 #20a8b1, inset 1px 0 0 #20a8b1, 0 -1px 0 #20a8b1; background:rgba(8,58,78,.9); } - #bookmarksBox .bookmarkList .bkmrk.ui-sortable-helper{ border-right-width:1px; border-left-width:1px; @@ -289,31 +252,21 @@ height:23px; box-shadow:inset 0 -1px 0 #20a8b1, inset 1px 0 0 #20a8b1; } - -#bookmarksBox .bookmarkList ul li.bookmarkFolder.ui-sortable-helper, -#bookmarksBox .bookmarkList ul li.othersBookmarks ul, -#bookmarksBox .bookmarkList ul li.othersBookmarks ul li.sortable-placeholder{ +#bookmarksBox .bookmarkList ul li.bookmarkFolder.ui-sortable-helper, #bookmarksBox .bookmarkList ul li.othersBookmarks ul, #bookmarksBox .bookmarkList ul li.othersBookmarks ul li.sortable-placeholder{ box-shadow:inset 0 -1px 0 #20a8b1; } - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span, -#bookmarksBox .bookmarkList .triangle{ - width:0px; - height:0px; +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span, #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span, #bookmarksBox .bookmarkList .triangle{ + width:0; + height:0; } - -/************************************/ - #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel{ overflow:visible; height:25px; cursor:pointer; background:#069; - text-indent:0px; + text-indent:0; } -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > *{ +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>*{ height:25px; float:left; } @@ -333,39 +286,30 @@ border-width:7px 5px 0 5px; border-color:white transparent transparent transparent; } - -/************************************************************************************************************/ - -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span, #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span{ display:none; - border-width:0px 12px 10px 0; + border-width:0 12px 10px 0; border-color:transparent #20a8b1 transparent transparent; margin:-20px 0 0; position:relative; top:21px; left:219px; } -#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ +#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span{ top:18px; - left:0px; - border-width:0px 10px 9px 0; + left:0; + border-width:0 10px 9px 0; border-color:transparent #069 transparent transparent; } -#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel > span, -#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel > span > span{ +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel>span, #bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel>span>span{ display:block; } -#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel:hover > span > span{ +#bookmarksBox .bookmarkList .bookmarkFolder.active .folderLabel:hover>span>span{ border-color:transparent #036 transparent transparent; } - -/************************************************************************************************************/ - #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel:hover .bookmarksAnchor{ background:#036; } - #bookmarksBox .bookmarkList .bookmarkFolder ul{ display:none; margin-left:19px; @@ -374,7 +318,7 @@ display:block; min-height:22px; } - #bookmarksBox .bookmarkFolder.othersBookmarks ul{ margin-left:0; -} \ No newline at end of file +} +) diff --git a/plugins/bookmarks-by-zaso-css-mobile.css b/plugins/bookmarks-by-zaso-css-mobile.css new file mode 100644 index 00000000..ac2e79f4 --- /dev/null +++ b/plugins/bookmarks-by-zaso-css-mobile.css @@ -0,0 +1,136 @@ +#sidebar #bookmarksBox{ + position:static !important; + width:auto !important; + margin:0 !important; + width:100%; +} +#sidebar #bookmarksBox .bookmarkList > ul > li, #sidebar #bookmarksBox .bookmarkList > ul > li > ul, #sidebar #bookmarksBox .bookmarkList > ul > li > ul > li{ + width:100% !important; +} +#sidebar #bookmarksBox *{ + box-shadow:none !important; + border-width:0 !important +} +#sidebar #bookmarksBox #topBar{ + display:none !important; +} +#sidebar #bookmarksBox #bookmarksTypeBar h5{ + cursor:pointer; + text-align:center; + float:left; + width:50%; + padding:7px 0; +} +#sidebar #bookmarksBox #bookmarksTypeBar h5.current{ + cursor:default; + color:#fff; +} +#sidebar #bookmarksBox #bookmarksTypeBar, #sidebar #bookmarksBox .bookmarkList .addForm{ + border-bottom:1px solid #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk{ + height:36px !important; + clear:both; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ + height:36px; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel a, #sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk a{ + background:none; + padding:7px 0; + height:auto; + box-shadow:inset 0 1px 0 #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksRemoveFrom, #sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksRemoveFrom{ + box-shadow:inset 0 1px 0 #20a8b1, inset -1px 0 0 #20a8b1 !important; + width:15%; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksAnchor, #sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksLink{ + text-indent:10px; + width:85%; + height:21px /*22*/; + overflow:hidden; +} +#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ + margin-left:0 !important; +} +#sidebar #bookmarksBox .bookmarkList ul, #bookmarksBox .bookmarkList ul li, #sidebar #bookmarksBox .bookmarkList ul li ul, #sidebar #bookmarksBox .bookmarkList ul li ul li{ + display:block !important; +} +#sidebar #bookmarksBox .bookmarkList{ + display:none !important; +} +#sidebar #bookmarksBox .bookmarkList > ul{ + border-bottom:1px solid #20a8b1 !important; + border-right:1px solid #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList.current{ + display:block !important; +} +#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.othersBookmarks ul{ + border-top:5px solid #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder, #sidebar #bookmarksBox .bookmarkList li.bkmrk{ + box-shadow:inset 0 1px 0 #20a8b1, 1px 0 0 #20a8b1, -1px 1px 0 #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .bkmrk.sortable-placeholder{ + height:36px !important; +} +#sidebar #bookmarksBox .bookmarkList .sortable-placeholder{ + box-shadow:inset 0 1px 0 #20a8b1 !important; +} +#sidebar #bookmarksBox .ui-sortable .ui-sortable-helper{ + border-top:0; + width:85% !important; +} +#sidebar #bookmarksBox .bookmarkList > ul{ + max-height:none; + width:85% !important; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ + box-shadow:0 1px 0 #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ + width:85% !important; + margin-left:15% !important; +} +#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder.othersBookmarks ul{ + width:100% !important; + margin-left:0% !important; +} +#sidebar #bookmarksShowMobile{ + text-decoration:none; + display:block !important; + padding:11px 0 9px; + text-align:center; +} +#sidebar #portaldetails{ + margin-top:25px; +} +#sidebar #bookmarksBox #bookmarksTypeBar{ + height:auto; +} +#sidebar #bookmarksBox .addForm, #sidebar #bookmarksBox .addForm *{ + height:35px; + padding:0; +} +#sidebar #bookmarksBox .addForm a{ + line-height:37px; +} +#sidebar #bookmarksBox .addForm a{ + width:25% !important; +} +#sidebar #bookmarksBox .addForm input{ + width:50% !important; + text-indent:10px; +} +#sidebar #bookmarksBox #bkmrk_portals .addForm input{ + width:75% !important; +} +#sidebar #bookmarksBox #bookmarksTypeBar h5, #sidebar #bookmarksBox .bookmarkList .addForm a{ + box-shadow:-1px 0 0 #20a8b1 !important; +} +#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder ul{ + display:block !important; + min-height:37px !important; +} \ No newline at end of file diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index df2c3209..75dc8fc8 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -1,7 +1,8 @@ // ==UserScript== -// @id iitc-plugin-bookmarks@zaso +// @id iitc-plugin-bookmarks@ZasoGD // @name IITC plugin: Bookmarks for maps and portals -// @version 0.1.3.@@DATETIMEVERSION@@ +// @category Controls +// @version 0.1.55.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -13,58 +14,66 @@ // ==/UserScript== function wrapper() { - // ensure plugin framework is there, even if iitc is not yet loaded - if(typeof window.plugin !== 'function') window.plugin = function(){}; +// ensure plugin framework is there, even if iitc is not yet loaded +if(typeof window.plugin !== 'function') window.plugin = function(){}; + +// PLUGIN START //////////////////////////////////////////////////////// - // PLUGIN START //////////////////////////////////////////////////////// // use own namespace for plugin - window.plugin.bookmarks = function(){}; + window.plugin.bookmarks = function() {}; + window.plugin.bookmarks.bkmrk_portals = {}; + window.plugin.bookmarks.bkmrk_maps = {}; + + window.plugin.bookmarks.disabledMessage; + window.plugin.bookmarks.contentStarHTML; window.plugin.bookmarks.KEY_OTHER_BKMRK = 'idOthers'; window.plugin.bookmarks.LOCAL_STORAGE_status_box = 'plugin-bookmarks-status-box'; window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_portals = 'plugin-bookmarks-portals-data'; window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_maps = 'plugin-bookmarks-maps-data'; - window.plugin.bookmarks.bkmrk_portals = {}; - window.plugin.bookmarks.bkmrk_maps = {}; +/*********************************************************************************************************************/ - window.plugin.bookmarks.disabledMessage; - window.plugin.bookmarks.contentStarHTML; - window.plugin.bookmarks.bkmrkBox; - window.plugin.bookmarks.bkmrkRibbon; - window.plugin.bookmarks.loadList; - window.plugin.bookmarks.setupJS; - -/***************************************************************************************************************************************************************/ - - window.plugin.bookmarks.addStarToSidebar = function(){ + //--------------------------------------------------------------------------------------- + // Append a 'star' flag in sidebar. + //--------------------------------------------------------------------------------------- + window.plugin.bookmarks.addToSidebar = function(){ if(typeof(Storage) === "undefined"){ $('#portaldetails > .imgpreview').after(plugin.bookmarks.disabledMessage); return; } - var title = $('#portaldetails > h3').text(); - $('#portaldetails > h3').html(plugin.bookmarks.contentStarHTML+title); + $('#portaldetails > h3.title').before(plugin.bookmarks.contentStarHTML); plugin.bookmarks.updateStarPortal(); } + + //--------------------------------------------------------------------------------------- + // Update the status of the star (when a portal is selected from the map/bookmarks-list) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.updateStarPortal = function(){ window.plugin.bookmarks.loadBookmarks('bkmrk_portals'); var guid = window.selectedPortal; - var list = plugin.bookmarks['bkmrk_portals']; $('#bookmarkStar').removeClass('favorite'); $('.bkmrk a.bookmarksLink.selected').removeClass('selected'); - //If current portal is into bookmarks: select bookmark portal from portals list and select the star in sideabar - for(var idFolders in list){ - for(var idBkmrk in list[idFolders]['bkmrk']){ - var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; - if(guid == portalGuid){ - $('#bookmarkStar').addClass('favorite'); - $('.bkmrk#'+idBkmrk+' a.bookmarksLink').addClass('selected'); - } - } + //If current portal is into bookmarks: select bookmark portal from portals list and select the star + if(localStorage[window.plugin.bookmarks.LOCAL_STORAGE_bkmrk_portals].search(guid) != -1){ + $('#bookmarkStar').addClass('favorite'); + var list = plugin.bookmarks['bkmrk_portals']; + for(var idFolders in list){ + for(var idBkmrk in list[idFolders]['bkmrk']){ + var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid']; + if(guid == portalGuid){ + $('.bkmrk#'+idBkmrk+' a.bookmarksLink').addClass('selected'); + } + } + } } } + + //--------------------------------------------------------------------------------------- + // Switch the status of the star + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.switchStarPortal = function(){ var guid = window.selectedPortal; - //Remove portal from bookmarks + //If portal is saved in bookmarks: Remove this bookmark if($('#bookmarkStar').hasClass('favorite')){ var list = plugin.bookmarks['bkmrk_portals']; @@ -78,22 +87,29 @@ function wrapper() { } } } - //Add portal into bookmarks + //If portal isn't saved in bookmarks: Add this bookmark else{ + // Get the bookmark data (name, coordinates, portal id) from the portal link var linka = $('#portaldetails .linkdetails aside a:contains("Portal link")').attr('href'); var namePortal = $('#portaldetails h3').text(); - var ID = window.plugin.bookmarks.generateID(); - var spac = linka.split('pll='); var latlng = spac[1] ; + + // Add bookmark in the localStorage plugin.bookmarks['bkmrk_portals'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"guid":guid,"latlng":latlng,"label":namePortal}; + //Append the new bookmark to the map list $('#bkmrk_portals li.othersBookmarks ul').append('

      • X'+namePortal+'
      • '); } window.plugin.bookmarks.storeBookmarks('bkmrk_portals'); window.plugin.bookmarks.updateStarPortal(); } + + //--------------------------------------------------------------------------------------- + // Save a bookmark map + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.addBookmarkMap = function(elem){ + // Get the coordinates and zoom level from the permalink var mapLink = $(elem).attr('href'); var pars = new RegExp('[\\?&]ll=([^&#]*)[&]z=([^&#]*)').exec(mapLink); var res = pars[1].split(','); @@ -103,21 +119,25 @@ function wrapper() { var ID = window.plugin.bookmarks.generateID(); + //Get the label | Convert some characters | Set the input (empty) var nameMap = $(elem).siblings('input').val(); nameMap = nameMap.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); + $(elem).siblings('input').val(''); - if(nameMap == ''){ nameMap = ''; } - $(elem).siblings('input').val(''); - + // Add bookmark in the localStorage plugin.bookmarks['bkmrk_maps'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"label":nameMap,"latlng":latlng,"z":parseInt(zoom)}; plugin.bookmarks.storeBookmarks('bkmrk_maps'); + //Append the new bookmark to the map list if(nameMap==''){ nameMap = latlng+' ['+zoom+']'; } $('#bkmrk_maps li.othersBookmarks ul').append('
      • X'+nameMap+'
      • '); } -/***************************************************************************************************************************************************************/ +/*********************************************************************************************************************/ + //--------------------------------------------------------------------------------------- + // Generate an ID for the bookmark (date time + random number) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.generateID = function(){ var d = new Date(); var ID = d.getTime()+(Math.floor(Math.random()*99)+1); @@ -125,6 +145,9 @@ function wrapper() { return ID; } + //--------------------------------------------------------------------------------------- + // Switch the status folder to open/close (in the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.openFolder = function(elem){ var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); var ID = $(elem).parent().parent('li').attr('id'); @@ -135,19 +158,29 @@ function wrapper() { window.plugin.bookmarks[typeList][ID]['state'] = newFlag; window.plugin.bookmarks.storeBookmarks(typeList); } + + //--------------------------------------------------------------------------------------- + // Switch the status folder to open/close (in the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.addFolder = function(typeList){ var ID = window.plugin.bookmarks.generateID(); var input = '#'+typeList+' .addForm input'; + //Get the label | Convert some characters | Set the input (empty) var nameFolder = $(input).val(); nameFolder = nameFolder.replace(/\//g, '/').replace(/\\/g, '\').replace(/"/g, '"').replace(/"/g, '''); if(nameFolder == ''){ nameFolder = 'Folder'; } $(input).val(''); - plugin.bookmarks[typeList][ID] = {"label":nameFolder,"state":0,"bkmrk":{}}; + // Add new folder in the localStorage + plugin.bookmarks[typeList][ID] = {"label":nameFolder,"state":1,"bkmrk":{}}; plugin.bookmarks.storeBookmarks(typeList); - - $('#'+typeList+' li.othersBookmarks').before('
      • X'+nameFolder+'
        • '); + //Append the new folder to the list + $('#'+typeList+' li.othersBookmarks').before('
        • X'+nameFolder+'
          • '); } + + //--------------------------------------------------------------------------------------- + // Remove the bookmark (from the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.deletBookmark = function(elem){ var typeList = $(elem).parent().parent().parent().parent().parent('div').attr('id'); var ID = $(elem).parent('li').attr('id'); @@ -156,6 +189,10 @@ function wrapper() { window.plugin.bookmarks.storeBookmarks(typeList); if(typeList == 'bkmrk_portals'){ window.plugin.bookmarks.updateStarPortal(); } } + + //--------------------------------------------------------------------------------------- + // Remove the folder (from the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.deletFolder = function(elem){ var typeList = $(elem).parent().parent().parent().parent('div').attr('id'); var ID = $(elem).parent().parent('li').attr('id'); @@ -164,6 +201,9 @@ function wrapper() { if(typeList == 'bkmrk_portals'){ window.plugin.bookmarks.updateStarPortal(); } } + //--------------------------------------------------------------------------------------- + // Saved the new sort of the folders (in the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.sortBookmarksFolder = function(typeList){ window.plugin.bookmarks.loadBookmarks(typeList); var newArr = {}; @@ -174,6 +214,10 @@ function wrapper() { window.plugin.bookmarks[typeList] = newArr; window.plugin.bookmarks.storeBookmarks(typeList); } + + //--------------------------------------------------------------------------------------- + // Saved the new sort of the bookmarks (in the localStorage) + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.sortBookmarks = function(typeList){ window.plugin.bookmarks.loadBookmarks(typeList); var list = window.plugin.bookmarks[typeList]; @@ -203,34 +247,53 @@ function wrapper() { window.plugin.bookmarks.storeBookmarks(typeList); } + //--------------------------------------------------------------------------------------- + // Update the localStorage + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.storeBookmarks = function(typeList){ var bookmarksObject = {}; bookmarksObject[typeList] = plugin.bookmarks[typeList]; var bookmarksObjectJSON = JSON.stringify(bookmarksObject); localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]] = bookmarksObjectJSON; } + + //--------------------------------------------------------------------------------------- + // Load the localStorage + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.loadBookmarks = function(typeList){ var bookmarksObjectJSON = localStorage[plugin.bookmarks['LOCAL_STORAGE_'+typeList]]; if(!bookmarksObjectJSON) return; var bookmarksObject = JSON.parse(bookmarksObjectJSON); plugin.bookmarks[typeList] = bookmarksObject[typeList]; } + + //--------------------------------------------------------------------------------------- + // Load the bookmarks + //--------------------------------------------------------------------------------------- window.plugin.bookmarks.loadList = function(typeList){ window.plugin.bookmarks.loadBookmarks(typeList); var element = ''; + var elementTemp = ''; + var elementExc = ''; + // For each folder var list = window.plugin.bookmarks[typeList]; for(var idFolders in list){ var folders = list[idFolders]; var active = ''; + // Create a label and a anchor for the sortable var folderLabel = 'X'; folderLabel += ''+folders['label']+''; if(folders['state']){ active = ' active'; } - if(idFolders == window.plugin.bookmarks.KEY_OTHER_BKMRK){ folderLabel = ''; active= ' othersBookmarks active' } - element += '
          • '+folderLabel+'
              '; + if(idFolders == window.plugin.bookmarks.KEY_OTHER_BKMRK){ + folderLabel = ''; active= ' othersBookmarks active'; + } + // Create a folder + elementTemp = '
            • '+folderLabel+'
                '; + // For each bookmark var fold = folders['bkmrk']; for(var idBkmrk in fold){ var btn_link; @@ -239,53 +302,143 @@ function wrapper() { var label = bkmrk['label']; var latlng = bkmrk['latlng']; + // If it's a map if(typeList == 'bkmrk_maps'){ if(bkmrk['label']==''){ label = bkmrk['latlng']+' ['+bkmrk['z']+']'; } btn_link = ''+label+''; } + // If it's a portal else if(typeList == 'bkmrk_portals'){ var guid = bkmrk['guid']; var btn_link = ''+label+''; } - element += '
              • '+btn_remove+btn_link+'
              • '; + // Create the bookmark + elementTemp += '
              • '+btn_remove+btn_link+'
              • '; } - element += '
              '; + elementTemp += '
            '; + + //Add folder 'Others' in last position + if(idFolders != window.plugin.bookmarks.KEY_OTHER_BKMRK){ element += elementTemp; } + else{ elementExc = elementTemp; } } + element += elementExc; + + // Append all folders and bookmarks $('#'+typeList+' ul').html(element); } -/***************************************************************************************************************************************************************/ +/*********************************************************************************************************************/ + //--------------------------------------------------------------------------------------- + // Append the stylesheet + //--------------------------------------------------------------------------------------- + window.plugin.bookmarks.setupCSS = function(){ + $('