X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=jappixmini%2Flib.js;h=31302732874ea9c6bf186c4e981442f34ec2cd57;hb=d9330e3b05c71bbd172293fb223271033d3b19f7;hp=610a831230538acc966d516b86e2c5e691d8fc98;hpb=c376bc162bf611345d7796e4844e57cc9ae780c5;p=friendica-addons.git diff --git a/jappixmini/lib.js b/jappixmini/lib.js index 610a8312..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