SHOW:
|
|
- or go back to the newest paste.
| 1 | $(function () {
| |
| 2 | updateContent(); | |
| 3 | $(window).hashchange(updateContent); | |
| 4 | ||
| 5 | function updateContent() {
| |
| 6 | CheckLogin(); | |
| 7 | if (location.hash == "") location.hash = "overzicht"; | |
| 8 | - | CurrentPageSettings = []; |
| 8 | + | |
| 9 | var webAppPage = false; | |
| 10 | $('#panelWrapper .panel > .panel-heading').html("Pagina");
| |
| 11 | - | $('script#contentScript').remove();
|
| 11 | + | |
| 12 | - | document.title = ProjectName; |
| 12 | + | |
| 13 | if (!hash) ApiActions.Error(); | |
| 14 | ||
| 15 | else {
| |
| 16 | hash = hash.charAt(0) === '#' ? hash.slice(1) : hash; | |
| 17 | if (hash.substr(0, 7) == "WebApp_") {
| |
| 18 | hash = "WebApp/" + hash.substr(7); | |
| 19 | var $container = $("#webAppWrapper");
| |
| 20 | $("#webAppWrapper").show();
| |
| 21 | $("#panelWrapper").hide();
| |
| 22 | webAppPage = true; | |
| 23 | } | |
| 24 | else {
| |
| 25 | var $container = $(".container .panel-body");
| |
| 26 | $("#webAppWrapper").hide();
| |
| 27 | } | |
| 28 | ||
| 29 | filePath = "content/" + hash + ".html"; | |
| 30 | ||
| 31 | $.ajax({
| |
| 32 | type: "GET", | |
| 33 | url: filePath, | |
| 34 | success: function (response) {
| |
| 35 | $container.html(response); | |
| 36 | ||
| 37 | var src = 'content/contentScripts/' + hash + '.js'; | |
| 38 | loadContentScript(src); | |
| 39 | ||
| 40 | if (!webAppPage) {
| |
| 41 | $("#panelWrapper").show();
| |
| 42 | var title = $("#top nav a[href=#" + hash + "]").attr('title');
| |
| 43 | if (typeof title != typeof undefined) | |
| 44 | $('#panelWrapper .panel > .panel-heading').html(title);
| |
| 45 | } | |
| 46 | }, | |
| 47 | statusCode: {
| |
| 48 | 404: function () { WebAppActions.NotFound() }
| |
| 49 | } | |
| 50 | }); | |
| 51 | } | |
| 52 | } | |
| 53 | }); | |
| 54 | ||
| 55 | function loadContentScript(src) {
| |
| 56 | $.ajax({
| |
| 57 | url: src, | |
| 58 | error: function () {
| |
| 59 | console.warn("Geen contentscript!");
| |
| 60 | } | |
| 61 | }); | |
| 62 | } |