Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$('body').on('click', 'a', function(e){
var targUrl = $(e.target).closest("a").attr("href") || $(e.target).text(),
linkPattern = /[a-zA-Z]+:\/\//; //find any text:// in link. It may not start at the first character of href
if(targUrl.startsWith('ob')){
e.preventDefault();
app.router.translateRoute(targUrl.replace('ob://', '')).done((route) => {
Backbone.history.navigate(route, {trigger:true});
});
} else if(linkPattern.test(targUrl) || $(this).is('.js-externalLink, .js-externalLinks a, .js-listingDescription')){
e.preventDefault();
if (!/^https?:\/\//i.test(targUrl)) {
targUrl = 'http://' + targUrl;
}
require("shell").openExternal(targUrl);
} else if ($(e.target).closest("a").attr("href") && !targUrl.startsWith('#')){ //internal links should start with #
e.preventDefault(); //just ignore any anchor with an href that is not a valid internal link
}
});
openInBrowser(){
// window.open(this.link);
// window.open(this.link,'post','width=400,height=200,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes')
require("shell").openExternal(this.link);
},
saveTags(id,selected){
onDidClick: () => {
// eslint-disable-next-line import/no-extraneous-dependencies
require('shell').openExternal('https://github.com/codeclimate/codeclimate');
},
text: 'Install guide',
exports.launchUrl = function(event, url) {
console.log(url);
var shell = require('shell');
shell.openExternal(url);
};
self.$el.find('a').on('click', function(e){
e.preventDefault();
var extUrl = $(this).attr('href');
if (!/^https?:\/\//i.test(extUrl)) {
extUrl = 'http://' + extUrl;
}
require("shell").openExternal(extUrl);
});
self.$el.find('.js-aboutModal').removeClass("hide");
function navigate(dest) {
var URLregex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
if (URLregex.test(dest)) {
shell.openExternal(dest);
return;
}
var oldSel = $('.panel-container > div.current');
var currSel = $("#panel-" + dest);
if (oldSel) oldSel.removeClass("current");
$("#panel-" + dest).addClass("current");
}
mainWindow.webContents.on("new-window", function(e, url) {
e.preventDefault();
shell.openExternal(url);
});
}
scope.openExternal = function(url, $event) {
if (!url) return;
if ($event) $event.preventDefault();
shell.openExternal(url);
};
mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault();
shell.openExternal(url);
});
openUrl: function (event, url) {
shell.openExternal(url)
event.original.preventDefault()
},
quit: function () {