diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-05-07 11:36:44 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-05-07 11:36:44 -0400 |
| commit | e5bcf3ba79dfa170d34bf85afafc8cbfed0f3c34 (patch) | |
| tree | eeda8e51c0c585f7a3613b4e96abc921d021e495 | |
| parent | 5497a287a3279cf7c0999c40b87f95c6d82cef3e (diff) | |
#623 copy/paste enabled
| -rw-r--r-- | electron_js/main.js | 101 | ||||
| -rwxr-xr-x | make_desktop.sh | 3 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | www/css/style.css | 18 | ||||
| -rw-r--r-- | www/js/LogCtrl.js | 7 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 1 | ||||
| -rw-r--r-- | www/templates/log.html | 6 |
7 files changed, 135 insertions, 4 deletions
diff --git a/electron_js/main.js b/electron_js/main.js index a4fe235b..2d2f4ec4 100644 --- a/electron_js/main.js +++ b/electron_js/main.js @@ -1,6 +1,6 @@ const electron = require('electron'); const windowStateKeeper = require('electron-window-state'); -const {app, globalShortcut} = electron; +const {app, globalShortcut, Menu} = electron; const {dialog} = require('electron') // Module to create native browser window. @@ -9,6 +9,8 @@ var isFs = false; var isProxy = false; var argv = require('minimist')(process.argv.slice(1)); + + console.log ("ARGV="+JSON.stringify(argv)); if (argv.path) { @@ -73,7 +75,7 @@ const mx = globalShortcut.register('CommandOrControl+Alt+F', () => { - win.webContents.session.webRequest.onHeadersReceived({}, (d, c) => { + win.webContents.session.webRequest.onHeadersReceived({}, (d, c) => { if(d.responseHeaders['x-frame-options'] || d.responseHeaders['X-Frame-Options']){ delete d.responseHeaders['x-frame-options']; delete d.responseHeaders['X-Frame-Options']; @@ -98,9 +100,102 @@ const mx = globalShortcut.register('CommandOrControl+Alt+F', () => { // and load the index.html of the app. win.loadURL(`file://${__dirname}/index.html`); + // Create the Application's main menu + + // const menu = Menu.buildFromTemplate(template) + // Menu.setApplicationMenu(menu) + + + const template = [ + { + label: 'Edit', + submenu: [ + {role: 'undo'}, + {role: 'redo'}, + {type: 'separator'}, + {role: 'cut'}, + {role: 'copy'}, + {role: 'paste'}, + {role: 'pasteandmatchstyle'}, + {role: 'delete'}, + {role: 'selectall'} + ] + }, + { + label: 'View', + submenu: [ + {role: 'reload'}, + {role: 'forcereload'}, + {role: 'toggledevtools'}, + {type: 'separator'}, + {role: 'resetzoom'}, + {role: 'zoomin'}, + {role: 'zoomout'}, + {type: 'separator'}, + {role: 'togglefullscreen'} + ] + }, + { + role: 'window', + submenu: [ + {role: 'minimize'}, + {role: 'close'} + ] + }, + { + role: 'help', + submenu: [ + { + label: 'Learn More', + click () { require('electron').shell.openExternal('https://electronjs.org') } + } + ] + } + ] + + if (process.platform === 'darwin') { + template.unshift({ + label: app.getName(), + submenu: [ + {role: 'about'}, + {type: 'separator'}, + {role: 'services', submenu: []}, + {type: 'separator'}, + {role: 'hide'}, + {role: 'hideothers'}, + {role: 'unhide'}, + {type: 'separator'}, + {role: 'quit'} + ] + }) + + // Edit menu + template[1].submenu.push( + {type: 'separator'}, + { + label: 'Speech', + submenu: [ + {role: 'startspeaking'}, + {role: 'stopspeaking'} + ] + } + ) + + // Window menu + template[3].submenu = [ + {role: 'close'}, + {role: 'minimize'}, + {role: 'zoom'}, + {type: 'separator'}, + {role: 'front'} + ] + } + + const menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); + // Open the DevTools. //win.webContents.openDevTools(); - // Emitted when the window is closed. win.on('closed', () => { // Dereference the window object, usually you would store windows diff --git a/make_desktop.sh b/make_desktop.sh index 14898d49..3c20b42f 100755 --- a/make_desktop.sh +++ b/make_desktop.sh @@ -93,6 +93,9 @@ do exe cp -R node_modules/mkdirp $i/app/node_modules exe cp -R node_modules/deep-equal $i/app/node_modules exe cp -R node_modules/minimist $i/app/node_modules + exe cp -R node_modules/menu $i/app/node_modules + exe cp -R node_modules/clivas $i/app/node_modules + exe cp -R node_modules/keypress $i/app/node_modules echo Copying over zmNinja code... exe cp -R www/* $i/app/ diff --git a/package.json b/package.json index cfff6dbe..923e0f3f 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "dependencies": { "@ionic/cli-utils": "^1.19.2", "EmailComposer": "git+https://github.com/pliablepixels/email-composer.git", + "clivas": "^0.2.0", "com.telerik.plugins.nativepagetransitions": "^0.6.5", "cordova": "^8.0.0", "cordova-android": "^6.3.0", @@ -94,6 +95,8 @@ "electron-window-state": "^4.1.1", "ionic-plugin-keyboard": "^2.2.1", "json-file": "^0.1.0", + "keypress": "^0.2.1", + "menu": "^0.2.5", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "org.devgeeks.Canvas2ImagePlugin": "https://github.com/flache/Canvas2ImagePlugin", diff --git a/www/css/style.css b/www/css/style.css index 1260d3a9..bb019901 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -126,6 +126,18 @@ ion-popover-view.fit ion-content { } + + +.selectable { + + -webkit-user-select: text !important; + -khtml-user-select: text !important; + -moz-user-select: text !important; + -ms-user-select: text !important; + -o-user-select: text !important; + user-select: text !important; + +} /*.modal { top: 100; @@ -681,6 +693,7 @@ progress[role] /* appearance: none;*/ -moz-appearance: none; -webkit-appearance: none; + appearance:none; /* gets rid of default border in Firefox and Opera. */ border: none; /* Needs to be in here for Safari polyfill so background images work as expected. */ @@ -880,6 +893,7 @@ input[type=range]::-webkit-slider-thumb { font-size: 2em; border: 1px solid #ddd; -webkit-appearance: none; + appearance:none; } .pin-background.scroll-content { @@ -1333,8 +1347,10 @@ videogular div.event-time { display: inline-flex; -webkit-box-direction: normal; -moz-box-direction: normal; + box-direction:normal; -webkit-box-orient: horizontal; -moz-box-orient: horizontal; + box-orient:horizontal; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; @@ -1343,6 +1359,7 @@ videogular div.event-time { flex-wrap: nowrap; -webkit-box-pack: center; -moz-box-pack: center; + box-pack:center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; @@ -1351,6 +1368,7 @@ videogular div.event-time { align-content: center; -webkit-box-align: center; -moz-box-align: center; + box-align:center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index 9f00a8f7..530a7178 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -244,6 +244,10 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo } + $scope.selectToggle = function() { + $scope.selectOn = !$scope.selectOn; + }; + $scope.changePage = function(p) { $scope.zmPage = $scope.zmPage + p; @@ -295,6 +299,9 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo $scope.$on('$ionicView.enter', function() { //console.log("**VIEW ** Log Ctrl Entered"); + + $ionicSideMenuDelegate.canDragContent(false); + $scope.selectOn = false; NVRDataModel.setAwake(false); $scope.logEntity = $rootScope.appName; $scope.zmPage = 1; diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index d0d1285c..77961cfe 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -190,6 +190,7 @@ "kLoginValidAPIFailedTitle" :"Login validated but API failed", "kLoginValidatedTitle" :"Login Validated", "kLogs" :"Logs", + "kLogsCopyPaste" :"Text select is on, touch scrolling is disabled. Tap icon again to revert", "kLowBWDisplay" :"low bandwidth", "kLowBandwidth" :"low bandwidth mode", "kManageServerGroups" :"Manage Server Groups", diff --git a/www/templates/log.html b/www/templates/log.html index f2ed3f65..af5e345e 100644 --- a/www/templates/log.html +++ b/www/templates/log.html @@ -1,6 +1,9 @@ <ion-view view-title="{{logEntity}} {{'kLogs' | translate}}"> <ion-nav-buttons side="left"> <button class="button button-icon button-clear ion-navicon" ng-click="openMenu()"></button> + + <button ng-class="selectOn? 'button button-icon button-clear ion-ios-copy':'button button-icon button-clear ion-ios-copy-outline'" ng-click="selectToggle()"></button> + <button data-badge="{{$root.alarmCount}}" class="animated infinite tada button button-icon button-clear ion-ios-bell notification-badge" ng-click="handleAlarms();" ng-if="$root.isAlarm"></button> </ion-nav-buttons> <ion-nav-buttons side="right"> @@ -27,6 +30,7 @@ <b>{{$root.appName}} {{'kVersion'|translate}}: {{zmAppVersion}} ({{$root.platformOS}})</b> </div> + <div ng-if="selectOn" class="aside-1">{{'kLogsCopyPaste' | translate }}</div> <div ng-if="logEntity!=$root.appName"> <b>ZoneMinder</b> </div> @@ -34,5 +38,5 @@ <br/> <!-- don't indent here its a pre--> - <pre>{{log.logString}}</pre> + <pre class="selectable" data-tap-disabled="{{selectOn}}">{{log.logString}}</pre> </ion-content> |
