Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function () {
- updateContent();
- $(window).hashchange(updateContent);
- function updateContent() {
- if (location.hash == "") location.hash = "overzicht";
- CurrentPageSettings = [];
- var webAppPage = false;
- $('#panelWrapper .panel > .panel-heading').html("Pagina");
- $('script#contentScript').remove();
- document.title = ProjectName;
- CheckLogin();
- hash = location.hash;
- if (!hash) ApiActions.Error();
- else {
- hash = hash.charAt(0) === '#' ? hash.slice(1) : hash;
- if (hash.substr(0, 7) == "WebApp_") {
- hash = "WebApp/" + hash.substr(7);
- var $container = $("#webAppWrapper");
- $("#webAppWrapper").show();
- $("#panelWrapper").hide();
- webAppPage = true;
- }
- else {
- var $container = $(".container .panel-body");
- $("#webAppWrapper").hide();
- }
- filePath = "content/" + hash + ".html";
- $.ajax({
- type: "GET",
- url: filePath,
- success: function (response) {
- $container.html(response);
- var src = 'content/contentScripts/' + hash + '.js';
- loadContentScript(src);
- if (!webAppPage) {
- $("#panelWrapper").show();
- var title = $("#top nav a[href=#" + hash + "]").attr('title');
- if (typeof title != typeof undefined)
- $('#panelWrapper .panel > .panel-heading').html(title);
- }
- },
- statusCode: {
- 404: function () { WebAppActions.NotFound() }
- }
- });
- }
- }
- });
- function loadContentScript(src) {
- $.ajax({
- url: src,
- error: function () {
- console.warn("Geen contentscript!");
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement