Jelajahi Sumber

增加放大功能

nn 8 tahun lalu
induk
melakukan
51865a3597

+ 19 - 13
resources/app/browser.html

@@ -12,9 +12,9 @@
 <body>
     <section style="-webkit-app-region: drag" class="bowerHeader">
       <section style="-webkit-app-region: no-drag" class="bowerHeaderMenu clearfix">
-        <button type="button" style="display: none">max</button>
-        <button type="button" class="icon-minus"></button>
-        <button type="button" class="icon-cancel"></button>
+        <button type="button" class="icon-minus min"></button>
+        <button type="button" class="icon-window-restore max"></button>
+        <button type="button" class="icon-cancel close"></button>
       </section>
     </section>
     <ul class="bowerCreaterWindow" style="-webkit-app-region: drag">
@@ -29,7 +29,7 @@
           <input type="text" placeholder="网址" id="seachInput">
         </li>
         <li class="bowerMenu" id="bowerMenu">
-          <span class="icon-menu"></span>
+          <span class="icon-th-list"></span>
         </li>
     </ul>
     <ul class="MouseMenuMain" id="CampusInfoBrowserMenu">
@@ -45,17 +45,23 @@
 <script src="./public/js/uform.js"></script>
 <script src="./public/js/browser.js"></script>
 <script>
-    const electron = require('electron');//electron主进程
-    const ipc = electron.ipcRenderer;//ipc命令集合
-    var bowerHeaderMenu=$(".bowerHeaderMenu button");
-    bowerHeaderMenu[0].addEventListener('click',function (){
-        ipc.send('window-max');
+    var ipc=require('electron').ipcRenderer;
+    var isBig=true;//窗口放大还原标示
+    $(document).on("click",".close",function(){ //关闭窗口
+        ipc.send('window-all-closed');
     });
-    bowerHeaderMenu[1].addEventListener('click',function (){
-        ipc.send('window-min');
+    $(document).on("click",".max",function () {//最大化
+        if(isBig){
+            // $(this).children().attr('src','images/restore.png');
+            ipc.send('show-window');
+        }else{
+            // $(this).children().attr('src','images/max.png');
+            ipc.send('orignal-window');
+        }
+        isBig=!isBig;
     });
-    bowerHeaderMenu[2].addEventListener('click',function (){
-        ipc.send('window-close');
+    $(document).on("click",".min",function () { //最小化
+        ipc.send('hide-window');
     });
     
 </script>

+ 84 - 48
resources/app/public/css/browser.css

@@ -56,7 +56,7 @@ ul,li{
     width: 30px;
     padding: 8px 5px;
     text-align: center;
-    color: #d3d3d3;
+    color: #5a5a5a;
 }
 .bowerHeaderSeach .bowerSeach{
     position: relative;
@@ -85,7 +85,6 @@ ul,li{
 }
 .bowerHeaderSeach .bowerMenu {
     float: right;
-    padding: 6px;
 }
 .bowerHeaderSeach .bowerMenu:hover{
     background: #ddd;
@@ -160,7 +159,7 @@ ul,li{
 }
 .bowerCreaterWindow {
     float: left;
-    width: calc(100% - 120px);
+    width: calc(100% - 195px);
     height: 29px;
     display: inline-flex;
     overflow: unset;
@@ -221,51 +220,6 @@ button.BrowwerAdd {
     height: 100% !important;
     width: 100% !important;
 }
-
-*{
-    margin: 0;
-    padding: 0;
-    font-family:Microsoft YaHei,fontello;
-    -webkit-font-smoothing: antialiased;
-    -moz-osx-font-smoothing: grayscale;
-    list-style: none;
-}
-button:focus,button{
-    outline: none;
-    cursor: pointer;
-}
-@font-face {
-    font-family: 'fontello';
-    src: url('../font/fontello.eot?70736739');
-    src: url('../font/fontello.eot?70736739#iefix') format('embedded-opentype'),
-    url('../font/fontello.woff2?70736739') format('woff2'),
-    url('../font/fontello.woff?70736739') format('woff'),
-    url('../font/fontello.ttf?70736739') format('truetype'),
-    url('../font/fontello.svg?70736739#fontello') format('svg');
-    font-weight: normal;
-    font-style: normal;
-}
-[class^="icon-"], [class*=" icon-"]{
-    display: inline-block;
-    font: normal normal normal 14px/1 fontello,Microsoft YaHei;
-    font-size: inherit;
-    text-rendering: auto;
-    -webkit-font-smoothing: antialiased;
-    -moz-osx-font-smoothing: grayscale;
-}
-
-.icon-left:before { content: '\e800'; }
-.icon-right:before { content: '\e801'; }
-.icon-cancel:before { content: '\e802'; }
-.icon-minus:before { content: '\e803'; }
-.icon-menu:before { content: '\e804'; }
-.icon-play-circled2:before { content: '\e805'; }
-.icon-play:before { content: '\e806'; }
-.icon-lock:before { content: '\e807'; }
-.icon-th-list:before { content: '\f009'; }
-.icon-ccw:before { content: '\f025'; }
-.icon-play-circled:before { content: '\f144'; }
-
 .MouseMenuMain {
     position:absolute;
     z-index:22;
@@ -300,4 +254,86 @@ button:focus,button{
     height: 1px;
     background: #e8e8e8;
     margin: 5px 0;
+}
+*{
+    margin: 0;
+    padding: 0;
+    font-family:Microsoft YaHei,fontello;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    list-style: none;
+}
+button:focus,button{
+    outline: none;
+    cursor: pointer;
+}
+@font-face {
+    font-family: 'fontello';
+    src: url('../font/fontello.eot?70736739');
+    src: url('../font/fontello.eot?70736739#iefix') format('embedded-opentype'),
+    url('../font/fontello.woff2?70736739') format('woff2'),
+    url('../font/fontello.woff?70736739') format('woff'),
+    url('../font/fontello.ttf?70736739') format('truetype'),
+    url('../font/fontello.svg?70736739#fontello') format('svg');
+    font-weight: normal;
+    font-style: normal;
+}
+[class^="icon-"], [class*=" icon-"]{
+    display: inline-block;
+    font: normal normal normal 14px/1 fontello,Microsoft YaHei;
+    font-size: inherit;
+    text-rendering: auto;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+}
+.icon-left:before {
+    content: "\e800";
+}
+.icon-right:before {
+    content: "\e801";
+}
+.icon-cancel:before {
+    content: "\e802";
+}
+.icon-minus:before {
+    content: "\e803";
+}
+.icon-menu:before {
+    content: "\e804";
+}
+.icon-play-circled2:before {
+    content: "\e805";
+}
+.icon-play:before {
+    content: "\e806";
+}
+.icon-lock:before {
+    content: "\e807";
+}
+.icon-plus:before {
+    content: "\e808";
+}
+.icon-cog:before {
+    content: "\e809";
+}
+.icon-th-list:before {
+    content: "\f009";
+}
+.icon-ccw:before {
+    content: "\f025";
+}
+.icon-play-circled:before {
+    content: "\f144";
+}
+.icon-times:before {
+    content: "\ebc4";
+}
+.icon-window-maximize:before {
+    content: "\ec0f";
+}
+.icon-window-minimize:before {
+    content: "\ec10";
+}
+.icon-window-restore:before {
+    content: "\ec11";
 }

TEMPAT SAMPAH
resources/app/public/font/fontello.eot


File diff ditekan karena terlalu besar
+ 24 - 29
resources/app/public/font/fontello.svg


TEMPAT SAMPAH
resources/app/public/font/fontello.ttf


TEMPAT SAMPAH
resources/app/public/font/fontello.woff


+ 4 - 2
resources/app/public/js/browser.js

@@ -181,11 +181,12 @@ CampusInfoBrowser.MouseMenuCallBack=function (webview) {//右键菜单回调函
         webview.openDevTools();//打开开发者工具
     }
 };
+
 CampusInfoBrowser.Action=function(){//过程中的执行
     CampusInfoBrowser.BrowersTag.title = $(".Webname");//获取标题标签
-    var title = CampusInfoBrowser.BrowersTag.title[0].offsetWidth;//获取title的宽度
+    var title = CampusInfoBrowser.BrowersTag[0].offsetWidth;//获取title的宽度
     for(var i=0;i<CampusInfoBrowser.BrowersTag.title.length;i++){//遍历li标签页
-        if(title<5){//title小于5
+        if(title<10){//title小于5
             CampusInfoBrowser.BrowersTag.title[i].style.display = "none";//遍历的标题设置隐藏
         }else{
             CampusInfoBrowser.BrowersTag.title[i].style.display = "block";//遍历的标题设置显示
@@ -255,6 +256,7 @@ CampusInfoBrowser.Bind=function(){//绑定
         return false;
     }
 };
+
 CampusInfoBrowser.Init=function () {//初始化
     CampusInfoBrowser.UrlArea=$(".bowerSeach input")[0];//获取搜索框
     CampusInfoBrowser.NavContainer=$(".bowerCreaterWindow")[0];//获取标签页ul

+ 9 - 13
resources/app/start.js

@@ -5,22 +5,17 @@ const ipc = electron.ipcMain;
 const app = electron.app;
 const BrowserWindow = electron.BrowserWindow;
 let mainWindow;
-ipc.on('window-min',function(){
-    mainWindow.minimize();
+ipc.on('window-all-closed', function () {//退出
+    app.quit();
 });
-//登录窗口最大化
-ipc.on('window-max',function(){
-    if (mainWindow.isMaximized()) {
-        mainWindow.restore();
-    } else {
-        mainWindow.maximize();
-    }
+ipc.on('hide-window', function () {//小化
+    mainWindow.minimize();
 });
-ipc.on('window-close',function(){
-    mainWindow.close();
+ipc.on('show-window', function () {//最大化
+    mainWindow.maximize();
 });
-ipc.on('loadurl-message',function(arg){
-    shell.openExternal(arg);
+ipc.on('orignal-window', function () {//还原
+    mainWindow.unmaximize();
 });
 function createWindow() {
     mainWindow = new BrowserWindow({
@@ -40,6 +35,7 @@ function createWindow() {
         mainWindow = null
     });
 }
+
 app.on('ready', createWindow);
 app.on('window-all-closed', function () {
     if (process.platform !== 'darwin') {