/**
* Issues:
* -------------------------
* - jQuery is a dependency.
* -> GPWIDGET needs to wait to invoke .init() to determine if jQuery object is present
* -> Version
*
*
**/
var GPWIDGET = GPWIDGET || {};
(function () {
var jq = false; // status of jQuery detection, we use this to avoid
return GPWIDGET = {
urls: {
baseWidgetUrl: 'http://dev.graphicproducts.com/test-widget/arc-flash/',
jqueryCdnUrl: 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'
},
utils: {
addToHead: function (element) {
var a = document.getElementsByTagName("head")[0];
a.appendChild(element);
(element.type === 'href') ? console.log('Loaded: ' + element.href) : console.log('Loaded: ' + element.src);
},
loadJs: function (scriptSrc) {
var scriptTag = document.createElement("script");
scriptTag.type = "text/javascript";
scriptTag.charset = "UTF-8";
scriptTag.src = scriptSrc;
this.addToHead(scriptTag);
},
loadCss: function (cssHref) {
var cssLink = document.createElement("link");
cssLink.type = "text/css";
cssLink.rel = "stylesheet";
cssLink.charset = "UTF-8";
cssLink.href = cssHref;
this.addToHead(cssLink);
},
testForJquery: function () {
if (jq === true) {
return true;
}
// does the page have jQuery?
if ('jQuery' in window) {
//console.log($.fn.jquery); // test jQuery version compatability
console.log('jQuery is on the page!');
return jq = true;
} else {
// if no jQuery present on page, get jQuery
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.