1 2(function (insight, $, undefined) { 3 4 // Default options 5 var defaults = { 6 userName: "", // Not impemented 7 userAuthorized: false, // Not impemented 8 userImplemented: true, 9 key: "", 10 templateUrl: "/open24/public/Insight/Packages/Header/Templates/default.html", 11 templateCssUrl: "/open24/public/Insight/Packages/Header/Templates/default.css", 12 imageProfileUrl: "/App_themes/ins_sweden/Images/icon-profile.png", 13 api: "/open24/public/Insight/Packages/Header/Service.asmx", 14 dllVersion: "1.0.0.0" 15 }; 16 17 // Objects 18 var $body; 19 var $root; 20 21 // Init 22 insight.init = function (options) { 23 24 // Debug 25 log("Function init() was called"); 26 27 // Extend options 28 var options = $.extend(defaults, options); 29 30 // Elements 31 $body = $("body"); 32 $root = $("#ins-header"); 33 34 // Append #insight-root to <body /> 35 $body.prepend($root); 36 37 // Load html then render 38 $root.load(options.templateUrl + "?v=" + options.dllVersion, function () { 39 render(options); 40 }); 41 }; 42 43 function render(options) 44 { 45 // Debug 46 log("Function render() was called"); 47 48 // Requirements 49 if (!$root) { 50 return; 51 } 52 53 // Render account html and links 54 if (options.userImplemented) { 55 $.ajax({
56 type: "POST", 57 url: options.api + "/Header", 58 contentType: "application/json", // Content type sent to server 59 dataType: "json", // Expected data format from server 60 data: JSON.stringify({ Key: options.key }), 61 processdata: true, 62 success: function (data) { 63 64 // Debug 65 log("Data received successfully"); 66 log(data); 67 68 var model = data.d; 69 var userName = model.Account; 70 71 // Show header content 72 $("#ins-header .ins-container").show(); 73 74 // Make sure profile is visible 75 $("#ins-profile").show(); 76 77 if (userName) { 78 //User is authenticated 79 $("#ins-profile-text").text(userName); 80 $("#ins-log-out").show(); 81 $("#ins-my-page").show(); 82 } 83 else { 84 //User is NOT authenticated 85 $("#ins-log-in").show(); 86 } 87 88 // Adjust links 89 var key = "-"; //model.Location.Key; 90 91 if (key) { 92 $("#ins-my-page").attr("href", "/" + key + "/min-sida"); 93 $("#ins-log-in").attr("href", "/" + key + "/logga-in"); 94 $("#ins-log-out").attr("href", "/" + key + "/logga-ut"); 95 } 96 }, 97 error: function () { 98 log("Ett fel uppstod vid kommunikationen med Insyn API."); 99 } 100 }); 101 } 102 else { 103 $("#ins-profile").hide(); 104 } 105 106 // Icons 107 $("#ins-profile > img").attr("src", options.imageProfileUrl); 108 } 109 110 function log(x) 111 { 112 //if ('console' in self && 'log' in console) 113 // console.log(x); 114 } 115 116})(window.insight = window.insight || {}, $);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.