diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/acl.js | 16 | ||||
-rw-r--r-- | js/crypto.js | 46 | ||||
-rw-r--r-- | js/icon_translate.js | 53 | ||||
-rw-r--r-- | js/jquery-compat.js | 71 | ||||
-rw-r--r-- | js/main.js | 55 |
5 files changed, 197 insertions, 44 deletions
@@ -152,11 +152,23 @@ ACL.prototype.set_deny = function(itemid){ } ACL.prototype.update_view = function(){ + var jotpermslock; + var jotpermsunlock; + if (document.jotpermslock == null) { + jotpermslock = 'lock'; + } else { + jotpermslock = document.jotpermslock; + } + if (document.jotpermsunlock == null) { + jotpermsunlock = 'unlock'; + } else { + jotpermsunlock = document.jotpermsunlock; + } if (that.allow_gid.length==0 && that.allow_cid.length==0 && that.deny_gid.length==0 && that.deny_cid.length==0){ that.showall.addClass("selected"); /* jot acl */ - $('#jot-perms-icon').removeClass('lock').addClass('unlock'); + $('#jot-perms-icon').removeClass(jotpermslock).addClass(jotpermsunlock); $('#jot-public').show(); $('.profile-jot-net input').attr('disabled', false); if(typeof editor != 'undefined' && editor != false) { @@ -166,7 +178,7 @@ ACL.prototype.update_view = function(){ } else { that.showall.removeClass("selected"); /* jot acl */ - $('#jot-perms-icon').removeClass('unlock').addClass('lock'); + $('#jot-perms-icon').removeClass(jotpermsunlock).addClass(jotpermslock); $('#jot-public').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); $('#profile-jot-desc').html(' '); diff --git a/js/crypto.js b/js/crypto.js index a7b278537..a144e03ea 100644 --- a/js/crypto.js +++ b/js/crypto.js @@ -18,6 +18,11 @@ function str_rot13 (str) { } +// Arrays for pluggable encryptors/decryptors + +var red_encryptors = new Array(); +var red_decryptors = new Array(); + // We probably just want the element where the text is and find it ourself. e.g. if // there is highlighted text use it, otherwise use the entire text. // So the third element may be useless. Fix also in view/tpl/jot.tpl before @@ -86,6 +91,13 @@ function red_encrypt(alg, elem,text) { newdiv = "[crypt alg='3des' hint='" + enc_hint + "']" + encrypted + '[/crypt]'; } + if((red_encryptors.length) && (! newdiv.length)) { + for(var i = 0; i < red_encryptors.length; i ++) { + newdiv = red_encryptors[i](alg,text); + if(newdiv.length) + break; + } + } enc_key = ''; @@ -118,22 +130,30 @@ function red_encrypt(alg, elem,text) { function red_decrypt(alg,hint,text,elem) { - var enc_text = ''; + var dec_text = ''; if(alg == 'rot13' || alg == 'triple-rot13') - enc_text = str_rot13(text); + dec_text = str_rot13(text); + else { + var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); + } if(alg == 'aes256') { - var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); - enc_text = CryptoJS.AES.decrypt(text,enc_key); + dec_text = CryptoJS.AES.decrypt(text,enc_key); } if(alg == 'rabbit') { - var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); - enc_text = CryptoJS.Rabbit.decrypt(text,enc_key); + dec_text = CryptoJS.Rabbit.decrypt(text,enc_key); } if(alg == '3des') { - var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); - enc_text = CryptoJS.TripleDES.decrypt(text,enc_key); + dec_text = CryptoJS.TripleDES.decrypt(text,enc_key); + } + + if((red_decryptors.length) && (! dec_text.length)) { + for(var i = 0; i < red_decryptors.length; i ++) { + dec_text = red_decryptors[i](alg,text,enc_key); + if(dec_text.length) + break; + } } enc_key = ''; @@ -144,16 +164,16 @@ function red_decrypt(alg,hint,text,elem) { // wipe out the text and make you re-enter the key if it was in the // conversation. For now we do that so you can read it. - var enc_result = enc_text.toString(CryptoJS.enc.Utf8); - delete enc_text; + var dec_result = dec_text.toString(CryptoJS.enc.Utf8); + delete dec_text; // incorrect decryptions *usually* but don't always have zero length // If the person typo'd let them try again without reloading the page // otherwise they'll have no "padlock" to click to try again. - if(enc_result.length) { - $(elem).html(b2h(enc_result)); - enc_result = ''; + if(dec_result.length) { + $(elem).html(b2h(dec_result)); + dec_result = ''; } } diff --git a/js/icon_translate.js b/js/icon_translate.js new file mode 100644 index 000000000..9e69e0b7d --- /dev/null +++ b/js/icon_translate.js @@ -0,0 +1,53 @@ +// Include this file and adjust as necessary for alternate icon sets which use different icon names. + +$(document).ready(function() { + + $('.icon-smile').addClass(''); + $('.icon-star-empty').addClass(''); + $('.icon-star-full').addClass(''); + $('.icon-star').addClass(''); + $('.icon-remove').addClass(''); + $('.icon-search').addClass(''); + $('.icon-facetime-video').addClass(''); + $('.icon-volume-up').addClass(''); + $('.icon-picture').addClass(''); + $('.icon-align-justify').addClass(''); + $('.icon-question').addClass(''); + $('.icon-ok').addClass(''); + $('.icon-lock').addClass(''); + $('.icon-unlock').addClass(''); + $('.icon-th').addClass(''); + $('.icon-home').addClass(''); + $('.icon-envelope').addClass(''); + $('.icon-calendar').addClass(''); + $('.icon-user').addClass(''); + $('.icon-exclamation').addClass(''); + $('.icon-sitemap').addClass(''); + $('.icon-cogs').addClass(''); + $('.icon-paper-clip').addClass(''); + $('.icon-pencil').addClass(''); + $('.icon-remove').addClass(''); + $('.icon-ok').addClass(''); + $('.icon-folder-close').addClass(''); + $('.icon-camera').addClass(''); + $('.icon-paper-clip').addClass(''); + $('.icon-link').addClass(''); + $('.icon-eraser').addClass(''); + $('.icon-key').addClass(''); + $('.icon-asterisk').addClass(''); + $('.icon-backward').addClass(''); + $('.icon-forward').addClass(''); + $('.icon-external-link').addClass(''); + $('.icon-eye-open').addClass(''); + $('.icon-bold').addClass(''); + $('.icon-italic').addClass(''); + $('.icon-underline').addClass(''); + $('.icon-quote-left').addClass(''); + $('.icon-terminal').addClass(''); + $('.icon-camera').addClass(''); + $('.icon-link').addClass(''); + $('.icon-check-empty').addClass(''); + $('.icon-check').addClass(''); + $('.icon-globe').addClass(''); + $('.icon-circle-blank').addClass(''); +});
\ No newline at end of file diff --git a/js/jquery-compat.js b/js/jquery-compat.js new file mode 100644 index 000000000..7bf912542 --- /dev/null +++ b/js/jquery-compat.js @@ -0,0 +1,71 @@ + +// provide jquery.browser so we can get rid of the migration toolkit + +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + + +// Don't clobber any existing jQuery.browser in case it's different +if ( !jQuery.browser ) { + matched = jQuery.uaMatch( navigator.userAgent ); + browser = {}; + + if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; + } + + // Chrome is Webkit, but Webkit is also Safari. + if ( browser.chrome ) { + browser.webkit = true; + } else if ( browser.webkit ) { + browser.safari = true; + } + + jQuery.browser = browser; +} + +jQuery.fn.toggle = function( fn, fn2 ) { + + // Don't mess with animation or css toggles + if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { + return oldToggle.apply( this, arguments ); + } + + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); +}; diff --git a/js/main.js b/js/main.js index f9dc95daa..70d11bfd3 100644 --- a/js/main.js +++ b/js/main.js @@ -150,7 +150,7 @@ var scroll_next = false; var next_page = 1; var page_load = true; - var loadingPage = false; + var loadingPage = true; var pageHasMoreContent = true; var updateCountsOnly = false; @@ -511,6 +511,10 @@ function updateConvItems(mode,data) { } prev = ident; }); + + if(loadingPage) { + loadingPage = false; + } } $('.like-rotator').spin(false); @@ -523,7 +527,7 @@ function updateConvItems(mode,data) { /* autocomplete @nicknames */ $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl"); - var bimgs = $(".wall-item-body > img").not(function() { return this.complete; }); + var bimgs = $(".wall-item-body img").not(function() { return this.complete; }); var bimgcount = bimgs.length; if (bimgcount) { @@ -984,35 +988,28 @@ function previewTheme(elm) { $(document).ready(function() { -jQuery.timeago.settings.strings = { - prefixAgo : aStr['t01'], - prefixFromNow : aStr['t02'], - suffixAgo : aStr['t03'], - suffixFromNow : aStr['t04'], - seconds : aStr['t05'], - minute : aStr['t06'], - minutes : aStr['t07'], - hour : aStr['t08'], - hours : aStr['t09'], - day : aStr['t10'], - days : aStr['t11'], - month : aStr['t12'], - months : aStr['t13'], - year : aStr['t14'], - years : aStr['t15'], - wordSeparator : aStr['t16'], - numbers : aStr['t17'], -}; - - -$(".autotime").timeago(); -//$("div.wall-item-body").divgrow({ initialHeight: 400 }); - -//reCalcHeight(); - - + jQuery.timeago.settings.strings = { + prefixAgo : aStr['t01'], + prefixFromNow : aStr['t02'], + suffixAgo : aStr['t03'], + suffixFromNow : aStr['t04'], + seconds : aStr['t05'], + minute : aStr['t06'], + minutes : aStr['t07'], + hour : aStr['t08'], + hours : aStr['t09'], + day : aStr['t10'], + days : aStr['t11'], + month : aStr['t12'], + months : aStr['t13'], + year : aStr['t14'], + years : aStr['t15'], + wordSeparator : aStr['t16'], + numbers : aStr['t17'], + }; + $(".autotime").timeago(); }); |