X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=61cccdc213f89f9f7b7a306f038727753d71ad06;hb=767950c8211a1d7cef01c32775b099e26149633d;hp=4870c7c1e4ed23fe1dfe5ac82cb80bfbbcf9925c;hpb=c1e819f7760602c6638547dadcb371f512e3cd0c;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index 4870c7c..61cccdc 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -13,7 +13,6 @@ var mkws = { authenticated: false, log_level: 1, // Will be overridden from mkws_config, but // initial value allows jQuery popup to use logging. - paz: undefined, // will be set up during initialisation teams: {}, locale_lang: { "de": { @@ -85,7 +84,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { // wrapper to call team() after page load (function (j) { - mkws.log = function (string) { + function log(string) { if (!mkws.log_level) return; @@ -101,10 +100,10 @@ if (mkws_config == null || typeof mkws_config != 'object') { } console.log(string); } - var log = mkws.log; + mkws.log = log; - mkws.handleNodeWithTeam = function(node, callback) { + function handleNodeWithTeam(node, callback) { // First branch for DOM objects; second branch for jQuery objects var classes = node.className || node.attr('class'); if (!classes) { @@ -130,7 +129,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { } - mkws.resizePage = function () { + function resizePage() { var list = ["mkwsSwitch", "mkwsLang"]; var width = mkws_config.responsive_design_width; @@ -162,6 +161,10 @@ if (mkws_config == null || typeof mkws_config != 'object') { }; + // The following functions are dispatchers for team methods that + // are called from the UI using a team-name rather than implicit + // context. Apart from mkws.log, they are the ONLY public UI to + // this module. mkws.switchView = function(tname, view) { mkws.teams[tname].switchView(view); } @@ -199,97 +202,6 @@ if (mkws_config == null || typeof mkws_config != 'object') { } - // This function is taken from a StackOverflow answer - // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144 - mkws.getParameterByName = function(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^]*)"), - results = regex.exec(location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - } - - - mkws.defaultTemplate = function(name) - { - if (name === 'Record') { - return '\ -
{{translate "Title"}} | \ -\ - {{md-title}}\ - {{#if md-title-remainder}}\ - ({{md-title-remainder}})\ - {{/if}}\ - {{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ - {{/if}}\ - | \ -
---|---|
{{translate "Date"}} | \ -{{md-date}} | \ -
{{translate "Author"}} | \ -{{md-author}} | \ -
{{translate "Links"}} | \ -\ - {{#each md-electronic-url}}\ - Link{{index1}}\ - {{/each}}\ - | \ -
{{translate "Subject"}} | \ -\ - {{#first location having="md-subject"}}\ - {{#if md-subject}}\ - {{#commaList md-subject}}\ - {{this}}{{/commaList}}\ - {{/if}}\ - {{/first}}\ - | \ -
{{translate "Locations"}} | \ -\ - {{#commaList location}}\ - {{attr "@name"}}{{/commaList}}\ - | \ -