Revert "JS: tried namespaces"

This reverts commit e84cfc58a1.
This commit is contained in:
rugk 2017-02-08 20:12:22 +01:00
parent e84cfc58a1
commit 52f1fb143e
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D

View File

@ -25,21 +25,11 @@
// Immediately start random number generator collector.
sjcl.random.startCollectors();
// startup
jQuery(document).ready(function() {
/**
* main application start, called when DOM is fully loaded and
* runs controller initalization after translations are loaded
*/
PrivateBin.i18n.loadTranslations();
});
/**
* @name PrivateBin
* @namespace
*/
var PrivateBin = window.PrivateBin || {};
// jQuery(document).ready(function() {
// // startup
// }
jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
/**
* static helper methods
*
@ -48,7 +38,7 @@ var PrivateBin = window.PrivateBin || {};
* @name helper
* @class
*/
PrivateBin.helper = (function (window, document, jQuery, sjcl, Base64, RawDeflate) {
var helper = (function (window, document) {
var me = {};
/**
@ -370,7 +360,7 @@ PrivateBin.helper = (function (window, document, jQuery, sjcl, Base64, RawDeflat
};
return me;
})(window, document, jQuery, sjcl, Base64, RawDeflate);
})(window, document);
/**
* internationalization methods
@ -380,7 +370,7 @@ PrivateBin.helper = (function (window, document, jQuery, sjcl, Base64, RawDeflat
* @name i18n
* @class
*/
PrivateBin.i18n = (function (window, document, jQuery, sjcl, Base64, RawDeflate) {
var i18n = (function (window, document) {
var me = {};
/**
@ -517,7 +507,7 @@ PrivateBin.i18n = (function (window, document, jQuery, sjcl, Base64, RawDeflate)
*/
me.loadTranslations = function()
{
var newLanguage = PrivateBin.helper.getCookie('lang');
var newLanguage = helper.getCookie('lang');
// auto-select language based on browser settings
if (newLanguage.length === 0)
@ -551,7 +541,7 @@ PrivateBin.i18n = (function (window, document, jQuery, sjcl, Base64, RawDeflate)
};
return me;
})(window, document, jQuery, sjcl, Base64, RawDeflate);
})(window, document);
/**
* filter methods
@ -561,7 +551,7 @@ PrivateBin.i18n = (function (window, document, jQuery, sjcl, Base64, RawDeflate)
* @name filter
* @class
*/
PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflate) {
var filter = (function (window, document) {
var me = {};
/**
@ -575,7 +565,7 @@ PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflat
me.compress = function(message)
{
return Base64.toBase64( RawDeflate.deflate( Base64.utob(message) ) );
};
},
/**
* decompress a message compressed with filter.compress()
@ -588,7 +578,7 @@ PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflat
me.decompress = function(data)
{
return Base64.btou( RawDeflate.inflate( Base64.fromBase64(data) ) );
};
},
/**
* compress, then encrypt message with given key and password
@ -609,7 +599,7 @@ PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflat
return sjcl.encrypt(key, me.compress(message), options);
}
return sjcl.encrypt(key + sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password)), me.compress(message), options);
};
},
/**
* decrypt message with key, then decompress
@ -642,10 +632,10 @@ PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflat
}
}
return '';
};
}
return me;
})(window, document, jQuery, sjcl, Base64, RawDeflate);
})(window, document);
/**
* PrivateBin logic
@ -655,7 +645,7 @@ PrivateBin.filter = (function (window, document, jQuery, sjcl, Base64, RawDeflat
* @name controller
* @class
*/
PrivateBin.controller = (function (window, document, jQuery, sjcl, Base64, RawDeflate) {
var controller = (function (window, document) {
var me = {};
/**
@ -1872,7 +1862,7 @@ PrivateBin.controller = (function (window, document, jQuery, sjcl, Base64, RawDe
$passwordForm.submit(me.submitPasswordModal);
$(window).on('popstate', me.historyChange);
}
};
/**
* main application
@ -1965,4 +1955,18 @@ PrivateBin.controller = (function (window, document, jQuery, sjcl, Base64, RawDe
};
return me;
})(window, document, jQuery, sjcl, Base64, RawDeflate);
})(window, document);
/**
* main application start, called when DOM is fully loaded and
* runs controller initalization after translations are loaded
*/
$(i18n.loadTranslations);
return {
helper: helper,
i18n: i18n,
filter: filter,
controller: controller
};
}(jQuery, sjcl, Base64, RawDeflate);