From cea5dc6130437feb778add24864dcf86bb4a52fc Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 21 Sep 2017 13:11:02 +0200 Subject: Sync with ikiwiki 3.20150610. --- ikiwiki/login-selector/aol.png | Bin 0 -> 460 bytes ikiwiki/login-selector/goa-account-flickr.png | Bin 0 -> 592 bytes ikiwiki/login-selector/goa-account-yahoo.png | Bin 0 -> 741 bytes ikiwiki/login-selector/login-selector.js | 264 ++++++++++++++++++++++++++ ikiwiki/login-selector/verisign.png | Bin 0 -> 714 bytes ikiwiki/login-selector/wordpress.png | Bin 0 -> 886 bytes ikiwiki/openid/aol.png | Bin 460 -> 0 bytes ikiwiki/openid/goa-account-flickr.png | Bin 592 -> 0 bytes ikiwiki/openid/goa-account-google.png | Bin 825 -> 0 bytes ikiwiki/openid/goa-account-yahoo.png | Bin 741 -> 0 bytes ikiwiki/openid/livejournal.png | Bin 772 -> 0 bytes ikiwiki/openid/openid-jquery.js | 260 ------------------------- ikiwiki/openid/verisign.png | Bin 714 -> 0 bytes ikiwiki/openid/wordpress.png | Bin 886 -> 0 bytes 14 files changed, 264 insertions(+), 260 deletions(-) create mode 100644 ikiwiki/login-selector/aol.png create mode 100644 ikiwiki/login-selector/goa-account-flickr.png create mode 100644 ikiwiki/login-selector/goa-account-yahoo.png create mode 100644 ikiwiki/login-selector/login-selector.js create mode 100644 ikiwiki/login-selector/verisign.png create mode 100644 ikiwiki/login-selector/wordpress.png delete mode 100644 ikiwiki/openid/aol.png delete mode 100644 ikiwiki/openid/goa-account-flickr.png delete mode 100644 ikiwiki/openid/goa-account-google.png delete mode 100644 ikiwiki/openid/goa-account-yahoo.png delete mode 100644 ikiwiki/openid/livejournal.png delete mode 100644 ikiwiki/openid/openid-jquery.js delete mode 100644 ikiwiki/openid/verisign.png delete mode 100644 ikiwiki/openid/wordpress.png diff --git a/ikiwiki/login-selector/aol.png b/ikiwiki/login-selector/aol.png new file mode 100644 index 0000000..d47f5fa Binary files /dev/null and b/ikiwiki/login-selector/aol.png differ diff --git a/ikiwiki/login-selector/goa-account-flickr.png b/ikiwiki/login-selector/goa-account-flickr.png new file mode 100644 index 0000000..5321642 Binary files /dev/null and b/ikiwiki/login-selector/goa-account-flickr.png differ diff --git a/ikiwiki/login-selector/goa-account-yahoo.png b/ikiwiki/login-selector/goa-account-yahoo.png new file mode 100644 index 0000000..51e1c11 Binary files /dev/null and b/ikiwiki/login-selector/goa-account-yahoo.png differ diff --git a/ikiwiki/login-selector/login-selector.js b/ikiwiki/login-selector/login-selector.js new file mode 100644 index 0000000..71ae046 --- /dev/null +++ b/ikiwiki/login-selector/login-selector.js @@ -0,0 +1,264 @@ +/* +Based on the Simple OpenID Plugin +http://code.google.com/p/openid-selector/ + +This code is licenced under the New BSD License. +*/ + +var selections_email_large = { + email: { + name: 'Email', + icon: 'wikiicons/email.png', + label: 'Enter your email address:', + url: null + } +}; +var selections_openid_large = { + openid: { + name: 'OpenID', + icon: 'wikiicons/openidlogin-bg.gif', + label: 'Enter your OpenID:', + url: null + } +}; +var selections_openid_small = { + verisign: { + name: 'Verisign', + icon: 'ikiwiki/login-selector/verisign.png', + label: 'Enter your Verisign username:', + url: 'http://{username}.pip.verisignlabs.com/' + }, + yahoo: { + name: 'Yahoo', + icon: 'ikiwiki/login-selector/goa-account-yahoo.png', + url: 'http://me.yahoo.com/' + }, + flickr: { + name: 'Flickr', + icon: 'ikiwiki/login-selector/goa-account-flickr.png', + label: 'Enter your Flickr username:', + url: 'http://flickr.com/photos/{username}/' + }, + wordpress: { + name: 'Wordpress', + icon: 'ikiwiki/login-selector/wordpress.png', + label: 'Enter your Wordpress.com username:', + url: 'http://{username}.wordpress.com/' + }, + aol: { + name: 'AOL', + icon: 'ikiwiki/login-selector/aol.png', + label: 'Enter your AOL username:', + url: 'http://openid.aol.com/{username}' + } +}; +var selections = $.extend({}, selections_email_large, selections_openid_large, selections_openid_small); + +var selector = { + + ajaxHandler: null, + cookie_expires: 6*30, // 6 months. + cookie_name: 'openid_selection', // historical name + cookie_path: '/', + + img_path: 'images/', + + input_id: null, + selection_url: null, + selection_id: null, + othersignin_id: null, + + init: function(input_id, login_methods, othersignin_id, othersignin_label) { + + var selector_btns = $('#login_btns'); + + this.input_id = input_id; + + $('#login_choice').show(); + $('#login_input_area').empty(); + + // add box for each selection + if (login_methods['openid']) { + for (id in selections_openid_large) { + selector_btns.append(this.getBoxHTML(selections_openid_large[id], 'large')); + } + } + if (login_methods['email']) { + for (id in selections_email_large) { + selector_btns.prepend(this.getBoxHTML(selections_email_large[id], 'large')); + } + } + + if (othersignin_label != "") { + this.othersignin_label=othersignin_label; + } + else { + this.othersignin_label="other"; + } + if (othersignin_id != "") { + this.othersignin_id=othersignin_id; + selector_btns.prepend( + '' + + '' + + ' ' + this.othersignin_label + + '' + ); + $('#'+this.othersignin_id).hide(); + } + + if (login_methods['openid'] && selections_openid_small) { + selector_btns.append('
'); + + for (id in selections_openid_small) { + selector_btns.append(this.getBoxHTML(selections_openid_small[id], 'small')); + } + } + + $('#login_selector_form').submit(this.submit); + + var box_id = this.readCookie(); + if (box_id) { + this.signin(box_id, true); + } + }, + getBoxHTML: function(selection, box_size) { + var label=""; + var title="" + if (box_size == 'large') { + label=' ' + selection["name"]; + } + else { + title=' title="'+selection["name"]+'"'; + } + var box_id = selection["name"].toLowerCase(); + return '' + + '' + + label + + ''; + + }, + /* selection image click */ + signin: function(box_id, onload) { + + if (box_id == 'othersignin') { + this.highlight(box_id); + $('#login_input_area').empty(); + $('#'+this.othersignin_id).show(); + this.setCookie(box_id); + return; + } + else { + if (this.othersignin_id) { + $('#'+this.othersignin_id).hide(); + } + } + + var selection = selections[box_id]; + if (! selection) { + return; + } + + this.highlight(box_id); + + this.selection_id = box_id; + this.selection_url = selection['url']; + + // prompt user for input? + if (selection['label']) { + this.setCookie(box_id); + this.useInputBox(selection); + } else { + this.setCookie(''); + $('#login_input_area').empty(); + if (! onload) { + $('#login_selector_form').submit(); + } + } + }, + /* Sign-in button click */ + submit: function() { + var url = selector.selection_url; + if (url) { + url = url.replace('{username}', $('#entry').val()); + selector.setOpenIdUrl(url); + } + else { + selector.setOpenIdUrl(""); + } + if (selector.ajaxHandler) { + selector.ajaxHandler(selector.selection_id, document.getElementById(selector.input_id).value); + return false; + } + return true; + }, + setOpenIdUrl: function (url) { + + var hidden = $('#'+this.input_id); + if (hidden.length > 0) { + hidden.value = url; + } else { + $('#login_selector_form').append(''); + } + }, + highlight: function (box_id) { + + // remove previous highlight. + var highlight = $('#login_highlight'); + if (highlight) { + highlight.replaceWith($('#login_highlight a')[0]); + } + // add new highlight. + $('.'+box_id).wrap('
'); + }, + setCookie: function (value) { + + var date = new Date(); + date.setTime(date.getTime()+(this.cookie_expires*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + + document.cookie = this.cookie_name+"="+value+expires+"; path=" + this.cookie_path; + }, + readCookie: function () { + var nameEQ = this.cookie_name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; + }, + useInputBox: function (selection) { + + var input_area = $('#login_input_area'); + + var html = ''; + var id = selection['name']+'_entry'; + var value = ''; + var label = selection['label']; + var style = ''; + + if (selection['name'] == 'OpenID') { + id = this.input_id; + value = ''; + style = 'background:#FFF url(wikiicons/openidlogin-bg.gif) no-repeat scroll 0 50%; padding-left:18px;'; + } + if (label) { + html = ''; + } + html += '' + + ''; + + input_area.empty(); + input_area.append(html); + + $('#'+id).focus(); + }, + setAjaxHandler: function (ajaxFunction) { + this.ajaxHandler = ajaxFunction; + } +}; diff --git a/ikiwiki/login-selector/verisign.png b/ikiwiki/login-selector/verisign.png new file mode 100644 index 0000000..5120812 Binary files /dev/null and b/ikiwiki/login-selector/verisign.png differ diff --git a/ikiwiki/login-selector/wordpress.png b/ikiwiki/login-selector/wordpress.png new file mode 100644 index 0000000..96e08bd Binary files /dev/null and b/ikiwiki/login-selector/wordpress.png differ diff --git a/ikiwiki/openid/aol.png b/ikiwiki/openid/aol.png deleted file mode 100644 index d47f5fa..0000000 Binary files a/ikiwiki/openid/aol.png and /dev/null differ diff --git a/ikiwiki/openid/goa-account-flickr.png b/ikiwiki/openid/goa-account-flickr.png deleted file mode 100644 index 5321642..0000000 Binary files a/ikiwiki/openid/goa-account-flickr.png and /dev/null differ diff --git a/ikiwiki/openid/goa-account-google.png b/ikiwiki/openid/goa-account-google.png deleted file mode 100644 index ae1caa8..0000000 Binary files a/ikiwiki/openid/goa-account-google.png and /dev/null differ diff --git a/ikiwiki/openid/goa-account-yahoo.png b/ikiwiki/openid/goa-account-yahoo.png deleted file mode 100644 index 51e1c11..0000000 Binary files a/ikiwiki/openid/goa-account-yahoo.png and /dev/null differ diff --git a/ikiwiki/openid/livejournal.png b/ikiwiki/openid/livejournal.png deleted file mode 100644 index d86ee5e..0000000 Binary files a/ikiwiki/openid/livejournal.png and /dev/null differ diff --git a/ikiwiki/openid/openid-jquery.js b/ikiwiki/openid/openid-jquery.js deleted file mode 100644 index 0400ae6..0000000 --- a/ikiwiki/openid/openid-jquery.js +++ /dev/null @@ -1,260 +0,0 @@ -/* -Simple OpenID Plugin -http://code.google.com/p/openid-selector/ - -This code is licenced under the New BSD License. -*/ - -var providers_large = { - google: { - name: 'Google', - icon: 'ikiwiki/openid/goa-account-google.png', - url: 'https://www.google.com/accounts/o8/id' - }, - verisign: { - name: 'Verisign', - icon: 'ikiwiki/openid/verisign.png', - label: 'Enter your Verisign username:', - url: 'http://{username}.pip.verisignlabs.com/' - }, - yahoo: { - name: 'Yahoo', - icon: 'ikiwiki/openid/goa-account-yahoo.png', - url: 'http://me.yahoo.com/' - }, - openid: { - name: 'OpenID', - icon: 'wikiicons/openidlogin-bg.gif', - label: 'Enter your OpenID:', - url: null - } -}; -var providers_small = { - livejournal: { - name: 'LiveJournal', - icon: 'ikiwiki/openid/livejournal.png', - label: 'Enter your Livejournal username:', - url: 'http://{username}.livejournal.com/' - }, - flickr: { - name: 'Flickr', - icon: 'ikiwiki/openid/goa-account-flickr.png', - label: 'Enter your Flickr username:', - url: 'http://flickr.com/photos/{username}/' - }, - wordpress: { - name: 'Wordpress', - icon: 'ikiwiki/openid/wordpress.png', - label: 'Enter your Wordpress.com username:', - url: 'http://{username}.wordpress.com/' - }, - aol: { - name: 'AOL', - icon: 'ikiwiki/openid/aol.png', - label: 'Enter your AOL username:', - url: 'http://openid.aol.com/{username}' - } -}; -var providers = $.extend({}, providers_large, providers_small); - -var openid = { - - demo: false, - ajaxHandler: null, - cookie_expires: 6*30, // 6 months. - cookie_name: 'openid_provider', - cookie_path: '/', - - img_path: 'images/', - - input_id: null, - provider_url: null, - provider_id: null, - localsignin_id: null, - - init: function(input_id, localsignin_id) { - - var openid_btns = $('#openid_btns'); - - this.input_id = input_id; - - $('#openid_choice').show(); - $('#openid_input_area').empty(); - - // add box for each provider - for (id in providers_large) { - openid_btns.append(this.getBoxHTML(providers_large[id], 'large')); - } - - if (providers_small) { - openid_btns.append('
'); - - for (id in providers_small) { - - openid_btns.append(this.getBoxHTML(providers_small[id], 'small')); - } - } - if (localsignin_id != "") { - this.localsignin_id=localsignin_id; - openid_btns.append( - '' + - '' + - ' other' + - '' - ); - $('#'+this.localsignin_id).hide(); - } - - $('#openid_form').submit(this.submit); - - var box_id = this.readCookie(); - if (box_id) { - this.signin(box_id, true); - } - }, - getBoxHTML: function(provider, box_size) { - var label=""; - var title="" - if (box_size == 'large') { - label=' ' + provider["name"]; - } - else { - title=' title="'+provider["name"]+'"'; - } - var box_id = provider["name"].toLowerCase(); - return '' + - '' + - label + - ''; - - }, - /* Provider image click */ - signin: function(box_id, onload) { - - if (box_id == 'localsignin') { - this.highlight(box_id); - $('#openid_input_area').empty(); - $('#'+this.localsignin_id).show(); - this.setCookie(box_id); - return; - } - else { - if (this.localsignin_id) { - $('#'+this.localsignin_id).hide(); - } - } - - var provider = providers[box_id]; - if (! provider) { - return; - } - - this.highlight(box_id); - - this.provider_id = box_id; - this.provider_url = provider['url']; - - // prompt user for input? - if (provider['label']) { - this.setCookie(box_id); - this.useInputBox(provider); - } else { - this.setCookie(''); - $('#openid_input_area').empty(); - if (! onload) { - $('#openid_form').submit(); - } - } - }, - /* Sign-in button click */ - submit: function() { - - var url = openid.provider_url; - if (url) { - url = url.replace('{username}', $('#openid_username').val()); - openid.setOpenIdUrl(url); - } - if(openid.ajaxHandler) { - openid.ajaxHandler(openid.provider_id, document.getElementById(openid.input_id).value); - return false; - } - if(openid.demo) { - alert("In client demo mode. Normally would have submitted OpenID:\r\n" + document.getElementById(openid.input_id).value); - return false; - } - return true; - }, - setOpenIdUrl: function (url) { - - var hidden = $('#'+this.input_id); - if (hidden.length > 0) { - hidden.value = url; - } else { - $('#openid_form').append(''); - } - }, - highlight: function (box_id) { - - // remove previous highlight. - var highlight = $('#openid_highlight'); - if (highlight) { - highlight.replaceWith($('#openid_highlight a')[0]); - } - // add new highlight. - $('.'+box_id).wrap('
'); - }, - setCookie: function (value) { - - var date = new Date(); - date.setTime(date.getTime()+(this.cookie_expires*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - - document.cookie = this.cookie_name+"="+value+expires+"; path=" + this.cookie_path; - }, - readCookie: function () { - var nameEQ = this.cookie_name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); - } - return null; - }, - useInputBox: function (provider) { - - var input_area = $('#openid_input_area'); - - var html = ''; - var id = 'openid_username'; - var value = ''; - var label = provider['label']; - var style = ''; - - if (provider['name'] == 'OpenID') { - id = this.input_id; - value = ''; - style = 'background:#FFF url(wikiicons/openidlogin-bg.gif) no-repeat scroll 0 50%; padding-left:18px;'; - } - if (label) { - html = ''; - } - html += '' + - ''; - - input_area.empty(); - input_area.append(html); - - $('#'+id).focus(); - }, - setDemoMode: function (demoMode) { - this.demo = demoMode; - }, - setAjaxHandler: function (ajaxFunction) { - this.ajaxHandler = ajaxFunction; - } -}; diff --git a/ikiwiki/openid/verisign.png b/ikiwiki/openid/verisign.png deleted file mode 100644 index 5120812..0000000 Binary files a/ikiwiki/openid/verisign.png and /dev/null differ diff --git a/ikiwiki/openid/wordpress.png b/ikiwiki/openid/wordpress.png deleted file mode 100644 index 96e08bd..0000000 Binary files a/ikiwiki/openid/wordpress.png and /dev/null differ -- cgit v1.2.3