|
@@ -574,23 +574,27 @@ US_Browser.HeadBind=function(){
|
|
|
})
|
|
})
|
|
|
window.localStorage.setItem('arr', JSON.stringify(c))
|
|
window.localStorage.setItem('arr', JSON.stringify(c))
|
|
|
}
|
|
}
|
|
|
- $('#FavoritesUl')[0].innerHTML += `<li onclick="US_Browser.gotoLove('${US_Browser.SelecteWebview.src}')">
|
|
|
|
|
- <img class="tag_favicon" draggable="true" style="display: block;" src=${$('.BrowerActive')[0].children[0].children[0].src}>
|
|
|
|
|
- <p class="Webname" draggable="true">${US_Browser.SelecteWebview.getTitle()}</p>
|
|
|
|
|
- </li>`
|
|
|
|
|
|
|
+ US_Browser.xuanrang(US_Browser.SelecteWebview.src, $('.BrowerActive')[0].children[0].children[0].src, US_Browser.SelecteWebview.getTitle())
|
|
|
$('#LoveWebSize')[0].className = 'fa fa-heart'
|
|
$('#LoveWebSize')[0].className = 'fa fa-heart'
|
|
|
|
|
+ US_Browser.drag()
|
|
|
}
|
|
}
|
|
|
US_Browser.Loveitem = () => {
|
|
US_Browser.Loveitem = () => {
|
|
|
- if (window.localStorage.getItem('arr') === null){ return }
|
|
|
|
|
|
|
+ if (window.localStorage.getItem('arr') === null){
|
|
|
|
|
+ let data = [
|
|
|
|
|
+ {
|
|
|
|
|
+ "url":"http://www.1473.cn/",
|
|
|
|
|
+ "icon":"./public/img/tray/logo.png",
|
|
|
|
|
+ "title":"云端 - 1473.cn"
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ data.map((i, j) => {
|
|
|
|
|
+ US_Browser.xuanrang(i.url, i.icon, i.title)
|
|
|
|
|
+ window.localStorage.setItem('arr', `[{"url": "${i.url}","icon": "${i.icon}", "title": "${i.title}"}]`)
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
JSON.parse(window.localStorage.getItem('arr')).map((i, j) => {
|
|
JSON.parse(window.localStorage.getItem('arr')).map((i, j) => {
|
|
|
- $('#FavoritesUl')[0].innerHTML += `<li onclick="US_Browser.gotoLove('${i.url}')">
|
|
|
|
|
- <img class="tag_favicon" draggable="true" style="display: block;" src=${i.icon}>
|
|
|
|
|
- <p class="Webname" draggable="true">${i.title}</p>
|
|
|
|
|
- </li>`
|
|
|
|
|
- $('.MouseMenuMainer')[0].innerHTML += `<li onclick="US_Browser.gotoLove('${i.url}')">
|
|
|
|
|
- <img class="tag_favicon" draggable="true" style="display: block;" src=${i.icon}>
|
|
|
|
|
- <p class="Webname" draggable="true">${i.title}</p>
|
|
|
|
|
- </li>`
|
|
|
|
|
|
|
+ US_Browser.xuanrang(i.url, i.icon, i.title)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
US_Browser.IsLove = (msg) => {
|
|
US_Browser.IsLove = (msg) => {
|
|
@@ -605,6 +609,20 @@ US_Browser.HeadBind=function(){
|
|
|
US_Browser.SelecteWebview.src = msg
|
|
US_Browser.SelecteWebview.src = msg
|
|
|
US_Browser.MouseMenuMainer.style.display = 'none'
|
|
US_Browser.MouseMenuMainer.style.display = 'none'
|
|
|
}
|
|
}
|
|
|
|
|
+ US_Browser.xuanrang = (url, icon, title) => {
|
|
|
|
|
+ $('#FavoritesUl')[0].innerHTML += `<li class="column" draggable="true" data='${url}'>
|
|
|
|
|
+ <div onclick="US_Browser.gotoLove('${url}')">
|
|
|
|
|
+ <img class="tag_favicon" draggable="true" style="display: block;" src=${icon}>
|
|
|
|
|
+ <p class="Webname" draggable="true"><nobr>${title}</nobr></p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </li>`
|
|
|
|
|
+ $('.MouseMenuMainer')[0].innerHTML += `<li class="column" draggable="true" data='${url}'>
|
|
|
|
|
+ <div onclick="US_Browser.gotoLove('${url}')">
|
|
|
|
|
+ <img class="tag_favicon" draggable="true" style="display: block;" src=${icon}>
|
|
|
|
|
+ <p class="Webname" draggable="true">${title}</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </li>`
|
|
|
|
|
+ }
|
|
|
US_Browser.FavoritesMore.onclick = () => {
|
|
US_Browser.FavoritesMore.onclick = () => {
|
|
|
US_Browser.MouseMenuMainer.style.display = 'block'
|
|
US_Browser.MouseMenuMainer.style.display = 'block'
|
|
|
}
|
|
}
|
|
@@ -695,6 +713,94 @@ US_Browser.HeadBind=function(){
|
|
|
US_Browser.CampusInfo();
|
|
US_Browser.CampusInfo();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+ US_Browser.drag = function() {
|
|
|
|
|
+ US_Browser.columns = document.querySelectorAll('#FavoritesUl .column');
|
|
|
|
|
+ US_Browser.dragEl = null;
|
|
|
|
|
+ [].forEach.call(US_Browser.columns,function(column){
|
|
|
|
|
+ column.addEventListener("dragstart",US_Browser.domdrugstart,false);
|
|
|
|
|
+ column.addEventListener('dragenter', US_Browser.domdrugenter, false);
|
|
|
|
|
+ column.addEventListener('dragover', US_Browser.domdrugover, false);
|
|
|
|
|
+ column.addEventListener('dragleave', US_Browser.domdrugleave, false);
|
|
|
|
|
+ column.addEventListener('drop', US_Browser.domdrop, false);
|
|
|
|
|
+ column.addEventListener('dragend', US_Browser.domdrapend, false);
|
|
|
|
|
+ column.addEventListener('mousedown', US_Browser.onmousedown, false);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.onmousedown = function(e){
|
|
|
|
|
+ let btnNum = e.button;
|
|
|
|
|
+ let BookmarkSet = document.querySelector('#US_BookmarkSet')
|
|
|
|
|
+ if(btnNum==2){
|
|
|
|
|
+ BookmarkSet.style.display = 'block'
|
|
|
|
|
+ BookmarkSet.style.top = `${e.clientY}px`
|
|
|
|
|
+ BookmarkSet.style.left = `${e.clientX}px`
|
|
|
|
|
+ US_Browser.DelectBookmarktar = this
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrugstart = function(e) {
|
|
|
|
|
+
|
|
|
|
|
+ US_Browser.dragEl = this;
|
|
|
|
|
+
|
|
|
|
|
+ e.dataTransfer.setData("text/html",this.innerHTML);
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrugenter = function(e) {
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrugover = function(e) {
|
|
|
|
|
+ if (e.preventDefault) {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ e.dataTransfer.dropEffect = 'move';
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrugleave = function(e) {
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrop = function(e) {
|
|
|
|
|
+ if (e.stopPropagation) {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (US_Browser.dragEl != this) {
|
|
|
|
|
+ US_Browser.dragEl.innerHTML = this.innerHTML;
|
|
|
|
|
+ this.innerHTML = e.dataTransfer.getData('text/html');
|
|
|
|
|
+ }
|
|
|
|
|
+ let arr = JSON.parse(window.localStorage.getItem('arr'));
|
|
|
|
|
+ let thiser = US_Browser.getchild(this)
|
|
|
|
|
+ let laster = US_Browser.getchild(US_Browser.dragEl)
|
|
|
|
|
+ let car = arr[thiser]
|
|
|
|
|
+ arr[thiser] = arr[laster]
|
|
|
|
|
+ arr[laster] = car
|
|
|
|
|
+ window.localStorage.setItem('arr', JSON.stringify(arr))
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.domdrapend = function(e) {
|
|
|
|
|
+ [].forEach.call(US_Browser.columns, function (column) {
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.getchild = function(msg){
|
|
|
|
|
+ var i=0;
|
|
|
|
|
+ while(msg = msg.previousSibling){
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+ return i - 1
|
|
|
|
|
+ }
|
|
|
|
|
+ US_Browser.DelectBookmark.onclick = function(){
|
|
|
|
|
+ let BookmarkSet = document.querySelector('#US_BookmarkSet')
|
|
|
|
|
+ BookmarkSet.style.display = 'none'
|
|
|
|
|
+ let b = JSON.parse(window.localStorage.getItem('arr'))
|
|
|
|
|
+ b.map((i, j) => {
|
|
|
|
|
+ if (i.url === US_Browser.DelectBookmarktar.getAttribute('data')) {
|
|
|
|
|
+ let arr = JSON.parse(window.localStorage.getItem('arr'))
|
|
|
|
|
+ arr.splice(j, 1);
|
|
|
|
|
+ window.localStorage.setItem('arr', JSON.stringify(arr))
|
|
|
|
|
+ $('#FavoritesUl')[0].removeChild($('#FavoritesUl')[0].children[j + 3])
|
|
|
|
|
+ US_Browser.DelectBookmarktar.style.display = 'none';
|
|
|
|
|
+ if(i.url === US_Browser.SelecteWebview.src){
|
|
|
|
|
+ $('#LoveWebSize')[0].className = 'fa fa-heart'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
US_Browser.Head[0].style.color = '#d3d3d3';
|
|
US_Browser.Head[0].style.color = '#d3d3d3';
|
|
|
US_Browser.Head[1].style.color = '#d3d3d3';
|
|
US_Browser.Head[1].style.color = '#d3d3d3';
|
|
|
US_Browser.Head[2].style.color = '#d3d3d3';
|
|
US_Browser.Head[2].style.color = '#d3d3d3';
|
|
@@ -715,6 +821,8 @@ US_Browser.Init=function () {//初始化
|
|
|
US_Browser.MenuGo=$(".US_Browers_go")[0];
|
|
US_Browser.MenuGo=$(".US_Browers_go")[0];
|
|
|
US_Browser.FavoritesMore = $('.FavoritesMore')[0]
|
|
US_Browser.FavoritesMore = $('.FavoritesMore')[0]
|
|
|
US_Browser.MouseMenuMainer = $('.MouseMenuMainer')[0]
|
|
US_Browser.MouseMenuMainer = $('.MouseMenuMainer')[0]
|
|
|
|
|
+ US_Browser.DelectBookmark = $('#DelectBookmark')[0]
|
|
|
|
|
+ US_Browser.DelectBookmarktar = ''
|
|
|
US_Browser.Elm[0].onkeyup=function (e) {//查找的input
|
|
US_Browser.Elm[0].onkeyup=function (e) {//查找的input
|
|
|
if(this.value.length&&e.keyCode!==8){//如果存在值
|
|
if(this.value.length&&e.keyCode!==8){//如果存在值
|
|
|
US_Browser.SelecteWebview.findInPage(this.value);
|
|
US_Browser.SelecteWebview.findInPage(this.value);
|
|
@@ -732,4 +840,7 @@ US_Browser.Init=function () {//初始化
|
|
|
US_Browser.HeadBind();
|
|
US_Browser.HeadBind();
|
|
|
US_Browser.IpcBind();
|
|
US_Browser.IpcBind();
|
|
|
US_Browser.Loveitem();
|
|
US_Browser.Loveitem();
|
|
|
-}();
|
|
|
|
|
|
|
+}();
|
|
|
|
|
+window.onload = function () {
|
|
|
|
|
+ US_Browser.drag();
|
|
|
|
|
+}
|