diff options
Diffstat (limited to 'static/js')
| -rwxr-xr-x | static/js/dumpsearch.js | 2 | ||||
| -rwxr-xr-x | static/js/fullscreen.js | 22 | ||||
| -rwxr-xr-x | static/js/fullscreenmgmt.js | 23 | ||||
| -rwxr-xr-x | static/js/fullscreenphotobooth.js | 23 | ||||
| -rwxr-xr-x | static/js/home.js | 5 | ||||
| -rwxr-xr-x | static/js/pichat-old.js | 16 | ||||
| -rwxr-xr-x | static/js/pichat.butt.js | 6 | ||||
| -rwxr-xr-x | static/js/pichat.js | 16 | ||||
| -rwxr-xr-x | static/js/pichat2.js | 16 | ||||
| -rwxr-xr-x | static/js/register.js | 2 | ||||
| -rwxr-xr-x | static/js/src/_main.js | 2 | ||||
| -rwxr-xr-x | static/js/src/chat.js | 4 | ||||
| -rwxr-xr-x | static/js/src/messages.js | 2 | ||||
| -rwxr-xr-x | static/js/src/search.js | 6 | ||||
| -rwxr-xr-x | static/js/src/share.js | 2 |
15 files changed, 95 insertions, 52 deletions
diff --git a/static/js/dumpsearch.js b/static/js/dumpsearch.js index bb0bcce..518db99 100755 --- a/static/js/dumpsearch.js +++ b/static/js/dumpsearch.js @@ -4,7 +4,7 @@ window['google'] = {}; if (!window['google']['loader']) { window['google']['loader'] = {}; google.loader.ServiceBase = 'http://www.google.com/uds'; -google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax'; +google.loader.GoogleApisBase = 'https://ajax.googleapis.com/ajax'; google.loader.ApiKey = 'ABQIAAAA6C4bndUCBastUbawfhKGURQviNTBAztVc6-FhSQEQv6BdFn_BBRfktMUHCKH-MICXpvRmJU3x-Ly0w'; google.loader.KeyVerified = true; google.loader.LoadFailure = false; diff --git a/static/js/fullscreen.js b/static/js/fullscreen.js index 17b0614..38e09ee 100755 --- a/static/js/fullscreen.js +++ b/static/js/fullscreen.js @@ -92,6 +92,21 @@ function initLogin() { ); } +function loginErrorText(resp) { + var code = ""; + try { + code = (resp && resp.responseText) ? ("" + resp.responseText).replace(/^\s+|\s+$/g, "") : ""; + } catch(e) {} + if (code == "NICK_TOO_SHORT") return "Username too short (min 3 characters)."; + if (code == "NICK_TOO_LONG") return "Username too long (max 16 characters)."; + if (code == "NICK_INVALID_CHARS") return "Username can only use letters, numbers, '_' and '-'."; + if (code == "NICK_TAKEN") return "That username is taken/reserved. Try another."; + if (code == "RECENTLY_CREATED") return "Too many new accounts from this IP. Try an existing username."; + if (code == "RECENTLY_MUTED") return "This IP is restricted from creating new accounts. Try an existing username."; + if (code && code != "BAD_LOGIN") return "Couldn't log you in (" + code + ")."; + return "Couldn't log you in :( Try a different username."; +} + function showLogin() { $('#nickInput').val(''); $('#passwordInput').val(''); @@ -104,9 +119,9 @@ function login() { $('#spinner').show(); $('input').attr('disabled', 'disabled'); var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); + var password = $('#passwordInput').val() || ''; var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : ''; - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + var hash = password ? hex_sha1(nick + '$' + password + '$dumpfm') : ''; var onSuccess = function(json) { // if (typeof pageTracker !== 'undefined') { @@ -121,7 +136,7 @@ function login() { var onError = function(resp, textStatus, errorThrown) { $('#spinner').hide(); $('input').removeAttr('disabled'); - $('#errormsg').text("Couldn't log you in :( Bad password?"); + $('#errormsg').text(loginErrorText(resp)); } $.ajax({ @@ -507,4 +522,3 @@ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } - diff --git a/static/js/fullscreenmgmt.js b/static/js/fullscreenmgmt.js index 6137238..189b79a 100755 --- a/static/js/fullscreenmgmt.js +++ b/static/js/fullscreenmgmt.js @@ -103,6 +103,21 @@ function initLogin() { '2px solid #30009b'); } +function loginErrorText(resp) { + var code = ""; + try { + code = (resp && resp.responseText) ? ("" + resp.responseText).replace(/^\s+|\s+$/g, "") : ""; + } catch(e) {} + if (code == "NICK_TOO_SHORT") return "Username too short (min 3 characters)."; + if (code == "NICK_TOO_LONG") return "Username too long (max 16 characters)."; + if (code == "NICK_INVALID_CHARS") return "Username can only use letters, numbers, '_' and '-'."; + if (code == "NICK_TAKEN") return "That username is taken/reserved. Try another."; + if (code == "RECENTLY_CREATED") return "Too many new accounts from this IP. Try an existing username."; + if (code == "RECENTLY_MUTED") return "This IP is restricted from creating new accounts. Try an existing username."; + if (code && code != "BAD_LOGIN") return "Couldn't log you in (" + code + ")."; + return "Couldn't log you in :( Try a different username."; +} + function showLogin() { $('#nickInput').val(''); $('#passwordInput').val(''); @@ -115,9 +130,9 @@ function login() { $('#spinner').show(); $('input').attr('disabled', 'disabled'); var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); + var password = $('#passwordInput').val() || ''; var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : ''; - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + var hash = password ? hex_sha1(nick + '$' + password + '$dumpfm') : ''; var onSuccess = function(json) { if (typeof pageTracker !== 'undefined') { @@ -131,7 +146,7 @@ function login() { var onError = function(resp, textStatus, errorThrown) { $('#spinner').hide(); $('input').removeAttr('disabled'); - $('#errormsg').text("Couldn't log you in :( Bad password?"); + $('#errormsg').text(loginErrorText(resp)); } $.ajax({ @@ -182,4 +197,4 @@ $(function() { $('#memelogo').stop(true, false).animate({opacity: 1.0}, "fast").delay(LogoFadeDelay).animate({opacity: 0}, "slow"); }); $('#memelogo').delay(LogoFadeDelay).animate({opacity: 0}, "slow"); -});
\ No newline at end of file +}); diff --git a/static/js/fullscreenphotobooth.js b/static/js/fullscreenphotobooth.js index 29795ee..2bbbbb5 100755 --- a/static/js/fullscreenphotobooth.js +++ b/static/js/fullscreenphotobooth.js @@ -103,6 +103,21 @@ function initLogin() { '2px solid #30009b'); } +function loginErrorText(resp) { + var code = ""; + try { + code = (resp && resp.responseText) ? ("" + resp.responseText).replace(/^\s+|\s+$/g, "") : ""; + } catch(e) {} + if (code == "NICK_TOO_SHORT") return "Username too short (min 3 characters)."; + if (code == "NICK_TOO_LONG") return "Username too long (max 16 characters)."; + if (code == "NICK_INVALID_CHARS") return "Username can only use letters, numbers, '_' and '-'."; + if (code == "NICK_TAKEN") return "That username is taken/reserved. Try another."; + if (code == "RECENTLY_CREATED") return "Too many new accounts from this IP. Try an existing username."; + if (code == "RECENTLY_MUTED") return "This IP is restricted from creating new accounts. Try an existing username."; + if (code && code != "BAD_LOGIN") return "Couldn't log you in (" + code + ")."; + return "Couldn't log you in :( Try a different username."; +} + function showLogin() { $('#nickInput').val(''); $('#passwordInput').val(''); @@ -115,9 +130,9 @@ function login() { $('#spinner').show(); $('input').attr('disabled', 'disabled'); var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); + var password = $('#passwordInput').val() || ''; var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : ''; - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + var hash = password ? hex_sha1(nick + '$' + password + '$dumpfm') : ''; var onSuccess = function(json) { if (typeof pageTracker !== 'undefined') { @@ -131,7 +146,7 @@ function login() { var onError = function(resp, textStatus, errorThrown) { $('#spinner').hide(); $('input').removeAttr('disabled'); - $('#errormsg').text("Couldn't log you in :( Bad password?"); + $('#errormsg').text(loginErrorText(resp)); } $.ajax({ @@ -182,4 +197,4 @@ $(function() { $('#memelogo').stop(true, false).animate({opacity: 1.0}, "fast").delay(LogoFadeDelay).animate({opacity: 0}, "slow"); }); $('#memelogo').delay(LogoFadeDelay).animate({opacity: 0}, "slow"); -});
\ No newline at end of file +}); diff --git a/static/js/home.js b/static/js/home.js index 9bee6ba..37666ae 100755 --- a/static/js/home.js +++ b/static/js/home.js @@ -145,9 +145,9 @@ function initBigHand(id){ function login() { var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); + var password = $('#passwordInput').val() || ''; var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : ''; - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + var hash = password ? hex_sha1(nick + '$' + password + '$dumpfm') : ''; var onSuccess = function(json) { location.href = '/chat'; @@ -530,4 +530,3 @@ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } - diff --git a/static/js/pichat-old.js b/static/js/pichat-old.js index 6eb5553..ba2d89e 100755 --- a/static/js/pichat-old.js +++ b/static/js/pichat-old.js @@ -8,7 +8,7 @@ return cookieValue;}}; // The root domain is used so that subdomains don't result in // spurious extra urls (e.g. both dump.fm/nick and sub.dump.fm/nick) var RootDomain = location.href.match(/http:\/\/(\w)+\./) - ? 'http://dump.fm/' : '/'; + ? '/' : '/'; var cache = {}; var PendingMessages = {}; @@ -653,7 +653,7 @@ console.log("update ui"); var onError = function(resp, textStatus, errorThrown) { var msg = $.trim(resp.responseText); if (msg == "UNKNOWN_ROOM") - location.href = "http://dump.fm"; + location.href = "/"; if (IsAdmin && window.console) { console.error(resp, textStatus, errorThrown); } @@ -1127,7 +1127,7 @@ function getMessageInfo(e){ var message = $(e).parents(".dump") var id = message.attr("id").substr(8) // cut "message-001" to "001" var nick = message.attr("nick") - var link = "http://dump.fm/p/" + nick + "/" + id + var link = "/p/" + nick + "/" + id var content = message.find(".linkify") if (!content.length) content = message.find(".content") var rawContent = content.html() @@ -1144,7 +1144,7 @@ Share = { }, "facebook": function(button){ var message = getMessageInfo(button) - var url = "http://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via + var url = "https://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via Share.openLink(url) }, "tumblr": function(button){ @@ -1504,7 +1504,7 @@ var Search = { }, 'doAjax': function(term) { - if (Domain == "http://dump.fm") { + if (Domain == "/") { $.ajax({ "dataType": "json", "url": "/cmd/search/" + term, @@ -1514,7 +1514,7 @@ var Search = { }) } else { // search main site via jsonp $("#search-script").remove() - $("head").append("<s"+"cript src='http://dump.fm/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") + $("head").append("<s"+"cript src='/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") } }, @@ -1549,7 +1549,7 @@ var Search = { results.forEach(function(r){ var url = r.url if (url.charAt(0) == '/') - url = 'http://dump.fm/images' + url + url = '/images' + url else url = 'http://' + url urls.push(url) @@ -1787,7 +1787,7 @@ function initChatMsgs() { var zoomlink = $('<a>') .attr({'href': img.attr('src') }) .addClass('msg-image-zoom') - .append($('<img>').attr('src', 'http://dump.fm/static/img/zoom.gif') + .append($('<img>').attr('src', '/static/img/zoom.gif') .addClass('zoom-icon')) .click(function() { window.open(img.attr('src')); return false; }); $(this).append(zoomlink); diff --git a/static/js/pichat.butt.js b/static/js/pichat.butt.js index ec2b068..bb1d00f 100755 --- a/static/js/pichat.butt.js +++ b/static/js/pichat.butt.js @@ -478,7 +478,7 @@ function initProfile() { t.html(buildMsgContent(t.text())); }); initLogThumb() - if (window.location.href == 'http://dump.fm/u/scottbot') { + if (window.location.href == '/u/scottbot') { $('body').append($('<embed src="/static/tunes/busters.mid" autostart="true" hidden="true">')); } }; @@ -817,7 +817,7 @@ function getMessageInfo(e){ var message = $(e).parents(".dump") var id = message.attr("id").substr(8) // cut "message-001" to "001" var nick = message.attr("nick") - var link = "http://dump.fm/p/" + nick + "/" + id + var link = "/p/" + nick + "/" + id var content = message.find(".linkify") if (!content.length) content = message.find(".content") var rawContent = content.html() @@ -834,7 +834,7 @@ Share = { }, "facebook": function(button){ var message = getMessageInfo(button) - var url = "http://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via + var url = "https://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via Share.openLink(url) }, "tumblr": function(button){ diff --git a/static/js/pichat.js b/static/js/pichat.js index 488aa88..895cfc7 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -201,7 +201,7 @@ var SHA1 = { // The root domain is used so that subdomains don't result in // spurious extra urls (e.g. both dump.fm/nick and sub.dump.fm/nick) window.RootDomain = location.href.match(/http:\/\/(\w)+\./) - ? 'http://dump.fm/' : '/'; + ? '/' : '/'; window.cache = {}; window.PendingMessages = {}; @@ -352,7 +352,7 @@ function initChatMsgs() { var zoomlink = $('<a>') .attr({'href': img.attr('src') }) .addClass('msg-image-zoom') - .append($('<img>').attr('src', 'http://dump.fm/static/img/zoom.gif') + .append($('<img>').attr('src', '/static/img/zoom.gif') .addClass('zoom-icon')) .click(function() { window.open(img.attr('src')); return false; }); $(this).append(zoomlink); @@ -428,7 +428,7 @@ function getMessageInfo(e){ var message = $(e).parents(".dump") var id = message.attr("id").substr(8) // cut "message-001" to "001" var nick = message.attr("nick") - var link = "http://dump.fm/p/" + nick + "/" + id + var link = "/p/" + nick + "/" + id var content = message.find(".linkify") if (!content.length) content = message.find(".content") var rawContent = content.html() @@ -1214,7 +1214,7 @@ function refresh() { var onError = function(resp, textStatus, errorThrown) { var msg = $.trim(resp.responseText); if (msg == "UNKNOWN_ROOM") - location.href = "http://dump.fm"; + location.href = "/"; if (IsAdmin && window.console) { console.error(resp, textStatus, errorThrown); } @@ -1837,7 +1837,7 @@ Search = { }, 'doAjax': function(term) { - if (Domain == "http://dump.fm") { + if (Domain == "/") { $.ajax({ "dataType": "json", "url": "/cmd/search/" + term, @@ -1847,7 +1847,7 @@ Search = { }) } else { // search main site via jsonp $("#search-script").remove() - $("head").append("<s"+"cript src='http://dump.fm/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") + $("head").append("<s"+"cript src='/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") } }, @@ -1882,7 +1882,7 @@ Search = { results.forEach(function(r){ var url = r.url if (url.charAt(0) == '/') - url = 'http://dump.fm/images' + url + url = '/images' + url else url = 'http://' + url urls.push(url) @@ -1913,7 +1913,7 @@ Share = { }, "facebook": function(button){ var message = getMessageInfo(button) - var url = "http://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via + var url = "https://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via Share.openLink(url) }, "tumblr": function(button){ diff --git a/static/js/pichat2.js b/static/js/pichat2.js index b0bba88..30fb055 100755 --- a/static/js/pichat2.js +++ b/static/js/pichat2.js @@ -201,7 +201,7 @@ var SHA1 = { // The root domain is used so that subdomains don't result in // spurious extra urls (e.g. both dump.fm/nick and sub.dump.fm/nick) window.RootDomain = location.href.match(/http:\/\/(\w)+\./) - ? 'http://dump.fm/' : '/'; + ? '/' : '/'; window.cache = {}; window.PendingMessages = {}; @@ -343,7 +343,7 @@ function initChatMsgs() { var zoomlink = $('<a>') .attr({'href': img.attr('src') }) .addClass('msg-image-zoom') - .append($('<img>').attr('src', 'http://dump.fm/static/img/zoom.gif') + .append($('<img>').attr('src', '/static/img/zoom.gif') .addClass('zoom-icon')) .click(function() { window.open(img.attr('src')); return false; }); $(this).append(zoomlink); @@ -419,7 +419,7 @@ function getMessageInfo(e){ var message = $(e).parents(".dump") var id = message.attr("id").substr(8) // cut "message-001" to "001" var nick = message.attr("nick") - var link = "http://dump.fm/p/" + nick + "/" + id + var link = "/p/" + nick + "/" + id var content = message.find(".linkify") if (!content.length) content = message.find(".content") var rawContent = content.html() @@ -1205,7 +1205,7 @@ function refresh() { var onError = function(resp, textStatus, errorThrown) { var msg = $.trim(resp.responseText); if (msg == "UNKNOWN_ROOM") - location.href = "http://dump.fm"; + location.href = "/"; if (IsAdmin && window.console) { console.error(resp, textStatus, errorThrown); } @@ -1828,7 +1828,7 @@ Search = { }, 'doAjax': function(term) { - if (Domain == "http://dump.fm") { + if (Domain == "/") { $.ajax({ "dataType": "json", "url": "/cmd/search/" + term, @@ -1838,7 +1838,7 @@ Search = { }) } else { // search main site via jsonp $("#search-script").remove() - $("head").append("<s"+"cript src='http://dump.fm/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") + $("head").append("<s"+"cript src='/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") } }, @@ -1873,7 +1873,7 @@ Search = { results.forEach(function(r){ var url = r.url if (url.charAt(0) == '/') - url = 'http://dump.fm/images' + url + url = '/images' + url else url = 'http://' + url urls.push(url) @@ -1904,7 +1904,7 @@ Share = { }, "facebook": function(button){ var message = getMessageInfo(button) - var url = "http://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via + var url = "https://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via Share.openLink(url) }, "tumblr": function(button){ diff --git a/static/js/register.js b/static/js/register.js index 91377e4..f4039a8 100755 --- a/static/js/register.js +++ b/static/js/register.js @@ -34,7 +34,7 @@ function submitRegistration() { // if (window.history && history.length > 1) // history.go(-1); // else - window.location.href = 'http://dump.fm/'; + window.location.href = '/'; }; var onError = function(resp) { diff --git a/static/js/src/_main.js b/static/js/src/_main.js index c95b98a..d97b0ac 100755 --- a/static/js/src/_main.js +++ b/static/js/src/_main.js @@ -1,7 +1,7 @@ // The root domain is used so that subdomains don't result in // spurious extra urls (e.g. both dump.fm/nick and sub.dump.fm/nick) window.RootDomain = location.href.match(/http:\/\/(\w)+\./) - ? 'http://dump.fm/' : '/'; + ? '/' : '/'; window.cache = {}; window.PendingMessages = {}; diff --git a/static/js/src/chat.js b/static/js/src/chat.js index b2816c7..7a82ad0 100755 --- a/static/js/src/chat.js +++ b/static/js/src/chat.js @@ -72,7 +72,7 @@ function initChatMsgs() { var zoomlink = $('<a>') .attr({'href': img.attr('src') }) .addClass('msg-image-zoom') - .append($('<img>').attr('src', 'http://dump.fm/static/img/zoom.gif') + .append($('<img>').attr('src', '/static/img/zoom.gif') .addClass('zoom-icon')) .click(function() { window.open(img.attr('src')); return false; }); $(this).append(zoomlink); @@ -148,7 +148,7 @@ function getMessageInfo(e){ var message = $(e).parents(".dump") var id = message.attr("id").substr(8) // cut "message-001" to "001" var nick = message.attr("nick") - var link = "http://dump.fm/p/" + nick + "/" + id + var link = "/p/" + nick + "/" + id var content = message.find(".linkify") if (!content.length) content = message.find(".content") var rawContent = content.html() diff --git a/static/js/src/messages.js b/static/js/src/messages.js index f7d0877..bdc738e 100755 --- a/static/js/src/messages.js +++ b/static/js/src/messages.js @@ -195,7 +195,7 @@ function refresh() { var onError = function(resp, textStatus, errorThrown) { var msg = $.trim(resp.responseText); if (msg == "UNKNOWN_ROOM") - location.href = "http://dump.fm"; + location.href = "/"; if (IsAdmin && window.console) { console.error(resp, textStatus, errorThrown); } diff --git a/static/js/src/search.js b/static/js/src/search.js index f62f432..c7bdabf 100755 --- a/static/js/src/search.js +++ b/static/js/src/search.js @@ -159,7 +159,7 @@ Search = { }, 'doAjax': function(term) { - if (Domain == "http://dump.fm") { + if (Domain == "/") { $.ajax({ "dataType": "json", "url": "/cmd/search/" + term, @@ -169,7 +169,7 @@ Search = { }) } else { // search main site via jsonp $("#search-script").remove() - $("head").append("<s"+"cript src='http://dump.fm/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") + $("head").append("<s"+"cript src='/cmd/search/"+term+"?callback=Search.results' id='search-script'></s"+"cript>") } }, @@ -204,7 +204,7 @@ Search = { results.forEach(function(r){ var url = r.url if (url.charAt(0) == '/') - url = 'http://dump.fm/images' + url + url = '/images' + url else url = 'http://' + url urls.push(url) diff --git a/static/js/src/share.js b/static/js/src/share.js index ecf8a00..976c930 100755 --- a/static/js/src/share.js +++ b/static/js/src/share.js @@ -5,7 +5,7 @@ Share = { }, "facebook": function(button){ var message = getMessageInfo(button) - var url = "http://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via + var url = "https://www.facebook.com/share.php?u=" + message.img + "&t=" + message.via Share.openLink(url) }, "tumblr": function(button){ |
