Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var el = ev.target,
bTextInput = el.nodeName === 'INPUT' || el.nodeName === 'TEXTAREA',
iframedoc = getIframeDocument();
// copy
menuContext.items[0].enabled = bTextInput || !iframedoc.getSelection().isCollapsed;
// copy link
while (!(/^(a|html)$/i).test(el.nodeName)) {
el = el.parentNode;
}
contextURL = 'href' in el ? el.href : '';
menuContext.items[1].enabled = !!contextURL;
// paste
menuContext.items[2].enabled = bTextInput && !!gui.Clipboard.get().get('text');
menuContext.popup(ev.x, ev.y);
return false;
}
// :(, fail to register the |key| or couldn't parse the |key|.
console.log(msg);
}
};
// Create a shortcut with |option|.
var shortcut = new gui.Shortcut(option);
gui.App.registerGlobalHotKey(shortcut);
// ...but turn it off when not focused
win.on("blur", function() {
gui.App.unregisterGlobalHotKey(shortcut);
});
win.on("focus", function() {
gui.App.registerGlobalHotKey(shortcut);
});
window.clipboard = gui.Clipboard.get();
Encryptr.prototype.copyToClipboard = function(text) {
window.clipboard.set(text, 'text');
};
/* jshint node: false */
} else {
// Fallback to empty browser polyfill
Encryptr.prototype.copyToClipboard = function() {};
}
};
function(inlineStyle, StyleForEmail, UserTheme, DragDrop) {
var fs = require('fs');
var path = require('path');
var iframe = $('#viewer iframe')[0];
var _viewer = iframe.contentWindow;
var gui = require('nw.gui'),
clipboard = gui.Clipboard.get();
var MIN_FONT_SIZE = 9;
var MAX_FONT_SIZE = 30;
var viewerConfig = store.get('Viewer') || {};
viewerConfig.fontSize = Number(viewerConfig.fontSize || 15);
var codeConfig = store.get('Code') || {};
// var customConfig = store.get('Custom') || {};
// var generalConfig = store.get('General') || {};
var markdownConfig = store.get('Markdown') || {};
// var config = option.toJSON();
// function setTitle() {
// var viewerDoc = iframe.contentDocument.body;
// var el = viewerDoc.querySelectorAll('h1, h2, h3, h4, h5, h6')[0];
/* Globals */
window.currentFile=null;
window.editor=null;
window.simplemode=false;
/* Node imports and WebKit globals */
var gui = require('nw.gui');
var fs = require('fs');
var win=gui.Window.get();
var clipboard = gui.Clipboard.get();
menu.append(new gui.MenuItem(
{
type: "separator"
}));
menu.append(new gui.MenuItem(
{
label: "Exit",
click: function()
{
gui.App.quit();
},
}));
tray.menu = menu;
//Get clipboard reference.
var clipboard = gui.Clipboard.get();
//Uncomment to show dev tools.
//win.showDevTools();
var translate_endpoint = "http://api.giphy.com";
var api_version = "v1";
//Hotkey Stuff
var option = {
key: "Ctrl+Alt+G",
active: function()
{
showing = 1;
win.show();
//Workaround to focus the input after showing.
function copyToClipboard(value) {
if (!WebSite.isNW) return;
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
clipboard.set(value, 'text');
}
displayStreamURL: function() {
var clipboard = require('nw.gui').Clipboard.get();
clipboard.set($('#video_player video').attr('src'), 'text');
this.displayOverlayMsg(i18n.__('URL of this stream was copied to the clipboard'));
},
function copytext () {
if (selectedText()) {
var clipboard = gui.Clipboard.get(),
text = selectedText().toString();
return clipboard.set(text, 'text');
};
};
this.writeToClipboard = function (text) {
var gui = require('nw.gui')
var clipboard = gui.Clipboard.get()
return clipboard.set(text)
}
import nwGui from "nw.gui";
export default nwGui;
export const App = nwGui.App;
export const Clipboard = nwGui.Clipboard;
export const Menu = nwGui.Menu;
export const MenuItem = nwGui.MenuItem;
export const Screen = nwGui.Screen;
export const Shell = nwGui.Shell;
export const Shortcut = nwGui.Shortcut;
export const Tray = nwGui.Tray;
export const Window = nwGui.Window;