Nnuo %!s(int64=8) %!d(string=hai) anos
pai
achega
4274829f2d

+ 4 - 34
resources/app/browser.html

@@ -15,9 +15,9 @@
             <button class="BrowwerAdd"></button>
         </ul>
         <section style="-webkit-app-region: no-drag" class="bowerHeaderMenu clearfix">
-        <button type="button" class="icon-window-minimize min"></button>
-        <button type="button" class="icon-window-maximize max"></button>
-        <button type="button" class="icon-times close" style="font-size:16px"></button>
+            <button type="button" class="icon-window-minimize min"></button>
+            <button type="button" class="icon-window-maximize max"></button>
+            <button type="button" class="icon-times close" style="font-size:16px"></button>
         </section>
     </section>
     <ul class="bowerHeaderSeach" id="CampusInfoBrowserHeaderSeach">
@@ -30,18 +30,12 @@
         </li>
         <li class="bowerMenu" id="bowerMenu">
           <span class="icon-th-list"></span>
-          <!-- <ul class="OnclickMenu" id="CampusInfoBrowserOnclickMenu">
-            <li>关于我们</li>
-            <li>反馈</li>
-            <li onclick="CampusInfoBrowser.OnclickMenu.History()">历史记录</li>
-            <li onclick="CampusInfoBrowser.OnclickMenu.clear()">清除缓存</li>
-        </ul> -->
         </li>
         <ul class="OnclickMenu" id="CampusInfoBrowserOnclickMenu">
             <li>关于我们</li>
             <li>反馈</li>
             <li onclick="CampusInfoBrowser.OnclickMenu.History()">历史记录</li>
-            <li onclick="CampusInfoBrowser.OnclickMenu.clear()">清除缓存</li>
+            <li onclick="CampusInfoBrowser.OnclickMenu.Clear()">清除缓存</li>
         </ul>
     </ul>
     <ul class="MouseMenuMain" id="CampusInfoBrowserMenu">
@@ -55,29 +49,5 @@
     </ul>
 </body>
 <script src="./public/js/uform.js"></script>
-<!-- <script src="./public/js/uformd.js"></script> -->
 <script src="./public/js/browser.js"></script>
-<script>
-var ipc=require('electron').ipcRenderer;
-var isBig=true;//窗口放大还原标示
-$(".close")[0].onclick=function(){//关闭窗口
-    ipc.send('window-all-closed');
-};
-$(".max")[0].onclick=function(){//最大化
-    if(isBig){
-        ipc.send('show-window');
-        $(".max")[0].className='icon-window-restore max';
-        $(".bowerCreaterWindow")[0].style.padding = "0";
-        
-    }else{
-        ipc.send('orignal-window');
-        $(".max")[0].className='icon-window-maximize max';
-        $(".bowerCreaterWindow")[0].style.padding = "15px 0 0";
-    }
-    isBig=!isBig;
-};
-$(".min")[0].onclick=function(){//最小化
-    ipc.send('hide-window');
-};
-</script>
 </html>

+ 47 - 0
resources/app/history.html

@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>历史记录</title>
+    <link rel="stylesheet" href="./public/css/uform.css">
+    <link rel="stylesheet" href="./public/css/browser.css">
+</head>
+<body style="overflow-y: auto">
+<section style="-webkit-app-region: drag" class="bowerHeader">
+    <section style="-webkit-app-region: no-drag" class="bowerHeaderMenu clearfix">
+        <button type="button" class="icon-times newBrowserClose" style="font-size:16px"></button>
+    </section>
+    <div class="BrowserHistoryTitle">历史记录</div>
+</section>
+<div class="CampusInfoBrowserHistory"></div>
+<script src="./public/js/uform.js"></script>
+<script>
+    const electron = require('electron');
+    var ipc=require('electron').ipcRenderer;
+    var BrowserHistory = $(".CampusInfoBrowserHistory")[0];
+    for (a in localStorage) {
+        var str = localStorage[a];
+        var storage = JSON.parse(str)
+        HistoryBody=$$("div", {
+            "className": "history_body","title":storage.title,
+        }, BrowserHistory);
+        var first=BrowserHistory.firstChild;//得到第一个元素 
+        BrowserHistory.insertBefore(HistoryBody,first);//在得到的第一个元素之前插入 
+        HistoryBody.time=$$("span", {
+            "className": "history_time","innerHTML":storage.time,
+        }, HistoryBody);
+        HistoryBody.title=$$("p", {
+            "className": "history_title","innerHTML":storage.title,
+        }, HistoryBody);
+        HistoryBody.url=$$("p", {
+            "className": "history_url","innerHTML":storage.url,
+        }, HistoryBody);
+    }
+    $(".newBrowserClose")[0].onclick=function(){
+        ipc.send('BrowserWindow-hide-window');
+    }
+</script>
+</body>
+</html>

+ 51 - 7
resources/app/public/css/browser.css

@@ -10,13 +10,14 @@
 body{
     margin: 0;
     padding: 0;
+    overflow: hidden;
 }
 ul,li{
     margin: 0;
     padding: 0;
     list-style: none;
 }
-button:focus,button{
+button:focus,button{    
     outline: none;
     cursor: pointer;
 }
@@ -291,16 +292,18 @@ button.BrowwerAdd {
     background: #e8e8e8;
     margin: 5px 0;
 }
-.HistoryBody {
+/* .HistoryBody {
     padding-right: 25px;
 }
 .BrowserHistory{
-    left: 20% !important;
+    left: auto;
     width: 60% !important;
     padding: 0 20px;
+    margin: 0 auto;
     box-shadow: rgb(202, 202, 202) 0px 0px 30px 5px !important;
     border: 1px solid #e4e4e4 !important;
     background-color: #fff !important;
+    z-index: 999 !important;
 }
 .BrowserHistoryTitle{
     padding: 5px 0;
@@ -315,16 +318,57 @@ button.BrowwerAdd {
 .history_body {
     overflow: hidden;
     width: 100%;
-    height: 18px;
     line-height: 20px;
-    margin: 3px 0;
+    margin: 3px 0 10px;
+    display: inline-flex;
 }
 .history_body span{
     margin-right: 20px;
 }
-.history_title{
-    max-width: 100px;
+.history_body p {
+    max-width: 35%;
+    height: 20px;
+    margin-right: 20px;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    line-height: 20px;
+} */
+
+
+
+
+/* new history */
+.BrowserHistoryTitle {
+    padding: 5px 0;
+    text-align: center;
+    font-size: 16px;
+    color: #676767;
+}
+.CampusInfoBrowserHistory {
+    padding: 30px;
+    color: #505050;
+    font-size: 14px;
+}
+.history_body span {
+    padding-right: 20px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    width: 180px;
+}
+.history_body p {
+    width: 270px;
+    height: 20px;
+    padding-right: 20px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+.history_body {
+    display: inline-flex;
+    margin-bottom: 10px;
+    overflow: hidden;
+    text-overflow: ellipsis;
 }
+/* new history end */
 /* CampusInfo-AboutUs */
 .CampusInfo-AboutUs{
     min-width: 1180px;

+ 27 - 38
resources/app/public/js/browser.js

@@ -1,6 +1,9 @@
+const electron = require('electron');
 const url = require('url');
 const remote = require('electron').remote;
 const Menu = remote.Menu;
+const BrowserWindow = electron.BrowserWindow;
+var ipc=require('electron').ipcRenderer;
 Namespace.register("CampusInfoBrowser");//注册命名空间
 CampusInfoBrowser.CreatBrower=function (address) {//创建窗口
     var http = /^(http)/;
@@ -280,6 +283,7 @@ CampusInfoBrowser.Init=function () {//初始化
     CampusInfoBrowser.UrlArea=$(".bowerSeach input")[0];//获取搜索框
     CampusInfoBrowser.NavContainer=$(".bowerCreaterWindow")[0];//获取标签页ul
     CampusInfoBrowser.AddButton=$(".BrowwerAdd")[0];//获取新建标签页按钮
+    CampusInfoBrowser.BrowserHistory = $(".BrowserHistory")[0];
     CampusInfoBrowser.BrowersMenuButtom=$("#bowerMenu")[0];//获取打开菜单
     CampusInfoBrowser.MouseMenuMain=$("#CampusInfoBrowserMenu")[0];//获取右键菜单
     CampusInfoBrowser.OnclickMenu=$("#CampusInfoBrowserOnclickMenu")[0];//获取菜单
@@ -320,46 +324,31 @@ CampusInfoBrowser.Init=function () {//初始化
     };
     setInterval('CampusInfoBrowser.Action()',1000);
     CampusInfoBrowser.OnclickMenu.History=function(){
-        var History = new U.UF.UI.form("历史记录",$$("div", 
-            {"className":"HistoryBody",}),
-            { "style": { "width": "570px", "height": "80%", "maxHeight": "700px", "position":"aboulute","top":"20%","left":"50%"} },
-            { "isenlarge": false,"isnarrow": false}
-        );
-        History.form.className ="BrowserHistory";
-        History.form.children[1].className ="BrowserHistoryTitle";
-        History.form.children[4].className ="BrowserHistoryClose";
-        for (a in localStorage) {
-            var str = localStorage[a];
-            var storage = JSON.parse(str)
-            var BrowserHistory = $(".BrowserHistory")[0];
-            var HistoryBody = $(".HistoryBody")[0];
-            HistoryBody.body=$$("div", {
-                "className": "history_body","title":storage.title,
-            });
-            var first=HistoryBody.firstChild;//得到第一个元素 
-            History.form.children[2].children[0].style.height ="660px"
-            HistoryBody.insertBefore(HistoryBody.body,first);//在得到的第一个元素之前插入 
-            HistoryBody.time=$$("span", {
-                "className": "history_time","innerHTML":storage.time,"draggable":"false"
-            }, HistoryBody.body);
-            HistoryBody.title=$$("span", {
-                "className": "history_title","innerHTML":storage.title,"draggable":"false"
-            }, HistoryBody.body);
-            HistoryBody.url=$$("span", {
-                "className": "history_url","innerHTML":storage.url,"draggable":"false"
-            }, HistoryBody.body);
-            HistoryBody.url.onclick=function(){
-                CampusInfoBrowser.CreatBrower(this.innerHTML);
-                $("body")[0].removeChild(History.form);
-            }
-        }
-        $(".BrowserHistoryClose")[0].onclick=function(){
-            $("body")[0].removeChild(History.form);
-        }
+        ipc.send('BrowserWindow-show-window');
     }
-    CampusInfoBrowser.OnclickMenu.clear=function(){
+    CampusInfoBrowser.OnclickMenu.Clear=function(){
         localStorage.clear();
     }
-  
+    var isBig=true;//窗口放大还原标示
+    $(".close")[0].onclick=function(){//关闭窗口
+        ipc.send('window-all-closed');
+    };
+    $(".max")[0].onclick=function(){//最大化
+        if(isBig){
+            ipc.send('show-window');
+            $(".max")[0].className='icon-window-restore max';
+            $(".bowerCreaterWindow")[0].style.padding = "0";
+            
+        }else{
+            ipc.send('orignal-window');
+            $(".max")[0].className='icon-window-maximize max';
+            $(".bowerCreaterWindow")[0].style.padding = "15px 0 0";
+        }
+        isBig=!isBig;
+    };
+    $(".min")[0].onclick=function(){//最小化
+        ipc.send('hide-window');
+    };
+    
     CampusInfoBrowser.CreatBrower('https://www.baidu.com');//开始进入一个页面
 }();

+ 30 - 0
resources/app/start.js

@@ -5,6 +5,7 @@ const ipc = electron.ipcMain;
 const app = electron.app;
 const BrowserWindow = electron.BrowserWindow;
 let mainWindow;
+let newBrowserWindow
 ipc.on('window-all-closed', function () {//退出
     app.quit();
 });
@@ -34,6 +35,35 @@ function createWindow() {
     mainWindow.on('closed', function () {
         mainWindow = null
     });
+    newBrowserWindow = new BrowserWindow({
+        width: 800, 
+        frame: false
+    })
+    newBrowserWindow.loadURL(url.format({
+        pathname: path.join(__dirname, 'history.html'),
+        protocol: 'file:',
+        slashes: true
+    }));
+    ipc.on('BrowserWindow-show-window', function () {//显示
+        newBrowserWindow = new BrowserWindow({
+            width: 800, 
+            frame: false
+        })
+        newBrowserWindow.loadURL(url.format({
+            pathname: path.join(__dirname, 'history.html'),
+            protocol: 'file:',
+            slashes: true
+        }));
+    });
+    ipc.on('BrowserWindow-hide-window', function () {//隐藏
+        app.exit();
+        newBrowserWindow = null
+    });
+    newBrowserWindow.webContents.openDevTools();
+    newBrowserWindow.on('closed', function () {
+        newBrowserWindow = null
+    });
+    
 }
 app.on('ready', createWindow);
 app.on('window-all-closed', function () {