Skip to content

Commit

Permalink
#623 copy/paste enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed May 7, 2018
1 parent 0ea34a2 commit a5dd8d1
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 4 deletions.
101 changes: 98 additions & 3 deletions electron_js/main.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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) {
Expand Down Expand Up @@ -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'];
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions make_desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions www/js/LogCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions www/lang/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion www/templates/log.html
Original file line number Diff line number Diff line change
@@ -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">
Expand All @@ -27,12 +30,13 @@
<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>


<br/>
<!-- don't indent here its a pre-->
<pre>{{log.logString}}</pre>
<pre class="selectable" data-tap-disabled="{{selectOn}}">{{log.logString}}</pre>
</ion-content>

0 comments on commit a5dd8d1

Please sign in to comment.