Update Bookmarks to 2.1 version
This commit is contained in:
parent
4b7a19a2c6
commit
b0aabd5084
@ -1,324 +0,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:-200%;
|
||||
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 #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 .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 #bookmarksTypeBar{
|
||||
clear:both;
|
||||
}
|
||||
#bookmarksBox h5{
|
||||
padding:4px 0;
|
||||
width:114px;
|
||||
text-align:center;
|
||||
color:#788;
|
||||
}
|
||||
#bookmarksBox h5.current{
|
||||
cursor:default;
|
||||
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{
|
||||
background-color:rgba(8,48,78,.85);
|
||||
}
|
||||
#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;
|
||||
font-size:12px;
|
||||
width:65px;
|
||||
text-align:center;
|
||||
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;
|
||||
width:81px;
|
||||
line-height:11px;
|
||||
font-size:12px;
|
||||
-webkit-box-sizing:content-box;
|
||||
-moz-box-sizing:content-box;
|
||||
box-sizing:content-box;
|
||||
}
|
||||
#bookmarksBox #bkmrk_portals .addForm input{
|
||||
width:147px;
|
||||
}
|
||||
#bookmarksBox .addForm input:hover, #bookmarksBox .addForm input:focus{
|
||||
outline:0;
|
||||
background:rgba(0,0,0,.6);
|
||||
}
|
||||
#bookmarksBox .bookmarkList>ul{
|
||||
width:231px;
|
||||
clear:both;
|
||||
list-style-type:none;
|
||||
color:#fff;
|
||||
overflow:hidden;
|
||||
max-height:550px;
|
||||
}
|
||||
#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 .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{
|
||||
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:0;
|
||||
}
|
||||
#bookmarksShow{
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:250px;
|
||||
width:47px;
|
||||
margin-top:-36px;
|
||||
height:64px;
|
||||
cursor:pointer;
|
||||
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:0 !important;
|
||||
}
|
||||
#sidebar #portaldetails h3.title{
|
||||
width:auto;
|
||||
}
|
||||
#bookmarkStar{
|
||||
display:inline-block;
|
||||
float:left;
|
||||
margin:3px 1px 0 4px;
|
||||
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: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;
|
||||
}
|
||||
#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-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 .bookmarkList .bookmarkFolder .folderLabel>span, #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel>span>span{
|
||||
display:none;
|
||||
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{
|
||||
top:18px;
|
||||
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{
|
||||
display:block;
|
||||
}
|
||||
#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;
|
||||
}
|
||||
)
|
@ -1,136 +0,0 @@
|
||||
#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;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 662 B |
Binary file not shown.
Before Width: | Height: | Size: 292 B |
@ -1,534 +0,0 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-bookmarks@ZasoGD
|
||||
// @name IITC plugin: Bookmarks for maps and portals
|
||||
// @category Controls
|
||||
// @version 0.1.55.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @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==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
// use own namespace for plugin
|
||||
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';
|
||||
|
||||
/*********************************************************************************************************************/
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Append a 'star' flag in sidebar.
|
||||
//---------------------------------------------------------------------------------------
|
||||
window.plugin.bookmarks.addToSidebar = function(){
|
||||
if(typeof(Storage) === "undefined"){ $('#portaldetails > .imgpreview').after(plugin.bookmarks.disabledMessage); return; }
|
||||
$('#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;
|
||||
$('#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
|
||||
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;
|
||||
|
||||
//If portal is saved in bookmarks: Remove this bookmark
|
||||
if($('#bookmarkStar').hasClass('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){
|
||||
delete list[idFolders]['bkmrk'][idBkmrk];
|
||||
$('.bkmrk#'+idBkmrk+'').remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//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('<li class="bkmrk" id="'+ID+'"><a class="bookmarksRemoveFrom" title="Remove from bookmarks">X</a><a class="bookmarksLink selected" onclick="window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false;">'+namePortal+'</a></li>');
|
||||
}
|
||||
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(',');
|
||||
res[2] = pars[2];
|
||||
var latlng = res[0]+','+res[1];
|
||||
var zoom = res[2];
|
||||
|
||||
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('');
|
||||
|
||||
// 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('<li class="bkmrk" id="'+ID+'"><a class="bookmarksRemoveFrom" title="Remove from bookmarks">X</a><a class="bookmarksLink" onclick="map.setView(['+latlng+'], '+zoom+');return false;">'+nameMap+'</a></li>');
|
||||
}
|
||||
|
||||
/*********************************************************************************************************************/
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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);
|
||||
var ID = 'id'+ID.toString();
|
||||
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');
|
||||
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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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('');
|
||||
|
||||
// Add new folder in the localStorage
|
||||
plugin.bookmarks[typeList][ID] = {"label":nameFolder,"state":1,"bkmrk":{}};
|
||||
plugin.bookmarks.storeBookmarks(typeList);
|
||||
//Append the new folder to the list
|
||||
$('#'+typeList+' li.othersBookmarks').before('<li class="bookmarkFolder active" id="'+ID+'"><span class="folderLabel"><a class="bookmarksRemoveFrom">X</a><a class="bookmarksAnchor"><span></span>'+nameFolder+'</a><span><span></span></span></span><ul></ul></li>');
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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');
|
||||
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(); }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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');
|
||||
delete plugin.bookmarks[typeList][ID];
|
||||
window.plugin.bookmarks.storeBookmarks(typeList);
|
||||
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 = {};
|
||||
$('#'+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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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];
|
||||
var newArr = {};
|
||||
|
||||
$('#'+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');
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// 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 = '<span class="folderLabel"><a class="bookmarksRemoveFrom" title="Remove this folder">X</a>';
|
||||
folderLabel += '<a class="bookmarksAnchor"><span></span>'+folders['label']+'</a><span><span></span></span></span>';
|
||||
|
||||
if(folders['state']){ active = ' active'; }
|
||||
if(idFolders == window.plugin.bookmarks.KEY_OTHER_BKMRK){
|
||||
folderLabel = ''; active= ' othersBookmarks active';
|
||||
}
|
||||
// Create a folder
|
||||
elementTemp = '<li class="bookmarkFolder'+active+'" id="'+idFolders+'">'+folderLabel+'<ul>';
|
||||
|
||||
// For each bookmark
|
||||
var fold = folders['bkmrk'];
|
||||
for(var idBkmrk in fold){
|
||||
var btn_link;
|
||||
var btn_remove = '<a class="bookmarksRemoveFrom" title="Remove from bookmarks">X</a>';
|
||||
var bkmrk = fold[idBkmrk];
|
||||
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 = '<a class="bookmarksLink" onclick="map.setView(['+latlng+'], '+bkmrk['z']+');return false;">'+label+'</a>';
|
||||
}
|
||||
// If it's a portal
|
||||
else if(typeList == 'bkmrk_portals'){
|
||||
var guid = bkmrk['guid'];
|
||||
var btn_link = '<a class="bookmarksLink" onclick="window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false;">'+label+'</a>';
|
||||
}
|
||||
// Create the bookmark
|
||||
elementTemp += '<li class="bkmrk" id="'+idBkmrk+'">'+btn_remove+btn_link+'</li>';
|
||||
}
|
||||
elementTemp += '</li></ul>';
|
||||
|
||||
//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(){
|
||||
$('<style>').prop('type', 'text/css').html('@@INCLUDESTRING:plugins/bookmarks-by-zaso-css-desktop.css@@').appendTo('head');
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Append the stylesheet for mobile app
|
||||
//---------------------------------------------------------------------------------------
|
||||
window.plugin.bookmarks.setupCSS_mobile = function(){
|
||||
$('<style>').prop('type', 'text/css').html('@@INCLUDESTRING:plugins/bookmarks-by-zaso-css-mobile.css@@').appendTo('head');
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Append the js script
|
||||
//---------------------------------------------------------------------------------------
|
||||
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 PROPERTY OF THE BOX
|
||||
$('#bookmarksMin').click(function(){
|
||||
$('#bookmarksBox').animate({marginTop:'-200%'}, {duration:600, 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:600, 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');
|
||||
});
|
||||
|
||||
if(!window.isSmartphone()){
|
||||
//DESTOP: active vertical scroll-bar on the long lists
|
||||
$('.bookmarkList > ul').enscroll({ showOnHover: true, verticalTrackClass: 'trackScroll', verticalHandleClass: 'handleScroll', minScrollbarLength:28 });
|
||||
|
||||
//OPEN/CLOSE FOLDER (to be corrected in mobile mode)---------------
|
||||
$('#bookmarksBox').on('click', '.bookmarksAnchor', function(e){
|
||||
window.plugin.bookmarks.openFolder(this);
|
||||
$(this).parent().parent('li').toggleClass('active');
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
//ENABLED THE SORTABLE PROPERTY OF THE FOLDERS AND BOOKMARKS
|
||||
$(".bookmarkList > ul").sortable({
|
||||
items:"li.bookmarkFolder:not(.othersBookmarks)",
|
||||
handle:".bookmarksAnchor",
|
||||
placeholder:"sortable-placeholder",
|
||||
forcePlaceholderSize:true,
|
||||
helper:'clone',
|
||||
distance:5,
|
||||
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,
|
||||
helper:'clone',
|
||||
distance:5,
|
||||
update:function(event, ui){
|
||||
var typeList = $('#'+ui.item.context.id).parent().parent().parent().parent('.bookmarkList').attr('id');
|
||||
window.plugin.bookmarks.sortBookmarks(typeList);
|
||||
}
|
||||
});
|
||||
|
||||
//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,
|
||||
helper:'clone',
|
||||
distance:5,
|
||||
update:function(event, ui){
|
||||
var typeList = $('#'+ui.item.context.id).parent().parent().parent().parent('.bookmarkList').attr('id');
|
||||
window.plugin.bookmarks.sortBookmarks(typeList);
|
||||
}
|
||||
});
|
||||
if(window.isSmartphone()){
|
||||
// The clone not working in mobile mode (to be corrected)---------------
|
||||
$(".bookmarkList ul li ul").sortable("option", "helper", "original");
|
||||
};
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
//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();
|
||||
});
|
||||
|
||||
if(window.isSmartphone()){
|
||||
//FOR MOBILE
|
||||
// The clone not working in mobile mode (to be corrected)---------------
|
||||
$(".bookmarkList > ul").sortable("option", "helper", "original");
|
||||
$(".bookmarkList ul li ul").sortable("option", "helper", "original");
|
||||
|
||||
//Show/Hide the box
|
||||
$('#bookmarksBox').hide();
|
||||
$('#bookmarksShowMobile').click(function(){
|
||||
$(this).toggleClass('open');
|
||||
$('#bookmarksBox').toggle();
|
||||
if($(this).hasClass('open')){ $(this).text('[-] Bookmarks'); }
|
||||
else{ $(this).text('[+] Bookmarks'); }
|
||||
});
|
||||
|
||||
//Return to map when a bookmark is clicked
|
||||
$('.bookmarkList').on('click', '.bkmrk .bookmarksLink', function(){
|
||||
window.show("map");
|
||||
});
|
||||
}
|
||||
});}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// HTML element
|
||||
//---------------------------------------------------------------------------------------
|
||||
window.plugin.bookmarks.setupContent = function(){
|
||||
plugin.bookmarks.contentStarHTML = '<a id="bookmarkStar" onclick="window.plugin.bookmarks.switchStarPortal();return false;" title="Save this portal in your bookmarks"><span></span></a>';
|
||||
plugin.bookmarks.disabledMessage = '<div title="Your browser do not support localStorage">Plugin Bookmarks disabled</div>';
|
||||
plugin.bookmarks.bkmrkRibbon = '<a id="bookmarksShow"></a>';
|
||||
plugin.bookmarks.bkmrkBox = '<div id="bookmarksBox">'
|
||||
+'<div id="topBar"><a id="bookmarksMin" class="btn" title="Minimize">-</a><div class="handle">...</div></div>'
|
||||
+'<div id="bookmarksTypeBar"><h5 class="bkmrk_maps current">Maps</h5><h5 class="bkmrk_portals">Portals</h5><div style="clear:both !important;"></div></div>'
|
||||
+'<div id="bkmrk_maps" class="bookmarkList current"><div class="addForm"><input placeholder="Insert label"><a class="newMap" onmouseover="setPermaLink(this);return false">+ Map</a><a class="newFolder">+ Folder</a></div><ul></ul></div>'
|
||||
+'<div id="bkmrk_portals" class="bookmarkList"><div class="addForm"><input placeholder="Insert label"><a class="newFolder">+ Folder</a></div><ul></ul></div>'
|
||||
+'</div>';
|
||||
plugin.bookmarks.bkmrkTriggerMobile= '<a id="bookmarksShowMobile">[+] Bookmarks</a>';
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
var setup = function(){
|
||||
//Set the localStorage (if not exist)
|
||||
if(!localStorage[window.plugin.bookmarks['LOCAL_STORAGE_bkmrk_portals']]){localStorage[plugin.bookmarks['LOCAL_STORAGE_bkmrk_portals']] = '{"bkmrk_portals":{"'+window.plugin.bookmarks.KEY_OTHER_BKMRK+'":{"label":"Others","state":1,"bkmrk":{}}}}'; }
|
||||
if(!localStorage[window.plugin.bookmarks['LOCAL_STORAGE_bkmrk_maps']]){localStorage[plugin.bookmarks['LOCAL_STORAGE_bkmrk_maps']] = '{"bkmrk_maps":{"'+window.plugin.bookmarks.KEY_OTHER_BKMRK+'":{"label":"Others","state":1,"bkmrk":{}}}}'; }
|
||||
if(!localStorage[window.plugin.bookmarks['LOCAL_STORAGE_status_box']]){localStorage[plugin.bookmarks['LOCAL_STORAGE_status_box']] = 1;}
|
||||
|
||||
//Load data from localStorage
|
||||
window.plugin.bookmarks.loadBookmarks('bkmrk_portals');
|
||||
window.plugin.bookmarks.loadBookmarks('bkmrk_maps');
|
||||
|
||||
if(window.isSmartphone()){
|
||||
//FOR MOBILE: load the script for the touch events
|
||||
var script2 = document.createElement('script');
|
||||
script2.type = 'text/javascript';
|
||||
script2.src = 'https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js';
|
||||
script2.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||
(document.body || document.head || document.documentElement).appendChild(script2);
|
||||
}else{
|
||||
//FOR DESKTOP: load the script to active the vertical scrollbar (in the bookmarks box)
|
||||
var script3 = document.createElement('script');
|
||||
script3.type = 'text/javascript';
|
||||
script3.src = 'http://enscrollplugin.com/releases/enscroll-0.4.0.min.js';
|
||||
script3.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||
(document.body || document.head || document.documentElement).appendChild(script3);
|
||||
}
|
||||
|
||||
if($.inArray('pluginBookmarksUpdate', window.VALID_HOOKS) < 0){ window.VALID_HOOKS.push('pluginBookmarksUpdate'); }
|
||||
|
||||
window.plugin.bookmarks.setupCSS();
|
||||
if(window.isSmartphone()){window.plugin.bookmarks.setupCSS_mobile();}
|
||||
window.plugin.bookmarks.setupContent();
|
||||
|
||||
//Append the bookmarks box
|
||||
if(!window.isSmartphone()){ $('body').append(plugin.bookmarks.bkmrkRibbon+plugin.bookmarks.bkmrkBox); }
|
||||
else{ $('#portaldetails').before(plugin.bookmarks.bkmrkTriggerMobile+plugin.bookmarks.bkmrkBox); }
|
||||
|
||||
//Load bookmarks and folders in the box
|
||||
window.plugin.bookmarks.loadList('bkmrk_maps');
|
||||
window.plugin.bookmarks.loadList('bkmrk_portals');
|
||||
|
||||
window.plugin.bookmarks.setupJS();
|
||||
window.addHook('portalDetailsUpdated', window.plugin.bookmarks.addToSidebar);
|
||||
}
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
607
plugins/bookmarks-css.css
Normal file
607
plugins/bookmarks-css.css
Normal file
@ -0,0 +1,607 @@
|
||||
#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{
|
||||
display:block;
|
||||
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 #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 .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:#ffce00;
|
||||
}
|
||||
#bookmarksBox #bookmarksTypeBar{
|
||||
clear:both;
|
||||
}
|
||||
#bookmarksBox h5{
|
||||
padding:4px 0;
|
||||
width:114px;
|
||||
text-align:center;
|
||||
color:#788;
|
||||
}
|
||||
#bookmarksBox h5.current{
|
||||
cursor:default;
|
||||
background:0;
|
||||
color:#fff !important;
|
||||
}
|
||||
#bookmarksBox h5:hover{
|
||||
color:#ffce00;
|
||||
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{
|
||||
background-color:rgba(8,48,78,.85);
|
||||
}
|
||||
#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;
|
||||
font-size:12px;
|
||||
width:65px;
|
||||
text-align:center;
|
||||
line-height:20px;
|
||||
padding:4px 0 3px;
|
||||
}
|
||||
#bookmarksBox .addForm a:hover{
|
||||
background:#ffce00;
|
||||
color:#000;
|
||||
text-decoration:none;
|
||||
}
|
||||
#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 #bkmrk_portals .addForm input{
|
||||
width:147px;
|
||||
}
|
||||
#bookmarksBox .addForm input:hover,
|
||||
#bookmarksBox .addForm input:focus{
|
||||
outline:0;
|
||||
background:rgba(0,0,0,.6);
|
||||
}
|
||||
#bookmarksBox .bookmarkList > ul{
|
||||
width:231px;
|
||||
clear:both;
|
||||
list-style-type:none;
|
||||
color:#fff;
|
||||
overflow:hidden;
|
||||
}
|
||||
#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 .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{
|
||||
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:#ffce00;
|
||||
}
|
||||
#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 !important;
|
||||
}
|
||||
#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;
|
||||
}
|
||||
#bkmrksTrigger{
|
||||
display:none;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:250px;
|
||||
width:47px;
|
||||
margin-top:-36px;
|
||||
height:64px;
|
||||
cursor:pointer;
|
||||
z-index:2999;
|
||||
background-position:center bottom;
|
||||
background-repeat:no-repeat;
|
||||
transition:margin-top 100ms ease-in-out;
|
||||
text-indent:-100%;
|
||||
text-decoration:none;
|
||||
text-align:center;
|
||||
}
|
||||
#bkmrksTrigger:hover{
|
||||
margin-top:0;
|
||||
}
|
||||
#sidebar #portaldetails h3.title{
|
||||
width:auto;
|
||||
}
|
||||
#bkmrksTrigger, .bkmrksStar span{
|
||||
background-image:url(@@INCLUDEIMAGE:plugins/bookmarks-img.png@@);}
|
||||
.bkmrksStar span{
|
||||
display:inline-block;
|
||||
float:left;
|
||||
margin:3px 1px 0 4px;
|
||||
width:16px;
|
||||
height:15px;
|
||||
overflow:hidden;
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
.bkmrksStar span, .bkmrksStar.favorite:focus span{
|
||||
background-position:left top;
|
||||
}
|
||||
.bkmrksStar:focus span, .bkmrksStar.favorite span{
|
||||
background-position:right top;
|
||||
}
|
||||
#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;
|
||||
}
|
||||
#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-width:5px 0 5px 7px;
|
||||
border-color:transparent transparent transparent white;
|
||||
margin:7px 7px 0 6px;
|
||||
}
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel .bookmarksAnchor span{
|
||||
margin:9px 5px 0 5px;
|
||||
border-width:7px 5px 0 5px;
|
||||
border-color:white transparent transparent transparent;
|
||||
}
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span,
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{
|
||||
display:none;
|
||||
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{
|
||||
top:18px;
|
||||
left:0;
|
||||
border-width:0 10px 9px 0;
|
||||
border-color:transparent #069 transparent transparent;
|
||||
}
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span,
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span > span{
|
||||
display:block;
|
||||
}
|
||||
#bookmarksBox .bookmarkList .bookmarkFolder.open .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.open ul{
|
||||
display:block;
|
||||
min-height:22px;
|
||||
}
|
||||
#bookmarksBox .bookmarkFolder.othersBookmarks ul{
|
||||
margin-left:0;
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
MOBILE
|
||||
**********************************************/
|
||||
#sidebar #bookmarksBox{
|
||||
position:static !important;
|
||||
width:auto !important;
|
||||
margin:0 !important;
|
||||
}
|
||||
#sidebar #bkmrksTrigger,
|
||||
#sidebar #bookmarksBox .bookmarkList ul,
|
||||
#sidebar #bookmarksBox .bookmarkList ul li,
|
||||
#sidebar #bookmarksBox .bookmarkList.current,
|
||||
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder.open ul{
|
||||
width:100% !important;
|
||||
display:block !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,
|
||||
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{
|
||||
height:36px !important;
|
||||
clear:both;
|
||||
}
|
||||
#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%;
|
||||
background:none !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksAnchor,
|
||||
#sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksLink{
|
||||
text-indent:10px;
|
||||
width:85%;
|
||||
height:21px;
|
||||
overflow:hidden;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{
|
||||
margin-left:0 !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList > ul{
|
||||
border-bottom:1px solid #20a8b1 !important;
|
||||
border-right:1px solid #20a8b1 !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 > 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 #bkmrksTrigger{
|
||||
position:static;
|
||||
width:auto;
|
||||
margin:0;
|
||||
height:auto;
|
||||
background:none;
|
||||
text-indent:0;
|
||||
padding:11px 0 9px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
#sidebar #bkmrksTrigger.open{
|
||||
margin-bottom:0;
|
||||
}
|
||||
#sidebar #bookmarksBox{
|
||||
margin-bottom:5px !important;
|
||||
}
|
||||
#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:none !important;
|
||||
min-height:37px !important;
|
||||
}
|
||||
#updatestatus .bkmrksStar{
|
||||
float:left;
|
||||
margin:-19px 0 0 -5px;
|
||||
padding:0 3px 1px 4px;
|
||||
background:#262c32;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span,
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span,
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span,
|
||||
#sidebar #bookmarksBox .bookmarkList .triangle{
|
||||
width:0 !important;
|
||||
height:0 !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{
|
||||
float:left !important;
|
||||
border-width:5px 0 5px 7px !important;
|
||||
border-color:transparent transparent transparent white !important;
|
||||
margin:7px 3px 0 13px !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel .bookmarksAnchor span{
|
||||
margin:9px 1px 0 12px !important;
|
||||
border-width:7px 5px 0 5px !important;
|
||||
border-color:white transparent transparent transparent !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span,
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{
|
||||
display:none !important;
|
||||
border-width:0 12px 10px 0 !important;
|
||||
border-color:transparent #20a8b1 transparent transparent !important;
|
||||
margin:-20px 0 0 100% !important;
|
||||
position:relative !important;
|
||||
top:21px !important;
|
||||
left:-10px !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{
|
||||
top:18px !important;
|
||||
left:0 !important;
|
||||
border-width:0 10px 9px 0 !important;
|
||||
border-color:transparent #069 transparent transparent !important;
|
||||
}
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span,
|
||||
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span > span{
|
||||
display:block !important;
|
||||
}
|
||||
/**********************************************
|
||||
DIALOG BOX
|
||||
**********************************************/
|
||||
|
||||
/*---- Auto Drawer -----*/
|
||||
#bkmrksAutoDrawer,
|
||||
#bkmrksAutoDrawer p,
|
||||
#bkmrksAutoDrawer a{
|
||||
display:block;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
#bkmrksAutoDrawer .bookmarkFolder{
|
||||
margin-bottom:4px;
|
||||
border:1px solid #20a8b1;
|
||||
}
|
||||
#bkmrksAutoDrawer .folderLabel{
|
||||
background:#069;
|
||||
padding:4px 0;
|
||||
color:#fff;
|
||||
}
|
||||
#bkmrksAutoDrawer .bookmarkFolder div{
|
||||
border-top:1px solid #20a8b1;
|
||||
padding:6px 0;
|
||||
background:rgba(0,0,0,0.3);
|
||||
}
|
||||
#bkmrksAutoDrawer .bookmarkFolder#idOthers .folderLabel{
|
||||
display:none;
|
||||
}
|
||||
#bkmrksAutoDrawer .bookmarkFolder#idOthers div{
|
||||
display:block;
|
||||
border-top:none;
|
||||
}
|
||||
#bkmrksAutoDrawer a{
|
||||
text-indent:10px;
|
||||
padding:2px 0;
|
||||
}
|
||||
#bkmrksAutoDrawer .bookmarkFolder div,
|
||||
#bkmrksAutoDrawer p{
|
||||
display:none;
|
||||
}
|
||||
#bkmrksAutoDrawer a.bkmrk.selected{
|
||||
color:#03dc03;
|
||||
}
|
||||
|
||||
/*---- Options panel -----*/
|
||||
#bkmrksSetbox a{
|
||||
display:block;
|
||||
color:#ffce00;
|
||||
border:1px solid #ffce00;
|
||||
padding:3px 0;
|
||||
margin:10px auto;
|
||||
width:80%;
|
||||
text-align:center;
|
||||
background:rgba(8,48,78,.9);
|
||||
}
|
||||
#bkmrksSetbox a.disabled,
|
||||
#bkmrksSetbox a.disabled:hover{
|
||||
color:#666;
|
||||
border-color:#666;
|
||||
text-decoration:none;
|
||||
}
|
||||
/*---- Opt panel - copy -----*/
|
||||
.ui-dialog-bkmrksSet-copy textarea{
|
||||
width:96%;
|
||||
height:120px;
|
||||
resize:vertical;
|
||||
}
|
BIN
plugins/bookmarks-img.png
Normal file
BIN
plugins/bookmarks-img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 730 B |
874
plugins/bookmarks.user.js
Normal file
874
plugins/bookmarks.user.js
Normal file
@ -0,0 +1,874 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-bookmarks@zaso
|
||||
// @name IITC plugin: Bookmarks for maps and portals
|
||||
// @category Controls
|
||||
// @version 0.2.1.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Save your favorite Maps and Portals and move the intelmap with a click. Now sync.
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
/***********************************************************************
|
||||
USEFUL FUNCTIONS:
|
||||
+ window.plugin.bookmarks.refreshBkmrks(): reloads the bookmarks into box;
|
||||
|
||||
HOOKS:
|
||||
+ pluginBkmrksEdit: fired when a bookmarks/folder is removed, added or sorted, also when a folder is opened/closed;
|
||||
+ pluginBkmrksOpenOpt: fired when the "Bookmarks Options" panel is opened (you can add new options);
|
||||
|
||||
CHANGELOG:
|
||||
v 0.2.1:
|
||||
+ auto-drawer improved UI;
|
||||
+ auto-drawer improved UI on mobile;
|
||||
+ fixed hidden box problem (I hope): sometimes the box and the ribbon hidden;
|
||||
|
||||
v 0.2.0:
|
||||
+ code rewritten from scratch:
|
||||
++ more optimization;
|
||||
++ less animated effects;
|
||||
+ Hooks (for developer);
|
||||
+ Option panel:
|
||||
++ manual import/export/reset of the data;
|
||||
++ sharing of the data (only IITCm);
|
||||
++ storage/reset the box position (only desktop);
|
||||
+ Auto-drawer feature: select two o three portals boomark to auto-draw a link or field (draw-tools required);
|
||||
+ IITCm: you can open/close the folders;
|
||||
+ IITCm: bookmarks/folders not sortable (the 'sortable' jquery function not work);
|
||||
+ Sync: to use this feature you must disable 'key' plugin or put it below in tampermonkey list (https://github.com/jonatkins/ingress-intel-total-conversion/issues/501);
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
// use own namespace for plugin
|
||||
window.plugin.bookmarks = function() {};
|
||||
|
||||
window.plugin.bookmarks.SYNC_DELAY = 5000;
|
||||
|
||||
window.plugin.bookmarks.KEY_OTHER_BKMRK = 'idOthers';
|
||||
window.plugin.bookmarks.KEY_STORAGE = 'plugin-bookmarks';
|
||||
window.plugin.bookmarks.KEY_STATUS_BOX = 'plugin-bookmarks-box';
|
||||
|
||||
window.plugin.bookmarks.KEY = {key: window.plugin.bookmarks.KEY_STORAGE, field: 'bkmrksObj'};
|
||||
window.plugin.bookmarks.UPDATE_QUEUE = {key: 'plugin-bookmarks-queue', field: 'updateQueue'};
|
||||
window.plugin.bookmarks.UPDATING_QUEUE = {key: 'plugin-bookmarks-updating-queue', field: 'updatingQueue'};
|
||||
|
||||
window.plugin.bookmarks.bkmrksObj = {};
|
||||
window.plugin.bookmarks.statusBox = {};
|
||||
window.plugin.bookmarks.updateQueue = {};
|
||||
window.plugin.bookmarks.updatingQueue = {};
|
||||
|
||||
window.plugin.bookmarks.enableSync = false;
|
||||
|
||||
window.plugin.bookmarks.isSmart = window.isSmartphone();
|
||||
window.plugin.bookmarks.isAndroid = function() { if(typeof android !== 'undefined' && android) { return true; } return false; }
|
||||
|
||||
/*********************************************************************************************************************/
|
||||
|
||||
// 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);
|
||||
var ID = 'id'+ID.toString();
|
||||
return ID;
|
||||
}
|
||||
|
||||
// Format the string
|
||||
window.plugin.bookmarks.escapeHtml = function(text) {
|
||||
return text
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/\//g, '/')
|
||||
.replace(/\\/g, '\');
|
||||
}
|
||||
|
||||
// Update the localStorage
|
||||
window.plugin.bookmarks.saveStorage = function() {
|
||||
localStorage[plugin.bookmarks.KEY_STORAGE] = JSON.stringify(window.plugin.bookmarks.bkmrksObj);
|
||||
}
|
||||
// Load the localStorage
|
||||
window.plugin.bookmarks.loadStorage = function() {
|
||||
window.plugin.bookmarks.bkmrksObj = JSON.parse(localStorage[plugin.bookmarks.KEY_STORAGE]);
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.saveStorageBox = function() {
|
||||
localStorage[plugin.bookmarks.KEY_STATUS_BOX] = JSON.stringify(window.plugin.bookmarks.statusBox);
|
||||
}
|
||||
window.plugin.bookmarks.loadStorageBox = function() {
|
||||
window.plugin.bookmarks.statusBox = JSON.parse(localStorage[plugin.bookmarks.KEY_STATUS_BOX]);
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.upgradeToNewStorage = function() {
|
||||
if(localStorage['plugin-bookmarks-portals-data'] && localStorage['plugin-bookmarks-maps-data']) {
|
||||
var oldStor_1 = JSON.parse(localStorage['plugin-bookmarks-maps-data']);
|
||||
var oldStor_2 = JSON.parse(localStorage['plugin-bookmarks-portals-data']);
|
||||
|
||||
window.plugin.bookmarks.bkmrksObj.maps = oldStor_1.bkmrk_maps;
|
||||
window.plugin.bookmarks.bkmrksObj.portals = oldStor_2.bkmrk_portals;
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
|
||||
localStorage.removeItem('plugin-bookmarks-maps-data');
|
||||
localStorage.removeItem('plugin-bookmarks-portals-data');
|
||||
localStorage.removeItem('plugin-bookmarks-status-box');
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.createStorage = function() {
|
||||
if(!localStorage[window.plugin.bookmarks.KEY_STORAGE]) {
|
||||
window.plugin.bookmarks.bkmrksObj.maps = {idOthers:{label:"Others",state:1,bkmrk:{}}};
|
||||
window.plugin.bookmarks.bkmrksObj.portals = {idOthers:{label:"Others",state:1,bkmrk:{}}};
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
}
|
||||
if(!localStorage[window.plugin.bookmarks.KEY_STATUS_BOX]) {
|
||||
window.plugin.bookmarks.statusBox.show = 1;
|
||||
window.plugin.bookmarks.statusBox.page = 0;
|
||||
window.plugin.bookmarks.statusBox.pos = {x:100,y:100};
|
||||
window.plugin.bookmarks.saveStorageBox();
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.refreshBkmrks = function() {
|
||||
$('#bkmrk_maps > ul, #bkmrk_portals > ul').remove();
|
||||
|
||||
window.plugin.bookmarks.loadStorage();
|
||||
window.plugin.bookmarks.loadList('maps');
|
||||
window.plugin.bookmarks.loadList('portals');
|
||||
|
||||
window.plugin.bookmarks.updateStarPortal();
|
||||
window.plugin.bookmarks.jquerySortableScript();
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
// Show/hide the bookmarks box
|
||||
window.plugin.bookmarks.switchStatusBkmrksBox = function(status) {
|
||||
var newStatus = status;
|
||||
|
||||
if(newStatus === 'switch') {
|
||||
if(window.plugin.bookmarks.statusBox.show === 1) {
|
||||
newStatus = 0;
|
||||
} else {
|
||||
newStatus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(newStatus === 1) {
|
||||
$('#bookmarksBox').show();
|
||||
$('#bkmrksTrigger').hide();
|
||||
} else {
|
||||
$('#bookmarksBox').hide();
|
||||
$('#bkmrksTrigger').show();
|
||||
}
|
||||
|
||||
if(window.plugin.bookmarks.isSmart) {
|
||||
var button = $('#bkmrksTrigger');
|
||||
button.toggleClass('open');
|
||||
if(button.hasClass('open')) { button.text('[-] Bookmarks'); }
|
||||
else{ button.text('[+] Bookmarks'); }
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.statusBox['show'] = newStatus;
|
||||
window.plugin.bookmarks.saveStorageBox();
|
||||
}
|
||||
|
||||
// Switch list (maps/portals)
|
||||
window.plugin.bookmarks.switchPageBkmrksBox = function(elem, page) {
|
||||
window.plugin.bookmarks.statusBox.page = page;
|
||||
window.plugin.bookmarks.saveStorageBox();
|
||||
|
||||
$('h5').removeClass('current');
|
||||
$(elem).addClass('current');
|
||||
|
||||
var sectList = '#'+$(elem).attr('class').replace(' current', '');
|
||||
$('#bookmarksBox .bookmarkList').removeClass('current');
|
||||
$(sectList).addClass('current');
|
||||
}
|
||||
|
||||
// Switch the status folder to open/close (in the localStorage)
|
||||
window.plugin.bookmarks.openFolder = function(elem) {
|
||||
$(elem).parent().parent('li').toggleClass('open');
|
||||
|
||||
var typeList = $(elem).parent().parent().parent().parent('div').attr('id').replace('bkmrk_', '');
|
||||
var ID = $(elem).parent().parent('li').attr('id');
|
||||
|
||||
var newFlag;
|
||||
var flag = window.plugin.bookmarks.bkmrksObj[typeList][ID]['state'];
|
||||
if(flag) { newFlag = 0; }
|
||||
else if(!flag) { newFlag = 1; }
|
||||
|
||||
window.plugin.bookmarks.bkmrksObj[typeList][ID]['state'] = newFlag;
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
|
||||
// Load the HTML bookmarks
|
||||
window.plugin.bookmarks.loadList = function(typeList) {
|
||||
var element = '';
|
||||
var elementTemp = '';
|
||||
var elementExc = '';
|
||||
var returnToMap = '';
|
||||
|
||||
if(window.plugin.bookmarks.isSmart) {
|
||||
returnToMap = 'window.show(\'map\');';
|
||||
}
|
||||
|
||||
// For each folder
|
||||
var list = window.plugin.bookmarks.bkmrksObj[typeList];
|
||||
|
||||
for(var idFolders in list) {
|
||||
var folders = list[idFolders];
|
||||
var active = '';
|
||||
|
||||
// Create a label and a anchor for the sortable
|
||||
var folderDelete = '<span class="folderLabel"><a class="bookmarksRemoveFrom" onclick="window.plugin.bookmarks.removeElement(this, \'folder\');return false;" title="Remove this folder">X</a>';
|
||||
var folderName = '<a class="bookmarksAnchor" onclick="window.plugin.bookmarks.openFolder(this);return false"><span></span>'+folders['label']+'</a><span><span></span></span></span>';
|
||||
var folderLabel = folderDelete+folderName;
|
||||
|
||||
if(folders['state']) { active = ' open'; }
|
||||
if(idFolders === window.plugin.bookmarks.KEY_OTHER_BKMRK) {
|
||||
folderLabel = '';
|
||||
active= ' othersBookmarks open';
|
||||
}
|
||||
// Create a folder
|
||||
elementTemp = '<li class="bookmarkFolder'+active+'" id="'+idFolders+'">'+folderLabel+'<ul>';
|
||||
|
||||
// For each bookmark
|
||||
var fold = folders['bkmrk'];
|
||||
for(var idBkmrk in fold) {
|
||||
var btn_link;
|
||||
var btn_remove = '<a class="bookmarksRemoveFrom" onclick="window.plugin.bookmarks.removeElement(this, \''+typeList+'\');return false;" title="Remove from bookmarks">X</a>';
|
||||
var bkmrk = fold[idBkmrk];
|
||||
var label = bkmrk['label'];
|
||||
var latlng = bkmrk['latlng'];
|
||||
|
||||
// If it's a map
|
||||
if(typeList === 'maps') {
|
||||
if(bkmrk['label']=='') { label = bkmrk['latlng']+' ['+bkmrk['z']+']'; }
|
||||
btn_link = '<a class="bookmarksLink" onclick="'+returnToMap+'window.map.setView(['+latlng+'], '+bkmrk['z']+');return false;">'+label+'</a>';
|
||||
}
|
||||
// If it's a portal
|
||||
else if(typeList === 'portals') {
|
||||
var guid = bkmrk['guid'];
|
||||
var btn_link = '<a class="bookmarksLink" onclick="$(\'a.bookmarksLink.selected\').removeClass(\'selected\');'+returnToMap+'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false;">'+label+'</a>';
|
||||
}
|
||||
elementTemp += '<li class="bkmrk" id="'+idBkmrk+'">'+btn_remove+btn_link+'</li>';
|
||||
}
|
||||
elementTemp += '</li></ul>';
|
||||
|
||||
//Add folder 'Others' in last position
|
||||
if(idFolders != window.plugin.bookmarks.KEY_OTHER_BKMRK) { element += elementTemp; }
|
||||
else{ elementExc = elementTemp; }
|
||||
}
|
||||
element += elementExc;
|
||||
element = '<ul>'+element+'</ul>';
|
||||
|
||||
// Append all folders and bookmarks
|
||||
$('#bkmrk_'+typeList).append(element);
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
window.plugin.bookmarks.findByGuid = function(guid) {
|
||||
var list = window.plugin.bookmarks.bkmrksObj['portals'];
|
||||
|
||||
for(var idFolders in list) {
|
||||
for(var idBkmrk in list[idFolders]['bkmrk']) {
|
||||
var portalGuid = list[idFolders]['bkmrk'][idBkmrk]['guid'];
|
||||
if(guid === portalGuid) {
|
||||
return {"folder":idFolders,"id":idBkmrk};
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Append a 'star' flag in sidebar.
|
||||
window.plugin.bookmarks.addStarToSidebar = function() {
|
||||
if(typeof(Storage) === "undefined") {
|
||||
$('#portaldetails > .imgpreview').after(plugin.bookmarks.htmlDisabledMessage);
|
||||
return;
|
||||
}
|
||||
$('.bkmrksStar').remove();
|
||||
|
||||
// Prepend a star to mobile status-bar
|
||||
if(window.plugin.bookmarks.isSmart) {
|
||||
$('#updatestatus').prepend(plugin.bookmarks.htmlStar);
|
||||
$('#updatestatus .bkmrksStar').attr('title', '');
|
||||
}
|
||||
|
||||
$('#portaldetails > h3.title').before(plugin.bookmarks.htmlStar);
|
||||
window.plugin.bookmarks.updateStarPortal();
|
||||
}
|
||||
|
||||
// Update the status of the star (when a portal is selected from the map/bookmarks-list)
|
||||
window.plugin.bookmarks.updateStarPortal = function() {
|
||||
var guid = window.selectedPortal;
|
||||
$('.bkmrksStar').removeClass('favorite');
|
||||
$('.bkmrk a.bookmarksLink.selected').removeClass('selected');
|
||||
|
||||
// If current portal is into bookmarks: select bookmark portal from portals list and select the star
|
||||
if(localStorage[window.plugin.bookmarks.KEY_STORAGE].search(guid) != -1) {
|
||||
var bkmrkData = window.plugin.bookmarks.findByGuid(guid);
|
||||
if(bkmrkData) {
|
||||
$('.bkmrk#'+bkmrkData['id']+' a.bookmarksLink').addClass('selected');
|
||||
$('.bkmrksStar').addClass('favorite');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Switch the status of the star
|
||||
window.plugin.bookmarks.switchStarPortal = function() {
|
||||
var guid = window.selectedPortal;
|
||||
|
||||
// If portal is saved in bookmarks: Remove this bookmark
|
||||
if($('.bkmrksStar').hasClass('favorite')) {
|
||||
var bkmrkData = window.plugin.bookmarks.findByGuid(guid);
|
||||
var list = window.plugin.bookmarks.bkmrksObj['portals'];
|
||||
delete list[bkmrkData['folder']]['bkmrk'][bkmrkData['id']];
|
||||
$('.bkmrk#'+bkmrkData['id']+'').remove();
|
||||
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.plugin.bookmarks.updateStarPortal();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
// If portal isn't saved in bookmarks: Add this bookmark
|
||||
else{
|
||||
// Get portal name and coordinates
|
||||
var d = window.portals[guid].options.details;
|
||||
var label = d.portalV2.descriptiveText.TITLE;
|
||||
var lat = (d.locationE6.latE6)/1E6;
|
||||
var lng = (d.locationE6.lngE6)/1E6;
|
||||
var latlng = lat+','+lng;
|
||||
|
||||
var ID = window.plugin.bookmarks.generateID();
|
||||
|
||||
// Add bookmark in the localStorage
|
||||
window.plugin.bookmarks.bkmrksObj['portals'][window.plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"guid":guid,"latlng":latlng,"label":label};
|
||||
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
}
|
||||
}
|
||||
|
||||
// Add BOOKMARK/FOLDER
|
||||
window.plugin.bookmarks.addElement = function(elem, type) {
|
||||
var ID = window.plugin.bookmarks.generateID();
|
||||
var typeList = $(elem).parent().parent('div').attr('id');
|
||||
|
||||
// Get the label | Convert some characters | Set the input (empty)
|
||||
var input = '#'+typeList+' .addForm input';
|
||||
var label = $(input).val();
|
||||
label = window.plugin.bookmarks.escapeHtml(label);
|
||||
$(input).val('');
|
||||
|
||||
// Add a map
|
||||
if(type === 'map') {
|
||||
// Get the coordinates and zoom
|
||||
var c = map.getCenter();
|
||||
var lat = Math.round(c.lat*1E6)/1E6;
|
||||
var lng = Math.round(c.lng*1E6)/1E6;
|
||||
var latlng = lat+','+lng;
|
||||
var zoom = parseInt(map.getZoom());
|
||||
// Add bookmark in the localStorage
|
||||
window.plugin.bookmarks.bkmrksObj['maps'][plugin.bookmarks.KEY_OTHER_BKMRK]['bkmrk'][ID] = {"label":label,"latlng":latlng,"z":zoom};
|
||||
}
|
||||
else{
|
||||
if(label === '') { label = 'Folder'; }
|
||||
var short_type = typeList.replace('bkmrk_', '');
|
||||
// Add new folder in the localStorage
|
||||
window.plugin.bookmarks.bkmrksObj[short_type][ID] = {"label":label,"state":1,"bkmrk":{}};
|
||||
}
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
}
|
||||
|
||||
// Remove BOOKMARK/FOLDER
|
||||
window.plugin.bookmarks.removeElement = function(elem, type) {
|
||||
if(type === 'maps' || type === 'portals') {
|
||||
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.bkmrksObj[typeList.replace('bkmrk_', '')][IDfold]['bkmrk'][ID];
|
||||
$(elem).parent('li').remove();
|
||||
|
||||
if(type === 'portals') {
|
||||
window.plugin.bookmarks.updateStarPortal();
|
||||
}
|
||||
}
|
||||
else if(type === 'folder') {
|
||||
var typeList = $(elem).parent().parent().parent().parent('div').attr('id');
|
||||
var ID = $(elem).parent().parent('li').attr('id');
|
||||
|
||||
delete plugin.bookmarks.bkmrksObj[typeList.replace('bkmrk_', '')][ID];
|
||||
$(elem).parent().parent('li').remove();
|
||||
}
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
// Saved the new sort of the folders (in the localStorage)
|
||||
window.plugin.bookmarks.sortFolder = function(typeList) {
|
||||
var keyType = typeList.replace('bkmrk_', '');
|
||||
|
||||
var newArr = {};
|
||||
$('#'+typeList+' li.bookmarkFolder').each(function() {
|
||||
var idFold = $(this).attr('id');
|
||||
newArr[idFold] = window.plugin.bookmarks.bkmrksObj[keyType][idFold];
|
||||
});
|
||||
window.plugin.bookmarks.bkmrksObj[keyType] = newArr;
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
|
||||
// Saved the new sort of the bookmarks (in the localStorage)
|
||||
window.plugin.bookmarks.sortBookmark = function(typeList) {
|
||||
var keyType = typeList.replace('bkmrk_', '');
|
||||
var list = window.plugin.bookmarks.bkmrksObj[keyType];
|
||||
var newArr = {};
|
||||
|
||||
$('#'+typeList+' li.bookmarkFolder').each(function() {
|
||||
var idFold = $(this).attr('id');
|
||||
newArr[idFold] = window.plugin.bookmarks.bkmrksObj[keyType][idFold];
|
||||
newArr[idFold].bkmrk = {};
|
||||
});
|
||||
|
||||
$('#'+typeList+' li.bkmrk').each(function() {
|
||||
window.plugin.bookmarks.loadStorage();
|
||||
|
||||
var idFold = $(this).parent().parent('li').attr('id');
|
||||
var id = $(this).attr('id');
|
||||
|
||||
var list = window.plugin.bookmarks.bkmrksObj[keyType];
|
||||
for(var idFoldersOrigin in list) {
|
||||
for(var idBkmrk in list[idFoldersOrigin]['bkmrk']) {
|
||||
if(idBkmrk == id) {
|
||||
newArr[idFold].bkmrk[id] = window.plugin.bookmarks.bkmrksObj[keyType][idFoldersOrigin].bkmrk[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
window.plugin.bookmarks.bkmrksObj[keyType] = newArr;
|
||||
window.plugin.bookmarks.saveStorage();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.jquerySortableScript = function() {
|
||||
$(".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.sortFolder(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.sortBookmark(typeList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
/** OPTIONS ****************************************************************************************************************************************************/
|
||||
/***************************************************************************************************************************************************************/
|
||||
// Manual import, export and reset data
|
||||
window.plugin.bookmarks.manualOpt = function() {
|
||||
dialog({
|
||||
html: plugin.bookmarks.htmlSetbox,
|
||||
dialogClass: 'ui-dialog-bkmrksSet',
|
||||
title: 'Bookmarks Options'
|
||||
});
|
||||
|
||||
if(window.plugin.bookmarks.isAndroid()) {
|
||||
$('a:contains(\'Save box\'), a:contains(\'Reset box\')').addClass('disabled');
|
||||
} else {
|
||||
$('a:contains(\'Share all\')').addClass('disabled');
|
||||
}
|
||||
window.runHooks('pluginBkmrksOpenOpt');
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optAlert = function(message) {
|
||||
$('.ui-dialog-bkmrksSet .ui-dialog-buttonset').prepend('<p class="bkrmks-alert" style="float:left;margin-top:4px;">'+message+'</p>');
|
||||
$('.bkrmks-alert').delay(2500).fadeOut();
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optCopy = function() {
|
||||
if(typeof android !== 'undefined' && android && android.intentPosLink) {
|
||||
return androidCopy(localStorage[window.plugin.bookmarks.KEY_STORAGE]);
|
||||
} else {
|
||||
dialog({
|
||||
html: '<p><a onclick="$(\'.ui-dialog-bkmrksSet-copy textarea\').select();">Select all</a> and press CTRL+C to copy it.</p><textarea disabled>'+localStorage[window.plugin.bookmarks.KEY_STORAGE]+'</textarea>',
|
||||
dialogClass: 'ui-dialog-bkmrksSet-copy',
|
||||
title: 'Bookmarks Export'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optPaste = function() {
|
||||
var promptAction = prompt('Press CTRL+V to paste it.', '');
|
||||
if(promptAction !== null && promptAction !== '') {
|
||||
localStorage[window.plugin.bookmarks.KEY_STORAGE] = promptAction;
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
window.plugin.bookmarks.optAlert('Succesful. ');
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optReset = function() {
|
||||
var promptAction = prompt('All bookmarks will be deleted. Are you sure? [Y/N]', '');
|
||||
if(promptAction !== null && (promptAction === 'Y' || promptAction === 'y')) {
|
||||
delete localStorage[window.plugin.bookmarks.KEY_STORAGE];
|
||||
window.plugin.bookmarks.createStorage();
|
||||
window.plugin.bookmarks.loadStorage();
|
||||
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
window.runHooks('pluginBkmrksEdit');
|
||||
window.plugin.bookmarks.optAlert('Succesful. ');
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optShare = function() {
|
||||
if(window.plugin.bookmarks.isAndroid() && android.shareString) {
|
||||
android.shareString(localStorage[window.plugin.bookmarks.KEY_STORAGE]);
|
||||
} else {
|
||||
window.plugin.bookmarks.optAlert('Only IITC mobile. ');
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.optBox = function(command) {
|
||||
if(!window.plugin.bookmarks.isAndroid()) {
|
||||
switch(command) {
|
||||
case 'save':
|
||||
var boxX = parseInt($('#bookmarksBox').css('top'));
|
||||
var boxY = parseInt($('#bookmarksBox').css('left'));
|
||||
window.plugin.bookmarks.statusBox.pos = {x:boxX, y:boxY};
|
||||
window.plugin.bookmarks.saveStorageBox();
|
||||
window.plugin.bookmarks.optAlert('Position acquired. ');
|
||||
break;
|
||||
case 'reset':
|
||||
$('#bookmarksBox').css({'top':100, 'left':100});
|
||||
window.plugin.bookmarks.optBox('save');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
window.plugin.bookmarks.optAlert('Only IITC desktop. ');
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
/** AUTO DRAWER ************************************************************************************************************************************************/
|
||||
/***************************************************************************************************************************************************************/
|
||||
window.plugin.bookmarks.dialogDrawer = function() {
|
||||
dialog({
|
||||
html:window.plugin.bookmarks.dialogLoadList,
|
||||
dialogClass:'ui-dialog-autodrawer',
|
||||
title:'Bookmarks - Auto Drawer',
|
||||
buttons:{
|
||||
'DRAW': function() {
|
||||
window.plugin.bookmarks.draw();
|
||||
},
|
||||
'REFRESH LIST': function() {
|
||||
$(this).dialog('destroy');
|
||||
window.plugin.bookmarks.dialogDrawer();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.draw = function() {
|
||||
var latlngs = [];
|
||||
var uuu = $('#bkmrksAutoDrawer a.bkmrk.selected').each(function(i) {
|
||||
var tt = $(this).data('latlng');
|
||||
latlngs[i] = tt;
|
||||
});
|
||||
|
||||
if(latlngs.length >= 2 && latlngs.length <= 3) {
|
||||
var newItem;
|
||||
var options = {color:"#f06eaa",weight:4,opacity:.5}
|
||||
|
||||
if(latlngs.length == 3) { newItem = L.geodesicPolygon(latlngs, options); }
|
||||
else if(latlngs.length == 2) { newItem = L.geodesicPolyline(latlngs, options); }
|
||||
|
||||
$('#bkmrksAutoDrawer a.bkmrk.selected').removeClass('selected');
|
||||
newItem.addTo(window.plugin.drawTools.drawnItems);
|
||||
// Save in localStorage
|
||||
window.plugin.drawTools.save();
|
||||
|
||||
map.fitBounds(newItem.getBounds());
|
||||
if(window.plugin.bookmarks.isSmart) {
|
||||
window.show('map');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#bkmrksAutoDrawer p').toggle().delay('2500').fadeOut('500');
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.dialogLoadList = function() {
|
||||
var r = '<span>Is required "<a href="http://iitc.jonatkins.com/?page=desktop#plugin-draw-tools" target="_BLANK"><strong>Draw Tools</strong></a>".</span>';
|
||||
|
||||
if(!window.plugin.bookmarks || !window.plugin.drawTools) {
|
||||
$('.ui-dialog-autodrawer .ui-dialog-buttonset .ui-button:not(:first)').hide();
|
||||
}
|
||||
else{
|
||||
var portalsList = JSON.parse(localStorage['plugin-bookmarks']);
|
||||
var element = '';
|
||||
var elementTemp = '';
|
||||
var elemGenericFolder = '';
|
||||
|
||||
// For each folder
|
||||
var list = portalsList.portals;
|
||||
for(var idFolders in list) {
|
||||
var folders = list[idFolders];
|
||||
|
||||
// Create a label and a anchor for the sortable
|
||||
var folderLabel = '<a class="folderLabel" onclick="$(this).siblings(\'div\').toggle();return false;">'+folders['label']+'</a>';
|
||||
|
||||
// Create a folder
|
||||
elementTemp = '<div class="bookmarkFolder" id="'+idFolders+'">'+folderLabel+'<div>';
|
||||
|
||||
// For each bookmark
|
||||
var fold = folders['bkmrk'];
|
||||
for(var idBkmrk in fold) {
|
||||
var bkmrk = fold[idBkmrk];
|
||||
var label = bkmrk['label'];
|
||||
var latlng = bkmrk['latlng'];
|
||||
|
||||
// Create the bookmark
|
||||
elementTemp += '<a class="bkmrk" id="'+idBkmrk+'" onclick="$(this).toggleClass(\'selected\');return false" data-latlng="['+latlng+']">'+label+'</a>';
|
||||
}
|
||||
elementTemp += '</div></div>';
|
||||
|
||||
if(idFolders !== window.plugin.bookmarks.KEY_OTHER_BKMRK) {
|
||||
element += elementTemp;
|
||||
} else {
|
||||
elemGenericFolder += elementTemp;
|
||||
}
|
||||
}
|
||||
element += elemGenericFolder;
|
||||
|
||||
// Append all folders and bookmarks
|
||||
r = '<div id="bkmrksAutoDrawer"><p style="color:red;text-align:center;margin-bottom:9px;">You must select 2 or 3 portals.</p>'+element+'</div>';
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
/** SYNC *******************************************************************************************************************************************************/
|
||||
/***************************************************************************************************************************************************************/
|
||||
// Delay the syncing to group a few updates in a single request
|
||||
window.plugin.bookmarks.delaySync = function() {
|
||||
if(!window.plugin.bookmarks.enableSync) return;
|
||||
clearTimeout(plugin.bookmarks.delaySync.timer);
|
||||
window.plugin.bookmarks.delaySync.timer = setTimeout(function() {
|
||||
window.plugin.bookmarks.delaySync.timer = null;
|
||||
window.plugin.bookmarks.syncNow();
|
||||
}, window.plugin.bookmarks.SYNC_DELAY);
|
||||
}
|
||||
|
||||
// Store the upadteQueue in updatingQueue and upload
|
||||
window.plugin.bookmarks.syncNow = function() {
|
||||
if(!window.plugin.bookmarks.enableSync) return;
|
||||
$.extend(window.plugin.bookmarks.updatingQueue, window.plugin.bookmarks.updateQueue);
|
||||
window.plugin.bookmarks.updateQueue = {};
|
||||
window.plugin.bookmarks.storeLocal(window.plugin.bookmarks.UPDATING_QUEUE);
|
||||
window.plugin.bookmarks.storeLocal(window.plugin.bookmarks.UPDATE_QUEUE);
|
||||
|
||||
window.plugin.sync.updateMap('bookmarks', window.plugin.bookmarks.KEY.field, Object.keys(window.plugin.bookmarks.updatingQueue));
|
||||
}
|
||||
|
||||
// Call after IITC and all plugin loaded
|
||||
window.plugin.bookmarks.registerFieldForSyncing = function() {
|
||||
if(!window.plugin.sync) return;
|
||||
window.plugin.sync.registerMapForSync('bookmarks', window.plugin.bookmarks.KEY.field, window.plugin.bookmarks.syncCallback, window.plugin.bookmarks.syncInitialed);
|
||||
}
|
||||
|
||||
// Call after local or remote change uploaded
|
||||
window.plugin.bookmarks.syncCallback = function(pluginName, fieldName, e, fullUpdated) {
|
||||
if(fieldName === window.plugin.bookmarks.KEY.field) {
|
||||
window.plugin.bookmarks.storeLocal(window.plugin.bookmarks.KEY);
|
||||
// All data is replaced if other client update the data duing this client offline,
|
||||
if(fullUpdated) {
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!e) return;
|
||||
if(e.isLocal) {
|
||||
// Update pushed successfully, remove it from updatingQueue
|
||||
delete window.plugin.bookmarks.updatingQueue[e.property];
|
||||
} else {
|
||||
// Remote update
|
||||
delete window.plugin.bookmarks.updateQueue[e.property];
|
||||
window.plugin.bookmarks.storeLocal(window.plugin.bookmarks.UPDATE_QUEUE);
|
||||
window.plugin.bookmarks.refreshBkmrks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// syncing of the field is initialed, upload all queued update
|
||||
window.plugin.bookmarks.syncInitialed = function(pluginName, fieldName) {
|
||||
if(fieldName === window.plugin.bookmarks.KEY.field) {
|
||||
window.plugin.bookmarks.enableSync = true;
|
||||
if(Object.keys(window.plugin.bookmarks.updateQueue).length > 0) {
|
||||
window.plugin.bookmarks.delaySync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.storeLocal = function(mapping) {
|
||||
if(typeof(window.plugin.bookmarks[mapping.field]) !== 'undefined' && window.plugin.bookmarks[mapping.field] !== null) {
|
||||
localStorage[mapping.key] = JSON.stringify(window.plugin.bookmarks[mapping.field]);
|
||||
} else {
|
||||
localStorage.removeItem(mapping.key);
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.loadLocal = function(mapping) {
|
||||
var objectJSON = localStorage[mapping.key];
|
||||
if(!objectJSON) return;
|
||||
window.plugin.bookmarks[mapping.field] = mapping.convertFunc ? mapping.convertFunc(JSON.parse(objectJSON)) : JSON.parse(objectJSON);
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.syncBkmrks = function() {
|
||||
window.plugin.bookmarks.loadLocal(window.plugin.bookmarks.KEY);
|
||||
|
||||
window.plugin.bookmarks.updateQueue = window.plugin.bookmarks.bkmrksObj;
|
||||
window.plugin.bookmarks.storeLocal(window.plugin.bookmarks.UPDATE_QUEUE);
|
||||
|
||||
window.plugin.bookmarks.delaySync();
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
window.plugin.bookmarks.setupCSS = function() {
|
||||
$('<style>').prop('type', 'text/css').html('@@INCLUDESTRING:plugins/bookmarks-css.css@@').appendTo('head');
|
||||
}
|
||||
|
||||
window.plugin.bookmarks.setupContent = function() {
|
||||
var ttt = '\'switch\'';
|
||||
if(!window.plugin.bookmarks.isSmart) { ttt = 1; }
|
||||
|
||||
plugin.bookmarks.htmlBoxTrigger = '<a id="bkmrksTrigger" class="open" onclick="window.plugin.bookmarks.switchStatusBkmrksBox('+ttt+');return false;">[-] Bookmarks</a>';
|
||||
plugin.bookmarks.htmlBkmrksBox = '<div id="bookmarksBox">'
|
||||
+'<div id="topBar">'
|
||||
+'<a id="bookmarksMin" class="btn" onclick="window.plugin.bookmarks.switchStatusBkmrksBox(0);return false;" title="Minimize">-</a>'
|
||||
+'<div class="handle">...</div>'
|
||||
+'</div>'
|
||||
+'<div id="bookmarksTypeBar">'
|
||||
+'<h5 class="bkmrk_maps current" onclick="window.plugin.bookmarks.switchPageBkmrksBox(this, 0);return false">Maps</h5>'
|
||||
+'<h5 class="bkmrk_portals" onclick="window.plugin.bookmarks.switchPageBkmrksBox(this, 1);return false">Portals</h5>'
|
||||
+'<div style="clear:both !important;"></div>'
|
||||
+'</div>'
|
||||
+'<div id="bkmrk_maps" class="bookmarkList current">'
|
||||
+'<div class="addForm">'
|
||||
+'<input placeholder="Insert label" />'
|
||||
+'<a class="newMap" onclick="window.plugin.bookmarks.addElement(this, \'map\');return false;">+ Map</a>'
|
||||
+'<a class="newFolder" onclick="window.plugin.bookmarks.addElement(this, \'folder\');return false;">+ Folder</a>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div id="bkmrk_portals" class="bookmarkList">'
|
||||
+'<div class="addForm">'
|
||||
+'<input placeholder="Insert label" />'
|
||||
+'<a class="newFolder" onclick="window.plugin.bookmarks.addElement(this, \'folder\');return false;">+ Folder</a>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
|
||||
plugin.bookmarks.htmlDisabledMessage = '<div title="Your browser do not support localStorage">Plugin Bookmarks disabled*.</div>';
|
||||
plugin.bookmarks.htmlStar = '<a class="bkmrksStar" onclick="window.plugin.bookmarks.switchStarPortal();return false;" title="Save this portal in your bookmarks"><span></span></a>';
|
||||
plugin.bookmarks.htmlCalldrawBox = '<a onclick="window.plugin.bookmarks.dialogDrawer();return false;">Auto drawer</a>';
|
||||
plugin.bookmarks.htmlCallSetBox = '<a onclick="window.plugin.bookmarks.manualOpt();return false;">Bookmarks Opt</a>';
|
||||
plugin.bookmarks.htmlSetbox = '<div id="bkmrksSetbox">'
|
||||
+'<a onclick="window.plugin.bookmarks.optCopy();">Copy</a>'
|
||||
+'<a onclick="window.plugin.bookmarks.optPaste();return false;">Paste/Import</a>'
|
||||
+'<a onclick="window.plugin.bookmarks.optReset();return false;">Reset</a>'
|
||||
+'<a onclick="window.plugin.bookmarks.optShare();">Share all Bookmarks (only mobile)</a>'
|
||||
+'<a onclick="window.plugin.bookmarks.optBox(\'save\');">Save box position (only desktop)</a>'
|
||||
+'<a onclick="window.plugin.bookmarks.optBox(\'reset\');">Reset box position (only desktop)</a>'
|
||||
+'</div>';
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************************************/
|
||||
|
||||
var setup = function() {
|
||||
// Fired when a bookmarks/folder is removed, added or sorted, also when a folder is opened/closed.
|
||||
if($.inArray('pluginBkmrksEdit', window.VALID_HOOKS) < 0) { window.VALID_HOOKS.push('pluginBkmrksEdit'); }
|
||||
// Fired when the "Bookmarks Options" panell is opened (you can add new options);
|
||||
if($.inArray('pluginBkmrksOpenOpt', window.VALID_HOOKS) < 0) { window.VALID_HOOKS.push('pluginBkmrksOpenOpt'); }
|
||||
|
||||
// If the storage not exists or is a old version
|
||||
window.plugin.bookmarks.createStorage();
|
||||
window.plugin.bookmarks.upgradeToNewStorage();
|
||||
|
||||
// Load data from localStorage
|
||||
window.plugin.bookmarks.loadStorage();
|
||||
window.plugin.bookmarks.loadStorageBox();
|
||||
window.plugin.bookmarks.setupContent();
|
||||
window.plugin.bookmarks.setupCSS();
|
||||
|
||||
if(!window.plugin.bookmarks.isSmart) {
|
||||
$('body').append(window.plugin.bookmarks.htmlBoxTrigger + window.plugin.bookmarks.htmlBkmrksBox);
|
||||
$('#bookmarksBox').draggable({ handle:'.handle', containment:'window' });
|
||||
$("#bookmarksBox #bookmarksMin , #bookmarksBox ul li, #bookmarksBox ul li a, #bookmarksBox ul li a span, #bookmarksBox h5, #bookmarksBox .addForm a").disableSelection();
|
||||
$('#bookmarksBox').css({'top':window.plugin.bookmarks.statusBox.pos.x, 'left':window.plugin.bookmarks.statusBox.pos.y});
|
||||
}else{
|
||||
$('#portaldetails').before(window.plugin.bookmarks.htmlBoxTrigger + window.plugin.bookmarks.htmlBkmrksBox);
|
||||
|
||||
// Remove the star
|
||||
// in the future i hope in a 'portalClosed' hook
|
||||
window.unselectOldPortal = function() {
|
||||
var oldPortal = portals[selectedPortal];
|
||||
if(oldPortal) portalResetColor(oldPortal);
|
||||
selectedPortal = null;
|
||||
$('#portaldetails').html('');
|
||||
if(isSmartphone()) {
|
||||
$('.fullimg').remove();
|
||||
$('#mobileinfo').html('');
|
||||
}
|
||||
clearPortalIndicators();
|
||||
$('.bkmrksStar').remove();
|
||||
}
|
||||
|
||||
}
|
||||
$('#toolbox').append(window.plugin.bookmarks.htmlCallSetBox+window.plugin.bookmarks.htmlCalldrawBox);
|
||||
|
||||
window.plugin.bookmarks.loadList('maps');
|
||||
window.plugin.bookmarks.loadList('portals');
|
||||
window.plugin.bookmarks.jquerySortableScript();
|
||||
|
||||
if(window.plugin.bookmarks.statusBox['show'] === 0) { window.plugin.bookmarks.switchStatusBkmrksBox(0); }
|
||||
if(window.plugin.bookmarks.statusBox['page'] === 1) { $('#bookmarksBox h5.bkmrk_portals').trigger('click'); }
|
||||
|
||||
window.addHook('portalDetailsUpdated', window.plugin.bookmarks.addStarToSidebar);
|
||||
window.addHook('pluginBkmrksEdit', window.plugin.bookmarks.syncBkmrks);
|
||||
window.addHook('iitcLoaded', window.plugin.bookmarks.registerFieldForSyncing);
|
||||
}
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
@ -1,99 +0,0 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-data-freezer@zaso
|
||||
// @name IITC plugin: Data Freezer
|
||||
// @category Tweaks
|
||||
// @version 0.1.2.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Disables the automatic data refresh.
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
// use own namespace for plugin
|
||||
window.plugin.dataFreezer = function() {};
|
||||
|
||||
window.plugin.dataFreezer.noMoreData = 1000000;
|
||||
window.plugin.dataFreezer.defaultVal = 1.25;
|
||||
window.plugin.dataFreezer.storageKEY = 'plugin-data-freezer-status';
|
||||
window.plugin.dataFreezer.status;
|
||||
|
||||
if(!localStorage[window.plugin.dataFreezer.storageKEY]) {
|
||||
localStorage[window.plugin.dataFreezer.storageKEY] = 1;
|
||||
}
|
||||
if(localStorage[window.plugin.dataFreezer.storageKEY] === '1') {
|
||||
window.plugin.dataFreezer.status = true;
|
||||
window.ON_MOVE_REFRESH = window.plugin.dataFreezer.noMoreData;
|
||||
window.mapRunsUserAction = true;
|
||||
} else {
|
||||
window.plugin.dataFreezer.status = false;
|
||||
}
|
||||
|
||||
window.plugin.dataFreezer.toggle = function() {
|
||||
if(!window.plugin.dataFreezer.status) {
|
||||
window.plugin.dataFreezer.status = true;
|
||||
window.ON_MOVE_REFRESH = window.plugin.dataFreezer.noMoreData;
|
||||
localStorage[window.plugin.dataFreezer.storageKEY] = 1;
|
||||
} else {
|
||||
window.plugin.dataFreezer.status = false;
|
||||
window.ON_MOVE_REFRESH = window.plugin.dataFreezer.defaultVal;
|
||||
localStorage[window.plugin.dataFreezer.storageKEY] = 0;
|
||||
}
|
||||
|
||||
window.plugin.dataFreezer.setupCSS();
|
||||
map.zoomOut(1, {animate:false});
|
||||
map.zoomIn(1, {animate:false});
|
||||
}
|
||||
|
||||
window.plugin.dataFreezer.setupCSS = function() {
|
||||
if(window.plugin.dataFreezer.status === true) {
|
||||
$('a.dataFreezer').css({'background':'#f66','outline':'none'});
|
||||
} else {
|
||||
$('a.dataFreezer').css({'background':'#03DC03','outline':'none'});
|
||||
}
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
L.Control.Command = L.Control.extend({
|
||||
options:{position: 'topleft'},
|
||||
|
||||
onAdd:function(map) {
|
||||
var controlDiv = L.DomUtil.create('div', 'leaflet-dataFreezer leaflet-control');
|
||||
var controlSubDIV = L.DomUtil.create('div', 'leaflet-bar', controlDiv);
|
||||
var butt = L.DomUtil.create('a', 'dataFreezer', controlSubDIV);
|
||||
butt.title = 'Enable/Disable data refresh';
|
||||
|
||||
L.DomEvent
|
||||
.addListener(controlDiv, 'click', L.DomEvent.stopPropagation)
|
||||
.addListener(controlDiv, 'click', L.DomEvent.preventDefault)
|
||||
.addListener(controlDiv, 'dblclick', L.DomEvent.stopPropagation)
|
||||
.addListener(controlDiv, 'dblclick', L.DomEvent.preventDefault)
|
||||
.addListener(butt, 'click', function() {
|
||||
window.plugin.dataFreezer.toggle();
|
||||
});
|
||||
return controlDiv;
|
||||
}
|
||||
});
|
||||
L.control.command = function(options) { return new L.Control.Command(options); };
|
||||
|
||||
map.addControl(new L.control.command());
|
||||
window.plugin.dataFreezer.setupCSS();
|
||||
|
||||
window.addHook('checkRenderLimit', function() {
|
||||
if(window.plugin.dataFreezer.status) {
|
||||
window.mapRunsUserAction = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
Loading…
x
Reference in New Issue
Block a user