(function () {
// Localize jQuery variable
var jQuery;
/******** Load jQuery if not present *********/
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type", "text/javascript");
script_tag.setAttribute("src",
"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
if (script_tag.readyState) {
script_tag.onreadystatechange = function () { // For old versions of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
} else {
script_tag.onload = scriptLoadHandler;
}
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
} else {
// The jQuery version on the window is the one we want to use
jQuery = window.jQuery;
main();
}
/******** Called once jQuery has loaded ******/
function scriptLoadHandler() {
// Restore $ and window.jQuery to their previous values and store the
// new jQuery in our local jQuery variable
jQuery = window.jQuery.noConflict(true);
// Call our main function
main();
}
/******** Our main function ********/
function main() {
jQuery(document).ready(function ($) {
/******* Load CSS *******/
$("", {
rel: "stylesheet",
type: "text/css",
href: "https://jobbio.com/css/widget.min.css"
}).appendTo('head');
$("", {
rel: "stylesheet",
type: "text/css",
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css",
}).appendTo('head');
refresh();
});
}
function refresh() {
/******* Load HTML *******/
var attributes = document.getElementById('jobbio-widget-container').attributes;
var arguments = [];
for (var key in attributes) {
if (attributes[key].nodeName) {
arguments.push( attributes[key].nodeName + '~' + encodeURIComponent(attributes[key].nodeValue) );
}
}
var url = "https://jobbio.com/widgets/components/jobs-list?channel=computerworldukjobs" + '&callback=?' + '&data=' + arguments;
$.getJSON(url, function (data) {
$('#jobbio-widget-container').html(data.html);
var timer = $('#jobbio-widget-container').attr('data-refresh-interval') * 1000;
if (timer) {
setTimeout(refresh, timer);
}
});
}
})(); // We call our anonymous function immediately