Skip to content
Snippets Groups Projects
Commit e01bd1eb authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Switch to module object style for the VuFind namespace.

parent c496df2b
Branches
Tags archive/issue/5404
No related merge requests found
...@@ -3,18 +3,29 @@ ...@@ -3,18 +3,29 @@
// IE 9< console polyfill // IE 9< console polyfill
window.console = window.console || {log: function () {}}; window.console = window.console || {log: function () {}};
var VuFind = { var VuFind = (function() {
defaultSearchBackend: null, var defaultSearchBackend = null;
path: null, var path = null;
translations: {}, var _translations = {};
addTranslations: function(s) { var addTranslations = function(s) {
for (var i in s) { for (var i in s) {
this.translations[i] = s[i]; _translations[i] = s[i];
} }
}, };
translate: function(op) { return this.translations[op] || op; } var translate = function(op) {
} return _translations[op] || op;
};
//Reveal
return {
defaultSearchBackend: defaultSearchBackend,
path: path,
addTranslations: addTranslations,
translate: translate
};
})();
/* --- GLOBAL FUNCTIONS --- */ /* --- GLOBAL FUNCTIONS --- */
function htmlEncode(value) { function htmlEncode(value) {
...@@ -381,14 +392,14 @@ function keyboardShortcuts() { ...@@ -381,14 +392,14 @@ function keyboardShortcuts() {
} }
} }
// This can be called with a container e.g. when combined results fetched with AJAX // This can be called with a container e.g. when combined results fetched with AJAX
// are loaded // are loaded
function setupSaveRecordLinks(container) function setupSaveRecordLinks(container)
{ {
if (typeof(container) == 'undefined') { if (typeof(container) == 'undefined') {
container = $('body'); container = $('body');
} }
// Save record links // Save record links
container.find('.result .save-record').click(function() { container.find('.result .save-record').click(function() {
var parts = this.href.split('/'); var parts = this.href.split('/');
...@@ -407,7 +418,7 @@ $(document).ready(function() { ...@@ -407,7 +418,7 @@ $(document).ready(function() {
keyboardShortcuts(); keyboardShortcuts();
// Save record links // Save record links
setupSaveRecordLinks(); setupSaveRecordLinks();
// support "jump menu" dropdown boxes // support "jump menu" dropdown boxes
$('select.jumpMenu').change(function(){ $(this).parent('form').submit(); }); $('select.jumpMenu').change(function(){ $(this).parent('form').submit(); });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment