summaryrefslogtreecommitdiff
path: root/static/js/src/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/src/util.js')
-rwxr-xr-xstatic/js/src/util.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/static/js/src/util.js b/static/js/src/util.js
index e8d1107..2a3dc52 100755
--- a/static/js/src/util.js
+++ b/static/js/src/util.js
@@ -16,6 +16,15 @@ isEmptyObject = function(obj) {
String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g,'') }
+function normalizeUrl(url) {
+ if (!url) { return url; }
+ var lowerurl = url.toLowerCase();
+ if (lowerurl.indexOf('http://') == 0 || lowerurl.indexOf('https://') == 0 || lowerurl.indexOf('ftp://') == 0 || lowerurl.indexOf('//') == 0)
+ return url;
+ var scheme = (location && location.protocol == 'https:') ? 'https://' : 'http://';
+ return scheme + url;
+}
+
function isCSSPropertySupported(prop){ return prop in document.body.style }
function track(group, name) {
@@ -93,4 +102,3 @@ window.requestAnimFrame = (function(){
function text_off(){
setTextEnable.call( $("#textbutton input").attr("checked",false) )
}
-