X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=jappixmini%2Flib.js;h=31302732874ea9c6bf186c4e981442f34ec2cd57;hb=99b69aaa95d2ec4338b3965319ce57267970368d;hp=6ab4644d7812d2bd7bf537731a279510e385c738;hpb=af99d51a7cc8916c3fe9802a25f82a64b4b3b526;p=friendica-addons.git diff --git a/jappixmini/lib.js b/jappixmini/lib.js index 6ab4644d..31302732 100644 --- a/jappixmini/lib.js +++ b/jappixmini/lib.js @@ -1,9 +1,15 @@ +// +// Copyright 2012 "Leberwurscht" +// +// This file is dual-licensed under the MIT license (see MIT.txt) and the AGPL license (see jappix/COPYING). +// + function jappixmini_addon_xor(str1, str2) { if (str1.length != str2.length) throw "not same length"; - encoded = ""; + var encoded = ""; - for (i=0; iRetype your Friendica password for chatting:'); - div.append($("
")); - input = $('') - div.append(input); - button = $(''); + var div = document.getElementById("#jappixmini-password-query-div"); + + if (!div) { + div = $('
Retype your Friendica password for chatting:
'); + + var input = $('') + div.append(input); + + var button = $(''); + div.append(button); + + $("body").append(div); + } + button.click(function(){ - password = input.val(); + var password = $("#jappixmini-password-query-input").val(); jappixmini_addon_set_client_secret(password); div.remove(); + + var client_secret = getPersistent('jappix-mini', 'client-secret'); + callback(client_secret); }); - div.append(button); - $("body").append(div); } - - return client_secret; + else { + callback(client_secret); + } } -function jappixmini_addon_encrypt_password(password) { - client_secret = jappixmini_addon_get_client_secret(); - - // add \0 to password until it has the same length as secret - if (password.length>client_secret.length-1) throw "password too long"; - while (password.lengthclient_secret.length-1) throw "password too long"; + while (password.length