Created
December 6, 2013 04:54
-
-
Save amitrogye/7818784 to your computer and use it in GitHub Desktop.
sncsublimehelper_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.bookmarklet = function(opts) { | |
fullFunc(opts) | |
}; | |
// These are the styles, scripts and callbacks we include in our bookmarklet: | |
window.bookmarklet({ | |
css: ['https://gist.github.com/amitrogye/7818568/raw/5a01c375673572fc0a4e704e2a4e35ca753bf6ff/zebra_dialog.css'], | |
js: ['https://gist.github.com/amitrogye/7818521/raw/4f27f1b64ece3537ddab27fa3255d87eae353edb/zebra_dialog.js'], | |
// jqpath : 'myCustomjQueryPath.js', <-- option to include your own path to jQuery | |
ready: function() { | |
// The meat of your jQuery code goes here | |
//jQuery("body").html("Hello World"); | |
//alert('Hello world'); | |
var origin = window.location.origin; | |
var table = ""; | |
var sid = ""; | |
if(jQuery("#gsft_main").length == 0) { | |
table = jQuery("#section_form_id").val(); | |
sid = jQuery("#sys_uniqueValue").val(); | |
}else{ | |
table = jQuery('#gsft_main').contents().find('#section_form_id').val(); | |
sid = jQuery('#gsft_main').contents().find('#sys_uniqueValue').val(); | |
} | |
var strUrl = '// __fileURL = '+origin+ "/" +table + '?sys_id='+sid+'<BR/>'; | |
//var strUrl = '// __fileURL = https://covancedev.service-now.com/sys_script_include.do?sys_id=609ac4b12b42410061f6495fe8da1588<BR/>'; | |
strUrl +='// __fieldName = script<BR/>'; | |
strUrl +='// __authentication = STORED'; | |
jQuery.Zebra_Dialog(strUrl, { | |
'type': 'error', | |
'title': 'Sublime header', | |
'width': "650" , | |
'buttons': [ | |
{caption: 'Copy code', callback: function() { alert('"Copy code" was clicked')}} | |
] | |
}); | |
} | |
}) | |
function fullFunc(a) { | |
function d(b) { | |
if (b.length === 0) { | |
a.ready(); | |
return false | |
} | |
jQuery.getScript(b[0], function() { | |
d(b.slice(1)) | |
}) | |
} | |
function e(b) { | |
jQuery.each(b, function(c, f) { | |
jQuery("<link>").attr({ | |
href: f, | |
rel: "stylesheet" | |
}).appendTo("head") | |
}) | |
} | |
a.jqpath = a.jqpath || "https://gist.github.com/amitrogye/7818396/raw/2a40d4c01711011eb4a0e9ae5536a78a512b401c/jquery-2.0.3.min.js"; | |
(function(b) { | |
/*var c = document.createElement("script"); | |
c.type = "text/javascript"; | |
c.src = b; | |
c.onload = function() {*/ | |
e(a.css); | |
d(a.js) | |
/*}; | |
document.body.appendChild(c) | |
*/ | |
})(a.jqpath) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment