Browse Source

update vendor libs and mock.js script.

sisyphus
Dustin Falgout 8 years ago
parent
commit
d6c54a368e
  1. 8
      themes/_vendor/js/bootstrap.min.js
  2. 8
      themes/_vendor/js/jquery.min.js
  3. 13
      themes/_vendor/js/js.cookie.min.js
  4. 391
      themes/_vendor/js/mock.js

8
themes/_vendor/js/bootstrap.min.js vendored

File diff suppressed because one or more lines are too long

8
themes/_vendor/js/jquery.min.js vendored

File diff suppressed because one or more lines are too long

13
themes/_vendor/js/js.cookie.min.js vendored

@ -1,11 +1,2 @@
/*! /*! js-cookie v2.1.3 | MIT */
* JavaScript Cookie v2.1.0 !function(a){var b=!1;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if("undefined"!=typeof document){if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(i){}return e=c.write?c.write(e,b):encodeURIComponent(e+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+""),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape),document.cookie=b+"="+e+(f.expires?"; expires="+f.expires.toUTCString():"")+(f.path?"; path="+f.path:"")+(f.domain?"; domain="+f.domain:"")+(f.secure?"; secure":"")}b||(g={});for(var j=document.cookie?document.cookie.split("; "):[],k=/(%[0-9A-Z]{2})+/g,l=0;l<j.length;l++){var m=j[l].split("="),n=m.slice(1).join("=");'"'===n.charAt(0)&&(n=n.slice(1,-1));try{var o=m[0].replace(k,decodeURIComponent);if(n=c.read?c.read(n,o):c(n,o)||n.replace(k,decodeURIComponent),this.json)try{n=JSON.parse(n)}catch(i){}if(b===o){g=n;break}b||(g[o]=n)}catch(i){}}return g}}return d.set=d,d.get=function(a){return d.call(d,a)},d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b(function(){})});
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
(function(k){if("function"===typeof define&&define.amd)define(k);else if("object"===typeof exports)module.exports=k();else{var g=window.Cookies,b=window.Cookies=k();b.noConflict=function(){window.Cookies=g;return b}}})(function(){function k(){for(var b=0,c={};b<arguments.length;b++){var a=arguments[b],f;for(f in a)c[f]=a[f]}return c}function g(b){function c(a,f,e){var h;if(1<arguments.length){e=k({path:"/"},c.defaults,e);if("number"===typeof e.expires){var l=new Date;l.setMilliseconds(l.getMilliseconds()+
864E5*e.expires);e.expires=l}try{h=JSON.stringify(f),/^[\{\[]/.test(h)&&(f=h)}catch(g){}f=b.write?b.write(f,a):encodeURIComponent(String(f)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);a=encodeURIComponent(String(a));a=a.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);a=a.replace(/[\(\)]/g,escape);return document.cookie=[a,"=",f,e.expires&&"; expires="+e.expires.toUTCString(),e.path&&"; path="+e.path,e.domain&&"; domain="+e.domain,e.secure?"; secure":
""].join("")}a||(h={});for(var l=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,n=0;n<l.length;n++){var d=l[n].split("="),m=d[0].replace(p,decodeURIComponent),d=d.slice(1).join("=");'"'===d.charAt(0)&&(d=d.slice(1,-1));try{d=b.read?b.read(d,m):b(d,m)||d.replace(p,decodeURIComponent);if(this.json)try{d=JSON.parse(d)}catch(g){}if(a===m){h=d;break}a||(h[m]=d)}catch(g){}}return h}c.get=c.set=c;c.getJSON=function(){return c.apply({json:!0},[].slice.call(arguments))};c.defaults={};
c.remove=function(a,b){c(a,"",k(b,{expires:-1}))};c.withConverter=g;return c}return g(function(){})});

391
themes/_vendor/js/mock.js vendored

@ -26,11 +26,6 @@
*/ */
if ( 'lightdm' in window ) {
throw new Error('Cannot use LightDM Mock while the greeter is running!');
}
/** @ignore */ /** @ignore */
String.prototype.capitalize = function() { String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1); return this.charAt(0).toUpperCase() + this.slice(1);
@ -346,6 +341,383 @@ let MockObjects = {
}; };
/**
* Singleton class which implements the LightDMGreeter Interface. Greeter themes will
* interact directly with this class to facilitate the user log in processes.
* The greeter will automatically create an instance of this class when it starts.
* The instance can be accessed with the global variable: `lightdm`.
* @memberOf LightDM
*/
class LightDMGreeter {
constructor() {
if ( null !== lightdm ) {
return lightdm;
}
lightdm = this;
this._mock_data = MockData();
this._initialize();
}
/**
* @private
*/
_do_mocked_system_action( action ) {
alert(`System ${action} triggered.`);
document.location.reload(true);
return true;
}
/**
* @private
*/
_initialize() {
this._set_default_property_values();
}
/**
* @private
*/
_populate_ldm_object_arrays() {
for ( let object_type of ['sessions', 'users', 'languages', 'layouts'] ) {
let object_name = object_type.slice(0, -1).capitalize(),
ObjectClass = `LightDM${object_name}`;
for ( let object_info of this._mock_data[object_type] ) {
this[object_type].push(MockObjects[ObjectClass](object_info));
}
}
}
/**
* @private
*/
_set_default_property_values() {
for ( let property_type of Object.keys(this._mock_data.greeter.properties) ) {
for ( let property of this._mock_data.greeter.properties[property_type] ) {
if ( property.indexOf('can_') > -1 ) {
// System Power Actions
this[`_${property}`] = true;
} else {
this[`_${property}`] = this._mock_data.greeter.default_values[property_type]();
}
}
}
this._populate_ldm_object_arrays();
}
/**
* The username of the user being authenticated or {@link null}
* if no authentication is in progress.
* @type {String|null}
* @readonly
*/
get authentication_user() {
return this._authentication_user;
}
/**
* Whether or not the guest account should be automatically logged
* into when the timer expires.
* @type {Boolean}
* @readonly
*/
get autologin_guest() {
return this._autologin_guest;
}
/**
* The number of seconds to wait before automatically logging in.
* @type {Number}
* @readonly
*/
get autologin_timeout() {
return this._autologin_timeout;
}
/**
* The username with which to automatically log in when the timer expires.
* @type {String}
* @readonly
*/
get autologin_user() {
return this._autologin_user;
}
/**
* Whether or not the greeter can make the system hibernate.
* @type {Boolean}
* @readonly
*/
get can_hibernate() {
return this._can_hibernate;
}
/**
* Whether or not the greeter can make the system restart.
* @type {Boolean}
* @readonly
*/
get can_restart() {
return this._can_restart;
}
/**
* Whether or not the greeter can make the system shutdown.
* @type {Boolean}
* @readonly
*/
get can_shutdown() {
return this._can_shutdown;
}
/**
* Whether or not the greeter can make the system suspend/sleep.
* @type {Boolean}
* @readonly
*/
get can_suspend() {
return this._can_suspend;
}
/**
* The name of the default session.
* @type {String}
* @readonly
*/
get default_session() {
return this._default_session;
}
/**
* Whether or not guest sessions are supported.
* @type {Boolean}
* @readonly
*/
get has_guest_account() {
return this._has_guest_account;
}
/**
* Whether or not user accounts should be hidden.
* @type {Boolean}
* @readonly
*/
get hide_users() {
return this._hide_users;
}
/**
* The system's hostname.
* @type {String}
* @readonly
*/
get hostname() {
return this._hostname;
}
/**
* Whether or not the greeter is in the process of authenticating.
* @type {Boolean}
* @readonly
*/
get in_authentication() {
return this._in_authentication;
}
/**
* Whether or not the greeter has successfully authenticated.
* @type {Boolean}
* @readonly
*/
get is_authenticated() {
return this._is_authenticated;
}
/**
* The current language or {@link null} if no language.
* @type {LightDMLanguage|null}
* @readonly
*/
get language() {
return this._language;
}
/**
* A list of languages to present to the user.
* @type {LightDMLanguage[]}
* @readonly
*/
get languages() {
return this._languages;
}
/**
* The currently active layout for the selected user.
* @type {LightDMLayout}
*/
get layout() {
return this._layout;
}
/**
* Set the active layout for the selected user.
* @param {LightDMLayout} value
*/
set layout( value ) {
this._layout = value;
}
/**
* A list of keyboard layouts to present to the user.
* @type {LightDMLayout[]}
* @readonly
*/
get layouts() {
return this._layouts;
}
/**
* Whether or not the greeter was started as a lock screen.
* @type {Boolean}
* @readonly
*/
get lock_hint() {
return this._lock_hint;
}
/**
* The number of users able to log in.
* @type {Number}
* @readonly
*/
get num_users() {
return this.users.length;
}
/**
* Whether or not the guest account should be selected by default.
* @type {Boolean}
* @readonly
*/
get select_guest_hint() {
return this._select_guest_hint;
}
/**
* The username to select by default.
* @type {String}
* @readonly
*/
get select_user_hint() {
return this._select_user_hint;
}
/**
* List of available sessions.
* @type {LightDMSession[]}
* @readonly
*/
get sessions() {
return this._sessions;
}
/**
* List of available users.
* @type {LightDMUser[]}
* @readonly
*/
get users() {
return this._users;
}
/**
* Starts the authentication procedure for a user.
*
* @arg {String|null} username A username or {@link null} to prompt for a username.
*/
authenticate( username = null ) {}
/**
* Starts the authentication procedure for the guest user.
*/
authenticate_as_guest() {}
/**
* Cancel user authentication that is currently in progress.
*/
cancel_authentication() {}
/**
* Cancel the automatic login.
*/
cancel_autologin() {}
/**
* Get the value of a hint.
* @arg {String} name The name of the hint to get.
* @returns {String|Boolean|Number|null}
*/
get_hint( name ) {}
/**
* Triggers the system to hibernate.
* @returns {Boolean} {@link true} if hibernation initiated, otherwise {@link false}
*/
hibernate() {
return this._do_mocked_system_action('hibernate');
}
/**
* Provide a response to a prompt.
* @arg {*} response
*/
respond( response ) {}
/**
* Triggers the system to restart.
* @returns {Boolean} {@link true} if restart initiated, otherwise {@link false}
*/
restart() {
return this._do_mocked_system_action('restart');
}
/**
* Set the language for the currently authenticated user.
* @arg {String} language The language in the form of a locale specification (e.g.
* 'de_DE.UTF-8')
* @returns {Boolean} {@link true} if successful, otherwise {@link false}
*/
set_language( language ) {}
/**
* Triggers the system to shutdown.
* @returns {Boolean} {@link true} if shutdown initiated, otherwise {@link false}
*/
shutdown() {
return this._do_mocked_system_action('shutdown');
}
/**
* Start a session for the authenticated user.
* @arg {String|null} session The session to log into or {@link null} to use the default.
* @returns {Boolean} {@link true} if successful, otherwise {@link false}
*/
start_session( session ) {}
/**
* Triggers the system to suspend/sleep.
* @returns {Boolean} {@link true} if suspend/sleep initiated, otherwise {@link false}
*/
suspend() {
return this._do_mocked_system_action('suspend');
}
}
/** /**
* Mock data to simulate the greeter's API in any web browser. * Mock data to simulate the greeter's API in any web browser.
@ -478,11 +850,10 @@ let MockData = () => ({
}); });
if ( ! ( 'lightdm' in window ) ) { new ConfigFile();
new ConfigFile(); new GreeterUtil();
new GreeterUtil(); new LightDMGreeter();
new LightDMGreeter();
}
// mock lighdm for testing // mock lighdm for testing
/* /*

Loading…
Cancel
Save