Initial Commit
This commit is contained in:
commit
e8f7955c1c
5432 files changed
+1397750
No files matched your search
@@ -0,0 +1,150 @@
|
||||
/* global Vue, wu_addons, ajaxurl, _ */
|
||||
(function($) {
|
||||
|
||||
const search_addon = new Vue({
|
||||
el: '#search-addons',
|
||||
data: {
|
||||
search: wu_addons.search,
|
||||
},
|
||||
});
|
||||
|
||||
const wu_main_addon_app = new Vue({
|
||||
el: '#wu-addon',
|
||||
data() {
|
||||
|
||||
return {
|
||||
loading: true,
|
||||
category: wu_addons.category,
|
||||
addons: [],
|
||||
};
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.fetch_addons_list();
|
||||
|
||||
},
|
||||
computed: {
|
||||
search() {
|
||||
|
||||
return search_addon.search;
|
||||
|
||||
},
|
||||
i18n() {
|
||||
|
||||
return window.wu_addons.i18n;
|
||||
|
||||
},
|
||||
categories() {
|
||||
|
||||
let categories = [];
|
||||
|
||||
_.each(this.addons, function(addon) {
|
||||
|
||||
categories = categories.concat(addon.categories);
|
||||
|
||||
});
|
||||
|
||||
return _.unique(categories);
|
||||
|
||||
},
|
||||
addons_list() {
|
||||
|
||||
const app = this;
|
||||
|
||||
return _.filter(app.addons, function(addon, slug) {
|
||||
|
||||
addon.slug = slug;
|
||||
|
||||
if (app.category !== 'all' && ! _.contains(addon.categories.map((item) => item.toLowerCase()), app.category.toLowerCase())) {
|
||||
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (! app.search) {
|
||||
|
||||
return true;
|
||||
|
||||
} // end if;
|
||||
|
||||
const search = [
|
||||
addon.slug,
|
||||
addon.name,
|
||||
addon.categories,
|
||||
addon.description,
|
||||
];
|
||||
|
||||
return search.join('').toLowerCase().indexOf(app.search.toLowerCase()) > -1;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
fetch_addons_list() {
|
||||
|
||||
const app = this;
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'serve_addons_list',
|
||||
},
|
||||
success(data) {
|
||||
|
||||
app.addons = data.data;
|
||||
|
||||
app.loading = false;
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
new Vue({
|
||||
el: '.wp-heading-inline',
|
||||
data: {},
|
||||
computed: {
|
||||
count() {
|
||||
|
||||
return wu_main_addon_app.addons_list.length;
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
new Vue({
|
||||
el: '#addons-menu',
|
||||
data: {},
|
||||
methods: {
|
||||
set_category(category) {
|
||||
|
||||
this.main_app.category = category;
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
|
||||
url.searchParams.set('tab', category); // setting your param
|
||||
|
||||
history.pushState({}, null, url);
|
||||
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
main_app() {
|
||||
|
||||
return wu_main_addon_app;
|
||||
|
||||
},
|
||||
category() {
|
||||
|
||||
return wu_main_addon_app.category;
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){const a=new Vue({el:"#search-addons",data:{search:wu_addons.search}}),t=new Vue({el:"#wu-addon",data:()=>({loading:!0,category:wu_addons.category,addons:[]}),mounted(){this.fetch_addons_list()},computed:{search:()=>a.search,i18n:()=>window.wu_addons.i18n,categories(){let e=[];return _.each(this.addons,(function(a){e=e.concat(a.categories)})),_.unique(e)},addons_list(){const e=this;return _.filter(e.addons,(function(a,t){if(a.slug=t,"all"!==e.category&&!_.contains(a.categories.map((e=>e.toLowerCase())),e.category.toLowerCase()))return!1;if(!e.search)return!0;return[a.slug,a.name,a.categories,a.description].join("").toLowerCase().indexOf(e.search.toLowerCase())>-1}))}},methods:{fetch_addons_list(){const a=this;e.ajax({method:"GET",url:ajaxurl,data:{action:"serve_addons_list"},success(e){a.addons=e.data,a.loading=!1}})}}});new Vue({el:".wp-heading-inline",data:{},computed:{count:()=>t.addons_list.length}}),new Vue({el:"#addons-menu",data:{},methods:{set_category(e){this.main_app.category=e;const a=new URL(window.location.href);a.searchParams.set("tab",e),history.pushState({},null,a)}},computed:{main_app:()=>t,category:()=>t.category}})}(jQuery);
|
||||
@@ -0,0 +1,43 @@
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Prevent notices from jumping around.
|
||||
*/
|
||||
$('.notice.wu-hidden').removeClass('wu-hidden');
|
||||
|
||||
/**
|
||||
* Dismisses a WP Ultimo notice
|
||||
*
|
||||
* When a notice is dismissable, we save the key of that notice after the dismiss
|
||||
* button is clicked to avoid showing that notice again for that customer in the future.
|
||||
*/
|
||||
$('.notice.wu-admin-notice').on('click', '.notice-dismiss', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const $this = $(this);
|
||||
|
||||
const $notice = $this.parents('.notice');
|
||||
|
||||
if ($notice.find('[name="notice_id"]').val()) {
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
// eslint-disable-next-line no-undef
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'wu_dismiss_admin_notice',
|
||||
nonce: $notice.find('[name="nonce"]').val(),
|
||||
notice_id: $notice.find('[name="notice_id"]').val(),
|
||||
},
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(n){n(document).ready((function(){n(".notice.wu-hidden").removeClass("wu-hidden"),n(".notice.wu-admin-notice").on("click",".notice-dismiss",(function(i){i.preventDefault();const e=n(this).parents(".notice");e.find('[name="notice_id"]').val()&&n.ajax({method:"post",url:ajaxurl,data:{action:"wu_dismiss_admin_notice",nonce:e.find('[name="nonce"]').val(),notice_id:e.find('[name="notice_id"]').val()}})}))}))}(jQuery);
|
||||
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable max-len */
|
||||
/* global wu_admin_screen, wu_block_ui */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('body').on('click', '#wu-admin-screen-customize', function() {
|
||||
|
||||
wu_block_ui('#wpcontent');
|
||||
|
||||
});
|
||||
|
||||
const is_edit_mode = $('body').hasClass('wu-customize-admin-screen');
|
||||
|
||||
let $elem = `<a id="wu-admin-screen-customize" href="${ wu_admin_screen.customize_link }" class="button show-settings">${ wu_admin_screen.i18n.customize_label }</button>`;
|
||||
|
||||
const $page_elem = `<a title="${ wu_admin_screen.i18n.page_customize_label }" id="wu-admin-screen-page-customize" href="${ wu_admin_screen.page_customize_link }" class="wubox button show-settings">${ wu_admin_screen.i18n.page_customize_label }</button>`;
|
||||
|
||||
if (is_edit_mode) {
|
||||
|
||||
$elem = `<a id="wu-admin-screen-customize" href="${ wu_admin_screen.close_link }" class="button show-settings wu-font-medium"><span class="wu-text-sm wu-align-text-bottom wu-text-red-500 wu-mr-2 wu--ml-1 dashicons-wu-circle-with-cross"></span>${ wu_admin_screen.i18n.close_label }</button>`;
|
||||
|
||||
} else {
|
||||
|
||||
$($page_elem).prependTo('#screen-options-link-wrap');
|
||||
|
||||
} // end if;
|
||||
|
||||
$($elem).appendTo('#screen-options-link-wrap');
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){e("body").on("click","#wu-admin-screen-customize",(function(){wu_block_ui("#wpcontent")}));const n=e("body").hasClass("wu-customize-admin-screen");let s=`<a id="wu-admin-screen-customize" href="${wu_admin_screen.customize_link}" class="button show-settings">${wu_admin_screen.i18n.customize_label}</button>`;const t=`<a title="${wu_admin_screen.i18n.page_customize_label}" id="wu-admin-screen-page-customize" href="${wu_admin_screen.page_customize_link}" class="wubox button show-settings">${wu_admin_screen.i18n.page_customize_label}</button>`;n?s=`<a id="wu-admin-screen-customize" href="${wu_admin_screen.close_link}" class="button show-settings wu-font-medium"><span class="wu-text-sm wu-align-text-bottom wu-text-red-500 wu-mr-2 wu--ml-1 dashicons-wu-circle-with-cross"></span>${wu_admin_screen.i18n.close_label}</button>`:e(t).prependTo("#screen-options-link-wrap"),e(s).appendTo("#screen-options-link-wrap")}))}(jQuery);
|
||||
@@ -0,0 +1,16 @@
|
||||
/* global wu_on_load */
|
||||
(function($) {
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
wu = {
|
||||
tables: {},
|
||||
configs: {},
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
wu_on_load();
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(n){wu={tables:{},configs:{}},n(document).ready((function(){wu_on_load()}))}(jQuery);
|
||||
@@ -0,0 +1,3 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
})()
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
})()
|
||||
@@ -0,0 +1,24 @@
|
||||
/* global wubox */
|
||||
wp.hooks.addAction('wu_add_checkout_form_field_mounted', 'nextpress/wp-ultimo', function(data) {
|
||||
|
||||
if (data.type === '') {
|
||||
|
||||
wubox.width(600);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
wp.hooks.addAction('wu_add_checkout_form_field_changed', 'nextpress/wp-ultimo', function(val, data) {
|
||||
|
||||
if (data.type === '') {
|
||||
|
||||
wubox.width(600);
|
||||
|
||||
} else {
|
||||
|
||||
wubox.width(400);
|
||||
|
||||
}// end if;
|
||||
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
wp.hooks.addAction("wu_add_checkout_form_field_mounted","nextpress/wp-ultimo",(function(o){""===o.type&&wubox.width(600)})),wp.hooks.addAction("wu_add_checkout_form_field_changed","nextpress/wp-ultimo",(function(o,t){""===t.type?wubox.width(600):wubox.width(400)}));
|
||||
@@ -0,0 +1,281 @@
|
||||
/* global vuedraggable, Vue, wu_checkout_forms_editor_app, wu_checkout_form, _, ajaxurl, wu_initialize_tooltip */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
const draggable_table = {
|
||||
components: {
|
||||
vuedraggable,
|
||||
},
|
||||
template: '#wu-table',
|
||||
props: ['list', 'headers', 'step_name'],
|
||||
name: 'wu-draggable-table',
|
||||
data() {
|
||||
|
||||
return {
|
||||
delete_field_id: '',
|
||||
};
|
||||
|
||||
},
|
||||
methods: {
|
||||
remove_field(field) {
|
||||
|
||||
wu_checkout_forms_editor_app.remove_field(this.step_name, field);
|
||||
|
||||
this.delete_field_id = '';
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
wu_checkout_forms_editor_app = new Vue({
|
||||
el: '#wu-checkout-editor-app',
|
||||
name: 'CheckoutEditor',
|
||||
data() {
|
||||
|
||||
return Object.assign({}, {
|
||||
dragging: false,
|
||||
search: '',
|
||||
delete_step_id: '',
|
||||
preview_error: false,
|
||||
preview: false,
|
||||
loading_preview: false,
|
||||
preview_content: '',
|
||||
iframe_preview_url: '',
|
||||
}, wu_checkout_form);
|
||||
|
||||
},
|
||||
components: {
|
||||
vuedraggable,
|
||||
'wu-draggable-table': draggable_table,
|
||||
},
|
||||
computed: {
|
||||
field_count() {
|
||||
|
||||
return _.reduce(this.steps, function(memo, step) {
|
||||
|
||||
return memo + step.fields.length;
|
||||
|
||||
}, 0);
|
||||
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
steps: {
|
||||
|
||||
handler() {
|
||||
|
||||
this.update_session();
|
||||
|
||||
},
|
||||
|
||||
deep: true,
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.update_session();
|
||||
|
||||
},
|
||||
methods: {
|
||||
get_preview(type = null) {
|
||||
|
||||
if (type === null) {
|
||||
|
||||
this.preview = ! this.preview;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (this.preview) {
|
||||
|
||||
this.loading_preview = true;
|
||||
|
||||
const that = this;
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
that.iframe_preview_url = that.register_page + '?action=wu_generate_checkout_form_preview' + '&form_id=' + that.form_id + '&type=' + type + '&uniq=' + (Math.random() * 1000);
|
||||
|
||||
$('#wp-ultimo-checkout-preview').on('load', function() {
|
||||
|
||||
that.loading_preview = false;
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
const height = document.getElementById('wp-ultimo-checkout-preview').contentWindow.document.body.scrollHeight;
|
||||
|
||||
$('#wp-ultimo-checkout-preview').animate({
|
||||
height,
|
||||
});
|
||||
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('no preview');
|
||||
|
||||
// end if;
|
||||
|
||||
},
|
||||
add_step(data, cb = null) {
|
||||
|
||||
const existing_step = data.original_id ? this.find_step(data.original_id) : this.find_step(data.id) ;
|
||||
|
||||
delete data.original_id;
|
||||
|
||||
if (typeof existing_step !== 'undefined') {
|
||||
|
||||
const index = _.indexOf(this.steps, existing_step);
|
||||
|
||||
data = Object.assign({}, existing_step, data);
|
||||
|
||||
data.fields = existing_step.fields;
|
||||
|
||||
Vue.set(this.steps, index, data);
|
||||
|
||||
} else {
|
||||
|
||||
this.steps.push(data);
|
||||
|
||||
} // end if;
|
||||
|
||||
this.$nextTick(function() {
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
|
||||
cb();
|
||||
|
||||
this.scroll_to(`wp-ultimo-list-table-${ data.id }`);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
add_field(data, cb = null) {
|
||||
|
||||
const step = _.findWhere(this.steps, {
|
||||
id: data.step,
|
||||
});
|
||||
|
||||
let existing_field = this.find_field(data.step, data.id);
|
||||
|
||||
if (typeof existing_field === 'undefined') {
|
||||
|
||||
existing_field = this.find_field(data.step, data.original_id);
|
||||
|
||||
delete data.original_id;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (typeof existing_field !== 'undefined') {
|
||||
|
||||
const index = _.indexOf(step.fields, existing_field);
|
||||
|
||||
Vue.set(step.fields, index, data);
|
||||
|
||||
} else {
|
||||
|
||||
step.fields.push(data);
|
||||
|
||||
} // end if;
|
||||
|
||||
this.$nextTick(function() {
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
|
||||
cb();
|
||||
|
||||
this.scroll_to(`wp-ultimo-field-${ data.id }`);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
scroll_to(element_id) {
|
||||
|
||||
this.$nextTick(function() {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
const element = document.getElementById(element_id);
|
||||
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
|
||||
|
||||
}, 500);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
find_step(step_name) {
|
||||
|
||||
return _.findWhere(this.steps, {
|
||||
id: step_name,
|
||||
});
|
||||
|
||||
},
|
||||
find_field(step_name, field_name) {
|
||||
|
||||
const step = _.findWhere(this.steps, {
|
||||
id: step_name,
|
||||
});
|
||||
|
||||
const field = _.findWhere(step.fields, {
|
||||
id: field_name,
|
||||
});
|
||||
|
||||
return field;
|
||||
|
||||
},
|
||||
remove_step(step_name) {
|
||||
|
||||
this.steps = _.reject(this.steps, function(item) {
|
||||
|
||||
return item.id === step_name;
|
||||
|
||||
});
|
||||
|
||||
this.delete_step_id = '';
|
||||
|
||||
},
|
||||
remove_field(step_name, field_name) {
|
||||
|
||||
const step = _.findWhere(this.steps, {
|
||||
id: step_name,
|
||||
});
|
||||
|
||||
step.fields = _.reject(step.fields, function(item) {
|
||||
|
||||
return item.id === field_name;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
update_session() {
|
||||
|
||||
wu_initialize_tooltip();
|
||||
|
||||
const that = this;
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'wu_save_editor_session',
|
||||
settings: that.steps,
|
||||
form_id: that.form_id,
|
||||
},
|
||||
success() { },
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){const t={components:{vuedraggable:vuedraggable},template:"#wu-table",props:["list","headers","step_name"],name:"wu-draggable-table",data:()=>({delete_field_id:""}),methods:{remove_field(e){wu_checkout_forms_editor_app.remove_field(this.step_name,e),this.delete_field_id=""}}};wu_checkout_forms_editor_app=new Vue({el:"#wu-checkout-editor-app",name:"CheckoutEditor",data:()=>Object.assign({},{dragging:!1,search:"",delete_step_id:"",preview_error:!1,preview:!1,loading_preview:!1,preview_content:"",iframe_preview_url:""},wu_checkout_form),components:{vuedraggable:vuedraggable,"wu-draggable-table":t},computed:{field_count(){return _.reduce(this.steps,(function(e,t){return e+t.fields.length}),0)}},watch:{steps:{handler(){this.update_session()},deep:!0}},mounted(){this.update_session()},methods:{get_preview(t=null){if(null===t&&(this.preview=!this.preview),this.preview){this.loading_preview=!0;const i=this;i.iframe_preview_url=i.register_page+"?action=wu_generate_checkout_form_preview&form_id="+i.form_id+"&type="+t+"&uniq="+1e3*Math.random(),e("#wp-ultimo-checkout-preview").on("load",(function(){i.loading_preview=!1,setTimeout((()=>{const t=document.getElementById("wp-ultimo-checkout-preview").contentWindow.document.body.scrollHeight;e("#wp-ultimo-checkout-preview").animate({height:t})}),1e3)}))}console.log("no preview")},add_step(e,t=null){const i=e.original_id?this.find_step(e.original_id):this.find_step(e.id);if(delete e.original_id,void 0!==i){const t=_.indexOf(this.steps,i);(e=Object.assign({},i,e)).fields=i.fields,Vue.set(this.steps,t,e)}else this.steps.push(e);this.$nextTick((function(){"function"==typeof t&&(t(),this.scroll_to(`wp-ultimo-list-table-${e.id}`))}))},add_field(e,t=null){const i=_.findWhere(this.steps,{id:e.step});let s=this.find_field(e.step,e.id);if(void 0===s&&(s=this.find_field(e.step,e.original_id),delete e.original_id),void 0!==s){const t=_.indexOf(i.fields,s);Vue.set(i.fields,t,e)}else i.fields.push(e);this.$nextTick((function(){"function"==typeof t&&(t(),this.scroll_to(`wp-ultimo-field-${e.id}`))}))},scroll_to(e){this.$nextTick((function(){setTimeout((()=>{document.getElementById(e).scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),500)}))},find_step(e){return _.findWhere(this.steps,{id:e})},find_field(e,t){const i=_.findWhere(this.steps,{id:e});return _.findWhere(i.fields,{id:t})},remove_step(e){this.steps=_.reject(this.steps,(function(t){return t.id===e})),this.delete_step_id=""},remove_field(e,t){const i=_.findWhere(this.steps,{id:e});i.fields=_.reject(i.fields,(function(e){return e.id===t}))},update_session(){wu_initialize_tooltip();e.ajax({method:"post",url:ajaxurl,data:{action:"wu_save_editor_session",settings:this.steps,form_id:this.form_id},success(){}})}}})}))}(jQuery);
|
||||
@@ -0,0 +1,966 @@
|
||||
/* global Vue, moment, _, wu_checkout, pwsL10n, wu_checkout_form, wu_create_cookie, wu_listen_to_cookie_change */
|
||||
(function ($, hooks, _) {
|
||||
|
||||
/*
|
||||
* Remove the pre-flight parameter.
|
||||
*/
|
||||
if (window.history.replaceState) {
|
||||
|
||||
window.history.replaceState(null, null, wu_checkout.baseurl);
|
||||
|
||||
} // end if;
|
||||
|
||||
/*
|
||||
* Sets default template.
|
||||
*/
|
||||
hooks.addAction('wu_on_create_order', 'nextpress/wp-ultimo', function (checkout, data) {
|
||||
|
||||
if (typeof data.order.extra.template_id !== 'undefined') {
|
||||
|
||||
checkout.template_id = data.order.extra.template_id;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
* Handle auto-submittable fields.
|
||||
*
|
||||
* Some fields are auto-submittable if they are the one relevant
|
||||
* field on a checkout step.
|
||||
*/
|
||||
hooks.addAction('wu_checkout_loaded', 'nextpress/wp-ultimo', function (checkout) {
|
||||
|
||||
/*
|
||||
* The checkout sets the auto submittable field as a global variable
|
||||
*/
|
||||
if (typeof window.wu_auto_submittable_field !== 'undefined' && window.wu_auto_submittable_field) {
|
||||
|
||||
const options = {
|
||||
deep: true,
|
||||
};
|
||||
|
||||
checkout.$watch(window.wu_auto_submittable_field, function () {
|
||||
|
||||
jQuery(this.$el).submit();
|
||||
|
||||
}, options);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
* Sets up the cookie listener for template selection.
|
||||
*/
|
||||
hooks.addAction('wu_checkout_loaded', 'nextpress/wp-ultimo', function (checkout) {
|
||||
|
||||
/*
|
||||
* Resets the template selection cookie.
|
||||
*/
|
||||
wu_create_cookie('wu_template', '');
|
||||
|
||||
/*
|
||||
* Resets the selected products cookie.
|
||||
*/
|
||||
wu_create_cookie('wu_selected_products', '');
|
||||
/*
|
||||
* Listens for changes and set the template if one is detected.
|
||||
*/
|
||||
wu_listen_to_cookie_change('wu_template', function (value) {
|
||||
|
||||
checkout.template_id = value;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Allows for cross-sells
|
||||
*/
|
||||
$(document).on('click', '[href|="#wu-checkout-add"]', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const el = $(this);
|
||||
|
||||
const product_slug = el.attr('href').split('#').pop().replace('wu-checkout-add-', '');
|
||||
|
||||
if (typeof wu_checkout_form !== 'undefined') {
|
||||
|
||||
if (wu_checkout_form.products.indexOf(product_slug) === -1) {
|
||||
|
||||
wu_checkout_form.add_product(product_slug);
|
||||
|
||||
el.html(wu_checkout.i18n.added_to_order);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Reload page when history back button was pressed
|
||||
*/
|
||||
window.addEventListener('pageshow', function (event) {
|
||||
|
||||
if (event.persisted && this.window.wu_checkout_form) {
|
||||
|
||||
this.window.wu_checkout_form.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Setup
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
|
||||
/*
|
||||
* Prevent app creation when vue is not available.
|
||||
*/
|
||||
if (typeof window.Vue === 'undefined') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
Object.defineProperty(Vue.prototype, '$moment', { value: moment });
|
||||
|
||||
const maybe_cast_to_int = function (value) {
|
||||
|
||||
return isNaN(value) ? value : parseInt(value, 10);
|
||||
|
||||
};
|
||||
|
||||
const initial_data = {
|
||||
plan: maybe_cast_to_int(wu_checkout.plan),
|
||||
errors: [],
|
||||
order: wu_checkout.order,
|
||||
products: _.map(wu_checkout.products, maybe_cast_to_int),
|
||||
template_id: wu_checkout.template_id,
|
||||
template_category: '',
|
||||
gateway: wu_checkout.gateway,
|
||||
request_billing_address: wu_checkout.request_billing_address,
|
||||
country: wu_checkout.country,
|
||||
state: '',
|
||||
city: '',
|
||||
site_url: wu_checkout.site_url,
|
||||
site_domain: wu_checkout.site_domain,
|
||||
is_subdomain: wu_checkout.is_subdomain,
|
||||
discount_code: '',
|
||||
toggle_discount_code: 0,
|
||||
payment_method: '',
|
||||
username: '',
|
||||
payment_id: wu_checkout.payment_id,
|
||||
membership_id: wu_checkout.membership_id,
|
||||
cart_type: 'new',
|
||||
auto_renew: 1,
|
||||
duration: wu_checkout.duration,
|
||||
duration_unit: wu_checkout.duration_unit,
|
||||
prevent_submission: false,
|
||||
valid_password: true,
|
||||
stored_templates: {},
|
||||
state_list: [],
|
||||
city_list: [],
|
||||
labels: {},
|
||||
};
|
||||
|
||||
hooks.applyFilters('wu_before_form_init', initial_data);
|
||||
|
||||
if (!jQuery('#wu_form').length) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
/**
|
||||
* ColorPicker Component
|
||||
*/
|
||||
Vue.component('colorPicker', {
|
||||
props: ['value'],
|
||||
template: '<input type="text">',
|
||||
mounted() {
|
||||
|
||||
const vm = this;
|
||||
|
||||
$(this.$el)
|
||||
.val(this.value)
|
||||
// WordPress color picker
|
||||
.wpColorPicker({
|
||||
width: 200,
|
||||
defaultColor: this.value,
|
||||
change(event, ui) {
|
||||
|
||||
// emit change event on color change using mouse
|
||||
vm.$emit('input', ui.color.toString());
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
|
||||
// update value
|
||||
$(this.$el).wpColorPicker('color', value);
|
||||
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
|
||||
$(this.$el).off().wpColorPicker('destroy'); // (!) Not tested
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Declare the dynamic content for Vue.
|
||||
*/
|
||||
const dynamic = {
|
||||
functional: true,
|
||||
template: '#dynamic',
|
||||
props: ['template'],
|
||||
render(h, context) {
|
||||
|
||||
const template = context.props.template;
|
||||
|
||||
const component = template ? { template } : '<div>nbsp;</div>';
|
||||
|
||||
return h(component);
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
window.wu_checkout_form = new Vue({
|
||||
el: '#wu_form',
|
||||
data: initial_data,
|
||||
directives: {
|
||||
init: {
|
||||
bind(el, binding, vnode) {
|
||||
|
||||
vnode.context[binding.arg] = binding.value;
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
dynamic,
|
||||
},
|
||||
computed: {
|
||||
hooks() {
|
||||
|
||||
return wp.hooks;
|
||||
|
||||
},
|
||||
unique_products() {
|
||||
|
||||
return _.uniq(this.products, false, (item) => parseInt(item, 10));
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
debounce(fn) {
|
||||
|
||||
return _.debounce(fn, 200, true);
|
||||
|
||||
},
|
||||
open_url(url, target = '_blank') {
|
||||
|
||||
window.open(url, target);
|
||||
|
||||
},
|
||||
get_template(template, data) {
|
||||
|
||||
if (typeof data.id === 'undefined') {
|
||||
|
||||
data.id = 'default';
|
||||
|
||||
} // end if;
|
||||
|
||||
const template_name = template + '/' + data.id;
|
||||
|
||||
if (typeof this.stored_templates[template_name] !== 'undefined') {
|
||||
|
||||
return this.stored_templates[template_name];
|
||||
|
||||
} // end if;
|
||||
|
||||
const template_data = this.hooks.applyFilters('wu_before_template_fetch', {
|
||||
duration: this.duration,
|
||||
duration_unit: this.duration_unit,
|
||||
products: this.products,
|
||||
...data,
|
||||
}, this);
|
||||
|
||||
this.fetch_template(template, template_data);
|
||||
|
||||
return '<div class="wu-p-4 wu-bg-gray-100 wu-text-center wu-my-2 wu-rounded">' + wu_checkout.i18n.loading + '</div>';
|
||||
|
||||
},
|
||||
reset_templates(to_clear) {
|
||||
|
||||
if (typeof to_clear === 'undefined') {
|
||||
|
||||
this.stored_templates = {};
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
const new_list = {};
|
||||
|
||||
_.forEach(this.stored_templates, function (item, key) {
|
||||
|
||||
const type = key.toString().substr(0, key.toString().indexOf('/'));
|
||||
|
||||
if (_.contains(to_clear, type) === false) {
|
||||
|
||||
new_list[key] = item;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
this.stored_templates = new_list;
|
||||
|
||||
},
|
||||
fetch_template(template, data) {
|
||||
|
||||
const that = this;
|
||||
|
||||
if (typeof data.id === 'undefined') {
|
||||
|
||||
data.id = 'default';
|
||||
|
||||
} // end if;
|
||||
|
||||
this.request('wu_render_field_template', {
|
||||
template,
|
||||
attributes: data,
|
||||
}, function (results) {
|
||||
|
||||
const template_name = template + '/' + data.id;
|
||||
|
||||
if (results.success) {
|
||||
|
||||
Vue.set(that.stored_templates, template_name, results.data.html);
|
||||
|
||||
} else {
|
||||
|
||||
Vue.set(that.stored_templates, template_name, '<div>' + results.data[0].message + '</div>');
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
go_back() {
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Going back...');
|
||||
|
||||
this.block();
|
||||
|
||||
window.history.back();
|
||||
|
||||
},
|
||||
set_prevent_submission(value) {
|
||||
|
||||
this.$nextTick(function () {
|
||||
|
||||
this.prevent_submission = value;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
remove_product(product_id, product_slug) {
|
||||
|
||||
this.products = _.filter(this.products, function (item) {
|
||||
|
||||
// eslint-disable-next-line eqeqeq
|
||||
return item != product_id && item != product_slug;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
add_plan(product_id) {
|
||||
|
||||
if (this.plan) {
|
||||
|
||||
this.remove_product(this.plan);
|
||||
|
||||
} // end if;
|
||||
|
||||
this.plan = product_id;
|
||||
|
||||
this.add_product(product_id);
|
||||
|
||||
},
|
||||
add_product(product_id) {
|
||||
|
||||
this.products.push(product_id);
|
||||
|
||||
},
|
||||
has_product(product_id) {
|
||||
|
||||
return this.products.indexOf(product_id) > -1 || this.products.indexOf(parseInt(product_id, 10)) > -1;
|
||||
|
||||
},
|
||||
wu_format_money(value) {
|
||||
|
||||
return window.wu_format_money(value);
|
||||
|
||||
},
|
||||
filter_for_request(data, request_type = '') {
|
||||
|
||||
const filter_list = this.hooks.doAction('wu_filter_for_request', [
|
||||
'stored_templates',
|
||||
], data, request_type);
|
||||
|
||||
const filtered_list = _.omit(data, filter_list);
|
||||
|
||||
return filtered_list;
|
||||
|
||||
},
|
||||
create_order() {
|
||||
|
||||
/*
|
||||
* Bail if there is no order summary to update.
|
||||
*/
|
||||
if (!jQuery('#wu-order-summary-content').length) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
this.block();
|
||||
|
||||
this.order = false;
|
||||
|
||||
const that = this;
|
||||
|
||||
const _request = this.debounce(this.request);
|
||||
|
||||
const data = { ...this.$data };
|
||||
|
||||
delete data.stored_templates;
|
||||
delete data.state_list;
|
||||
delete data.city_list;
|
||||
delete data.labels;
|
||||
|
||||
_request('wu_create_order', this.filter_for_request(data, 'wu_create_order'), function (results) {
|
||||
|
||||
that.order = results.data.order;
|
||||
|
||||
that.state_list = results.data.states;
|
||||
|
||||
that.city_list = results.data.cities;
|
||||
|
||||
that.labels = results.data.labels;
|
||||
|
||||
that.cart_type = results.data.order.type;
|
||||
|
||||
that.errors = results.data.order.errors;
|
||||
|
||||
that.hooks.doAction('wu_on_create_order', that, results.data);
|
||||
|
||||
if (results.data.order.url) {
|
||||
|
||||
try {
|
||||
|
||||
// history.pushState({}, null, wu_checkout.baseurl + results.data.order.url);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Browser does not support pushState.', err);
|
||||
|
||||
} // end try;
|
||||
|
||||
} // ed if;
|
||||
|
||||
that.unblock();
|
||||
|
||||
}, this.handle_errors);
|
||||
|
||||
},
|
||||
get_errors() {
|
||||
|
||||
const result = this.errors.map(function (e) {
|
||||
|
||||
return e.message;
|
||||
|
||||
});
|
||||
|
||||
return result.length > 0 ? result : false;
|
||||
|
||||
},
|
||||
get_error(field) {
|
||||
|
||||
const result = this.errors.filter(function (e) {
|
||||
|
||||
return e.code === field;
|
||||
|
||||
});
|
||||
|
||||
return result.length > 0 ? result[0] : false;
|
||||
|
||||
},
|
||||
form_success(results) {
|
||||
|
||||
if (!_.isEmpty(results.data)) {
|
||||
|
||||
this.hooks.doAction('wu_on_form_success', this, results.data);
|
||||
|
||||
const fields = results.data.gateway.data;
|
||||
|
||||
fields.payment_id = results.data.payment_id;
|
||||
|
||||
fields.membership_id = results.data.membership_id;
|
||||
|
||||
fields.cart_type = results.data.cart_type;
|
||||
|
||||
// Append the hidden fields
|
||||
jQuery.each(Object.assign({}, fields), function (index, value) {
|
||||
|
||||
const hidden = document.createElement('input');
|
||||
|
||||
hidden.type = 'hidden';
|
||||
|
||||
hidden.name = index;
|
||||
|
||||
hidden.value = value;
|
||||
|
||||
jQuery('#wu_form').append(hidden);
|
||||
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
validate_form() {
|
||||
|
||||
this.errors = [];
|
||||
|
||||
const form_data_obj = jQuery('#wu_form').serializeArray().reduce(function (json, { name, value }) {
|
||||
|
||||
// Get products from this
|
||||
if (name !== 'products[]') {
|
||||
|
||||
json[name] = value;
|
||||
|
||||
}
|
||||
|
||||
return json;
|
||||
|
||||
}, {});
|
||||
|
||||
const form_data = jQuery.param({
|
||||
...form_data_obj,
|
||||
products: this.products,
|
||||
membership_id: this.membership_id,
|
||||
payment_id: this.payment_id,
|
||||
auto_renew: this.auto_renew,
|
||||
cart_type: this.type,
|
||||
valid_password: this.valid_password,
|
||||
duration: this.duration,
|
||||
duration_unit: this.duration_unit,
|
||||
});
|
||||
|
||||
const that = this;
|
||||
|
||||
this.request('wu_validate_form', form_data, function (results) {
|
||||
|
||||
if (!that.valid_password) {
|
||||
|
||||
that.errors.push({
|
||||
code: 'password',
|
||||
message: wu_checkout.i18n.weak_password,
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
if (results.success === false) {
|
||||
|
||||
that.errors = [].concat(that.errors, results.data);
|
||||
|
||||
that.unblock();
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!that.errors.length) {
|
||||
|
||||
that.form_success(results);
|
||||
|
||||
if (that.prevent_submission === false) {
|
||||
|
||||
that.resubmit();
|
||||
|
||||
} // end if;
|
||||
|
||||
} else {
|
||||
|
||||
that.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
}, this.handle_errors);
|
||||
|
||||
},
|
||||
resubmit() {
|
||||
|
||||
jQuery('#wu_form').get(0).submit();
|
||||
|
||||
},
|
||||
handle_errors(errors) {
|
||||
|
||||
this.unblock();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(errors);
|
||||
|
||||
},
|
||||
on_submit(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
},
|
||||
on_change_product(new_value, old_value) {
|
||||
|
||||
window.wu_create_cookie('wu_selected_products', new_value.join(','), 0.5) // Save it for 12 hours max.
|
||||
|
||||
this.reset_templates(['template-selection']);
|
||||
|
||||
hooks.doAction('wu_on_change_product', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_gateway(new_value, old_value) {
|
||||
|
||||
hooks.doAction('wu_on_change_gateway', new_value, old_value, this);
|
||||
|
||||
},
|
||||
on_change_country(new_value, old_value) {
|
||||
|
||||
hooks.doAction('wu_on_change_country', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_state(new_value, old_value) {
|
||||
|
||||
hooks.doAction('wu_on_change_state', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_city(new_value, old_value) {
|
||||
|
||||
hooks.doAction('wu_on_change_city', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_duration(new_value, old_value) {
|
||||
|
||||
this.reset_templates();
|
||||
|
||||
hooks.doAction('wu_on_change_duration', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_duration_unit(new_value, old_value) {
|
||||
|
||||
this.reset_templates();
|
||||
|
||||
hooks.doAction('wu_on_change_duration_unit', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
on_change_discount_code(new_value, old_value) {
|
||||
|
||||
hooks.doAction('wu_on_change_discount_code', new_value, old_value, this);
|
||||
|
||||
this.create_order();
|
||||
|
||||
},
|
||||
block() {
|
||||
|
||||
/*
|
||||
* Get the first bg color from a parent.
|
||||
*/
|
||||
const bg_color = jQuery(this.$el).parents().filter(function () {
|
||||
|
||||
return $(this).css('backgroundColor') !== 'rgba(0, 0, 0, 0)';
|
||||
|
||||
}).first().css('backgroundColor');
|
||||
|
||||
jQuery(this.$el).wu_block({
|
||||
message: '<div class="spinner is-active wu-float-none" style="float: none !important;"></div>',
|
||||
overlayCSS: {
|
||||
backgroundColor: bg_color ? bg_color : '#ffffff',
|
||||
opacity: 0.6,
|
||||
},
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '50%',
|
||||
fontSize: '14px !important',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: 'none',
|
||||
backgroundColor: 'none',
|
||||
cursor: 'wait',
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
unblock() {
|
||||
|
||||
jQuery(this.$el).wu_unblock();
|
||||
|
||||
},
|
||||
request(action, data, success_handler, error_handler) {
|
||||
|
||||
const actual_ajax_url = action === 'wu_validate_form' ? wu_checkout.late_ajaxurl : wu_checkout.ajaxurl;
|
||||
|
||||
jQuery.ajax({
|
||||
method: 'POST',
|
||||
url: actual_ajax_url + '&action=' + action,
|
||||
data,
|
||||
success: success_handler,
|
||||
error: error_handler,
|
||||
});
|
||||
|
||||
},
|
||||
check_pass_strength() {
|
||||
|
||||
const pass1_el = '#field-password';
|
||||
|
||||
if (!jQuery('#pass-strength-result').length) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
jQuery('#pass-strength-result')
|
||||
.attr('class', 'wu-py-2 wu-px-4 wu-bg-gray-100 wu-block wu-text-sm wu-border-solid wu-border wu-border-gray-200');
|
||||
|
||||
const pass1 = jQuery(pass1_el).val();
|
||||
|
||||
if (!pass1) {
|
||||
|
||||
jQuery('#pass-strength-result').addClass('empty').html('Enter Password');
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
this.valid_password = false;
|
||||
|
||||
const disallowed_list = typeof wp.passwordStrength.userInputDisallowedList === 'undefined'
|
||||
? wp.passwordStrength.userInputBlacklist()
|
||||
: wp.passwordStrength.userInputDisallowedList();
|
||||
|
||||
const strength = wp.passwordStrength.meter(pass1, disallowed_list, pass1);
|
||||
|
||||
switch (strength) {
|
||||
|
||||
case -1:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-red-200 wu-border-red-300').html(pwsL10n.unknown);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-red-200 wu-border-red-300').html(pwsL10n.bad);
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-green-200 wu-border-green-300').html(pwsL10n.good);
|
||||
|
||||
this.valid_password = true;
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-green-200 wu-border-green-300').html(pwsL10n.strong);
|
||||
|
||||
this.valid_password = true;
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-yellow-200 wu-border-yellow-300').html(pwsL10n.mismatch);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
jQuery('#pass-strength-result').addClass('wu-bg-yellow-200 wu-border-yellow-300').html(pwsL10n.short);
|
||||
|
||||
} // end switch;
|
||||
|
||||
},
|
||||
},
|
||||
updated() {
|
||||
|
||||
this.$nextTick(function () {
|
||||
|
||||
hooks.doAction('wu_on_form_updated', this);
|
||||
|
||||
wu_initialize_tooltip();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
const that = this;
|
||||
|
||||
jQuery(this.$el).on('click', function (e) {
|
||||
|
||||
$(this).data('submited_via', $(e.target));
|
||||
|
||||
});
|
||||
|
||||
jQuery(this.$el).on('submit', async function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
/**
|
||||
* Handle button submission.
|
||||
*/
|
||||
const submit_el = jQuery(this).data('submited_via');
|
||||
|
||||
if (submit_el) {
|
||||
|
||||
const new_input = jQuery('<input>');
|
||||
|
||||
new_input.attr('type', 'hidden');
|
||||
|
||||
new_input.attr('name', submit_el.attr('name'));
|
||||
|
||||
new_input.attr('value', submit_el.val());
|
||||
|
||||
jQuery(this).append(new_input);
|
||||
|
||||
} // end if;
|
||||
|
||||
that.block();
|
||||
|
||||
try {
|
||||
|
||||
const promises = [];
|
||||
|
||||
// Here we use filter to return possible promises to await
|
||||
await Promise.all(hooks.applyFilters("wu_before_form_submitted", promises, that, that.gateway));
|
||||
|
||||
} catch (error) {
|
||||
|
||||
that.errors = [];
|
||||
|
||||
that.errors.push({
|
||||
code: 'before-submit-error',
|
||||
message: error.message,
|
||||
});
|
||||
|
||||
that.unblock();
|
||||
|
||||
that.handle_errors(error);
|
||||
|
||||
return;
|
||||
|
||||
} // end try;
|
||||
|
||||
that.validate_form();
|
||||
|
||||
hooks.doAction('wu_on_form_submitted', that, that.gateway);
|
||||
|
||||
});
|
||||
|
||||
this.create_order();
|
||||
|
||||
hooks.doAction('wu_checkout_loaded', this);
|
||||
|
||||
hooks.doAction('wu_on_change_gateway', this.gateway, this.gateway);
|
||||
|
||||
jQuery('#field-password').on('input pwupdate', function () {
|
||||
|
||||
that.check_pass_strength();
|
||||
|
||||
});
|
||||
|
||||
wu_initialize_tooltip();
|
||||
|
||||
},
|
||||
watch: {
|
||||
products(new_value, old_value) {
|
||||
|
||||
this.on_change_product(new_value, old_value);
|
||||
|
||||
},
|
||||
toggle_discount_code(new_value) {
|
||||
|
||||
if (!new_value) {
|
||||
|
||||
this.discount_code = '';
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
discount_code(new_value, old_value) {
|
||||
|
||||
this.on_change_discount_code(new_value, old_value);
|
||||
|
||||
},
|
||||
gateway(new_value, old_value) {
|
||||
|
||||
this.on_change_gateway(new_value, old_value);
|
||||
|
||||
},
|
||||
country(new_value, old_value) {
|
||||
|
||||
this.state = '';
|
||||
|
||||
this.on_change_country(new_value, old_value);
|
||||
|
||||
},
|
||||
state(new_value, old_value) {
|
||||
|
||||
this.city = '';
|
||||
|
||||
this.on_change_state(new_value, old_value);
|
||||
|
||||
},
|
||||
city(new_value, old_value) {
|
||||
|
||||
this.on_change_city(new_value, old_value);
|
||||
|
||||
},
|
||||
duration(new_value, old_value) {
|
||||
|
||||
this.on_change_duration(new_value, old_value);
|
||||
|
||||
},
|
||||
duration_unit(new_value, old_value) {
|
||||
|
||||
this.on_change_duration_unit(new_value, old_value);
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery, wp.hooks, _));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t,e,o){window.history.replaceState&&window.history.replaceState(null,null,wu_checkout.baseurl),e.addAction("wu_on_create_order","nextpress/wp-ultimo",(function(t,e){void 0!==e.order.extra.template_id&&(t.template_id=e.order.extra.template_id)})),e.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(t){if(void 0!==window.wu_auto_submittable_field&&window.wu_auto_submittable_field){const e={deep:!0};t.$watch(window.wu_auto_submittable_field,(function(){jQuery(this.$el).submit()}),e)}})),e.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(t){wu_create_cookie("wu_template",""),wu_create_cookie("wu_selected_products",""),wu_listen_to_cookie_change("wu_template",(function(e){t.template_id=e}))})),t(document).on("click",'[href|="#wu-checkout-add"]',(function(e){e.preventDefault();const o=t(this),r=o.attr("href").split("#").pop().replace("wu-checkout-add-","");"undefined"!=typeof wu_checkout_form&&-1===wu_checkout_form.products.indexOf(r)&&(wu_checkout_form.add_product(r),o.html(wu_checkout.i18n.added_to_order))})),window.addEventListener("pageshow",(function(t){t.persisted&&this.window.wu_checkout_form&&this.window.wu_checkout_form.unblock()})),t(document).ready((function(){if(void 0===window.Vue)return;Object.defineProperty(Vue.prototype,"$moment",{value:moment});const r=function(t){return isNaN(t)?t:parseInt(t,10)},s={plan:r(wu_checkout.plan),errors:[],order:wu_checkout.order,products:o.map(wu_checkout.products,r),template_id:wu_checkout.template_id,template_category:"",gateway:wu_checkout.gateway,request_billing_address:wu_checkout.request_billing_address,country:wu_checkout.country,state:"",city:"",site_url:wu_checkout.site_url,site_domain:wu_checkout.site_domain,is_subdomain:wu_checkout.is_subdomain,discount_code:"",toggle_discount_code:0,payment_method:"",username:"",payment_id:wu_checkout.payment_id,membership_id:wu_checkout.membership_id,cart_type:"new",auto_renew:1,duration:wu_checkout.duration,duration_unit:wu_checkout.duration_unit,prevent_submission:!1,valid_password:!0,stored_templates:{},state_list:[],city_list:[],labels:{}};if(e.applyFilters("wu_before_form_init",s),!jQuery("#wu_form").length)return;Vue.component("colorPicker",{props:["value"],template:'<input type="text">',mounted(){const e=this;t(this.$el).val(this.value).wpColorPicker({width:200,defaultColor:this.value,change(t,o){e.$emit("input",o.color.toString())}})},watch:{value(e){t(this.$el).wpColorPicker("color",e)}},destroyed(){t(this.$el).off().wpColorPicker("destroy")}});const i={functional:!0,template:"#dynamic",props:["template"],render(t,e){const o=e.props.template;return t(o?{template:o}:"<div>nbsp;</div>")}};window.wu_checkout_form=new Vue({el:"#wu_form",data:s,directives:{init:{bind(t,e,o){o.context[e.arg]=e.value}}},components:{dynamic:i},computed:{hooks:()=>wp.hooks,unique_products(){return o.uniq(this.products,!1,(t=>parseInt(t,10)))}},methods:{debounce:t=>o.debounce(t,200,!0),open_url(t,e="_blank"){window.open(t,e)},get_template(t,e){void 0===e.id&&(e.id="default");const o=t+"/"+e.id;if(void 0!==this.stored_templates[o])return this.stored_templates[o];const r=this.hooks.applyFilters("wu_before_template_fetch",{duration:this.duration,duration_unit:this.duration_unit,products:this.products,...e},this);return this.fetch_template(t,r),'<div class="wu-p-4 wu-bg-gray-100 wu-text-center wu-my-2 wu-rounded">'+wu_checkout.i18n.loading+"</div>"},reset_templates(t){if(void 0===t)return void(this.stored_templates={});const e={};o.forEach(this.stored_templates,(function(r,s){const i=s.toString().substr(0,s.toString().indexOf("/"));!1===o.contains(t,i)&&(e[s]=r)})),this.stored_templates=e},fetch_template(t,e){const o=this;void 0===e.id&&(e.id="default"),this.request("wu_render_field_template",{template:t,attributes:e},(function(r){const s=t+"/"+e.id;r.success?Vue.set(o.stored_templates,s,r.data.html):Vue.set(o.stored_templates,s,"<div>"+r.data[0].message+"</div>")}))},go_back(){console.log("Going back..."),this.block(),window.history.back()},set_prevent_submission(t){this.$nextTick((function(){this.prevent_submission=t}))},remove_product(t,e){this.products=o.filter(this.products,(function(o){return o!=t&&o!=e}))},add_plan(t){this.plan&&this.remove_product(this.plan),this.plan=t,this.add_product(t)},add_product(t){this.products.push(t)},has_product(t){return this.products.indexOf(t)>-1||this.products.indexOf(parseInt(t,10))>-1},wu_format_money:t=>window.wu_format_money(t),filter_for_request(t,e=""){const r=this.hooks.doAction("wu_filter_for_request",["stored_templates"],t,e);return o.omit(t,r)},create_order(){if(!jQuery("#wu-order-summary-content").length)return;this.block(),this.order=!1;const t=this,e=this.debounce(this.request),o={...this.$data};delete o.stored_templates,delete o.state_list,delete o.city_list,delete o.labels,e("wu_create_order",this.filter_for_request(o,"wu_create_order"),(function(e){t.order=e.data.order,t.state_list=e.data.states,t.city_list=e.data.cities,t.labels=e.data.labels,t.cart_Line truncated
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Create a new cookie.
|
||||
*
|
||||
* @param {string} name The cookie name.
|
||||
* @param {*} value The cookie value.
|
||||
* @param {number} days The expiration, in days.
|
||||
* @return {void}
|
||||
*/
|
||||
window.wu_create_cookie = function(name, value, days) {
|
||||
|
||||
let expires;
|
||||
|
||||
if (days) {
|
||||
|
||||
const date = new Date();
|
||||
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
|
||||
expires = '; expires=' + date.toGMTString();
|
||||
|
||||
} else {
|
||||
|
||||
expires = '';
|
||||
|
||||
} // end if;
|
||||
|
||||
document.cookie = name + '=' + value + expires + '; path=/';
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Reads from a cookie.
|
||||
*
|
||||
* @param {string} name The cookie name
|
||||
* @return {*} The cookie value
|
||||
*/
|
||||
window.wu_read_cookie = function(name) {
|
||||
|
||||
const nameEQ = name + '=';
|
||||
|
||||
const ca = document.cookie.split(';');
|
||||
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
|
||||
let c = ca[i];
|
||||
|
||||
while (c.charAt(0) === ' ') {
|
||||
|
||||
c = c.substring(1, c.length);
|
||||
|
||||
} // end while;
|
||||
|
||||
if (c.indexOf(nameEQ) === 0) {
|
||||
|
||||
return c.substring(nameEQ.length, c.length);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end for;
|
||||
|
||||
return null;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Erase a cookie.
|
||||
*
|
||||
* @param {string} name The cookie name.
|
||||
*/
|
||||
window.wu_erase_cookie = function(name) {
|
||||
|
||||
window.wu_create_cookie(name, '', -1);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Listens to a particular cookie to catch a change in value.
|
||||
*
|
||||
* @param {string} name The cookie name.
|
||||
* @param {Function} callback The callback to call when a change is detected.
|
||||
*/
|
||||
window.wu_listen_to_cookie_change = function(name, callback) {
|
||||
|
||||
let cookie_value = window.wu_read_cookie(name);
|
||||
|
||||
setInterval(function() {
|
||||
|
||||
const new_cookie_value = window.wu_read_cookie(name);
|
||||
|
||||
if (new_cookie_value !== cookie_value) {
|
||||
|
||||
// update registry so we dont get triggered again
|
||||
cookie_value = new_cookie_value;
|
||||
|
||||
callback(cookie_value);
|
||||
|
||||
} // end if;
|
||||
|
||||
}, 100);
|
||||
|
||||
};
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
window.wu_create_cookie=function(e,o,n){let t;if(n){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),t="; expires="+e.toGMTString()}else t="";document.cookie=e+"="+o+t+"; path=/"},window.wu_read_cookie=function(e){const o=e+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let t=n[e];for(;" "===t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(o))return t.substring(o.length,t.length)}return null},window.wu_erase_cookie=function(e){window.wu_create_cookie(e,"",-1)},window.wu_listen_to_cookie_change=function(e,o){let n=window.wu_read_cookie(e);setInterval((function(){const t=window.wu_read_cookie(e);t!==n&&(n=t,o(n))}),100)};
|
||||
@@ -0,0 +1,74 @@
|
||||
/* global Vue, wu_block_ui */
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* If we detect the preview changed, we add a loader.
|
||||
*/
|
||||
window.addEventListener('message', function(message) {
|
||||
|
||||
let block;
|
||||
|
||||
if (message.data === 'wu_preview_changed') {
|
||||
|
||||
block = wu_block_ui('#preview_content');
|
||||
|
||||
} // end if;
|
||||
|
||||
/**
|
||||
* Unblocks when the loading is finished.
|
||||
*/
|
||||
$('#preview-stage-iframe').on('load', function() {
|
||||
|
||||
if (block) {
|
||||
|
||||
block.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
}, false);
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const wu_preview_stage = new Vue({
|
||||
el: '#preview-stage',
|
||||
data() {
|
||||
|
||||
return {
|
||||
preview: false,
|
||||
};
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
$('[data-wu-customizer-panel]').each(function() {
|
||||
|
||||
const app = $(this);
|
||||
|
||||
const app_name = 'wu_' + app.data('wu-app');
|
||||
|
||||
wp.hooks.addAction(app_name + '_changed', 'nextpress/wp-ultimo', function(prop) {
|
||||
|
||||
if (prop === 'tab') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
const param = jQuery.param(window[app_name].$data);
|
||||
|
||||
const param2 = app.find('input').serialize();
|
||||
|
||||
const url = $('#preview-stage-iframe').attr('data-src');
|
||||
|
||||
$('#preview-stage-iframe').attr('src', url + '&' + param + '&' + param2);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){window.addEventListener("message",(function(t){let a;"wu_preview_changed"===t.data&&(a=wu_block_ui("#preview_content")),e("#preview-stage-iframe").on("load",(function(){a&&a.unblock()}))}),!1),e(document).ready((function(){new Vue({el:"#preview-stage",data:()=>({preview:!1})});e("[data-wu-customizer-panel]").each((function(){const t=e(this),a="wu_"+t.data("wu-app");wp.hooks.addAction(a+"_changed","nextpress/wp-ultimo",(function(n){if("tab"===n)return;const i=jQuery.param(window[a].$data),r=t.find("input").serialize(),o=e("#preview-stage-iframe").attr("data-src");e("#preview-stage-iframe").attr("src",o+"&"+i+"&"+r)}))}))}))}(jQuery);
|
||||
@@ -0,0 +1,232 @@
|
||||
/* global wu_dashboard_statistics_vars, wu_format_money, Vue, wu_block_ui, moment, ajaxurl */
|
||||
(function() {
|
||||
|
||||
const graph = document.getElementById('wp-ultimo-mrr-growth');
|
||||
|
||||
if (! graph) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
mrr_graph = new Vue({
|
||||
el: '#wp-ultimo-mrr-growth',
|
||||
components: {
|
||||
apexchart: window.VueApexCharts,
|
||||
},
|
||||
data: {
|
||||
start_date: wu_dashboard_statistics_vars.start_date,
|
||||
end_date: wu_dashboard_statistics_vars.end_date,
|
||||
chart_options: {
|
||||
mrr_growth: {
|
||||
series: [
|
||||
{
|
||||
name: wu_dashboard_statistics_vars.i18n.new_mrr,
|
||||
data: [
|
||||
wu_dashboard_statistics_vars.mrr_array.january.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.february.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.march.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.april.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.may.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.june.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.july.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.august.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.september.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.october.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.november.total,
|
||||
wu_dashboard_statistics_vars.mrr_array.december.total,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: wu_dashboard_statistics_vars.i18n.cancellations,
|
||||
data: [
|
||||
-wu_dashboard_statistics_vars.mrr_array.january.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.february.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.march.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.april.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.may.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.june.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.july.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.august.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.september.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.october.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.november.cancelled,
|
||||
-wu_dashboard_statistics_vars.mrr_array.december.cancelled,
|
||||
],
|
||||
},
|
||||
],
|
||||
chartOptions: {
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 300,
|
||||
stacked: true,
|
||||
toolbar: {
|
||||
show: false,
|
||||
},
|
||||
zoom: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
maxItems: 0,
|
||||
},
|
||||
responsive: [{
|
||||
breakpoint: 480,
|
||||
options: {
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
offsetX: -10,
|
||||
offsetY: 0,
|
||||
},
|
||||
},
|
||||
}],
|
||||
colors: ['#3498db', '#e74c3c'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: false,
|
||||
columnWidth: '40%',
|
||||
endingShape: 'rounded',
|
||||
startingShape: 'rounded',
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
categories: wu_dashboard_statistics_vars.month_list,
|
||||
position: 'bottom',
|
||||
axisBorder: {
|
||||
show: true,
|
||||
},
|
||||
axisTicks: {
|
||||
show: true,
|
||||
},
|
||||
crosshairs: {
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
colorFrom: '#D8E3F0',
|
||||
colorTo: '#BED1E6',
|
||||
stops: [0, 100],
|
||||
opacityFrom: 0.4,
|
||||
opacityTo: 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
formatter(y) {
|
||||
|
||||
return y >= 0 ? wu_format_money(y) : '-' + wu_format_money(y);
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
offsetY: 0,
|
||||
},
|
||||
fill: {
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.wu-loader').on('click', function() {
|
||||
|
||||
wu_block_ui('#wpcontent');
|
||||
|
||||
});
|
||||
|
||||
$('#wu-date-range').flatpickr({
|
||||
mode: 'range',
|
||||
dateFormat: 'Y-m-d',
|
||||
maxDate: wu_dashboard_statistics_vars.today,
|
||||
defaultDate: [
|
||||
wu_dashboard_statistics_vars.start_date,
|
||||
wu_dashboard_statistics_vars.end_date,
|
||||
],
|
||||
onClose(selectedDates) {
|
||||
|
||||
const redirect = new URL(window.location.href);
|
||||
|
||||
redirect.searchParams.set('start_date', moment(selectedDates[0]).format('YYYY-MM-DD'));
|
||||
|
||||
redirect.searchParams.set('end_date', moment(selectedDates[1]).format('YYYY-MM-DD'));
|
||||
|
||||
window.location.href = redirect.toString();
|
||||
|
||||
wu_block_ui('#wpcontent');
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.wu-export-button').on('click', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const slug = e.target.getAttribute('attr-slug-csv');
|
||||
|
||||
const headers = $('#csv_headers_' + slug).val();
|
||||
|
||||
const data = $('#csv_data_' + slug).val();
|
||||
|
||||
const action = $('#csv_action_' + slug).val();
|
||||
|
||||
const date_range = wu_dashboard_statistics_vars.start_date + '_to_' + wu_dashboard_statistics_vars.end_date;
|
||||
|
||||
const block = wu_block_ui('#wpcontent');
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
block.unblock();
|
||||
|
||||
}, 2000);
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
$('body').append('<form id="export_csv" method="post" action="' + ajaxurl + '" style="display:none;"><input name="action" value="' + action + '" type="hidden"><input name="slug" value="' + slug + '" type="hidden"></form>');
|
||||
|
||||
$('<input />').attr('type', 'hidden')
|
||||
.attr('name', 'headers')
|
||||
.attr('value', headers)
|
||||
.appendTo('#export_csv');
|
||||
|
||||
$('<input />').attr('type', 'hidden')
|
||||
.attr('name', 'data')
|
||||
.attr('value', data)
|
||||
.appendTo('#export_csv');
|
||||
|
||||
$('<input />').attr('type', 'hidden')
|
||||
.attr('name', 'date_range')
|
||||
.attr('value', date_range)
|
||||
.appendTo('#export_csv');
|
||||
|
||||
$('#export_csv').submit();
|
||||
|
||||
$('#export_csv').remove();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
+1
@@ -0,0 +1 @@
|
||||
document.getElementById("wp-ultimo-mrr-growth")&&(mrr_graph=new Vue({el:"#wp-ultimo-mrr-growth",components:{apexchart:window.VueApexCharts},data:{start_date:wu_dashboard_statistics_vars.start_date,end_date:wu_dashboard_statistics_vars.end_date,chart_options:{mrr_growth:{series:[{name:wu_dashboard_statistics_vars.i18n.new_mrr,data:[wu_dashboard_statistics_vars.mrr_array.january.total,wu_dashboard_statistics_vars.mrr_array.february.total,wu_dashboard_statistics_vars.mrr_array.march.total,wu_dashboard_statistics_vars.mrr_array.april.total,wu_dashboard_statistics_vars.mrr_array.may.total,wu_dashboard_statistics_vars.mrr_array.june.total,wu_dashboard_statistics_vars.mrr_array.july.total,wu_dashboard_statistics_vars.mrr_array.august.total,wu_dashboard_statistics_vars.mrr_array.september.total,wu_dashboard_statistics_vars.mrr_array.october.total,wu_dashboard_statistics_vars.mrr_array.november.total,wu_dashboard_statistics_vars.mrr_array.december.total]},{name:wu_dashboard_statistics_vars.i18n.cancellations,data:[-wu_dashboard_statistics_vars.mrr_array.january.cancelled,-wu_dashboard_statistics_vars.mrr_array.february.cancelled,-wu_dashboard_statistics_vars.mrr_array.march.cancelled,-wu_dashboard_statistics_vars.mrr_array.april.cancelled,-wu_dashboard_statistics_vars.mrr_array.may.cancelled,-wu_dashboard_statistics_vars.mrr_array.june.cancelled,-wu_dashboard_statistics_vars.mrr_array.july.cancelled,-wu_dashboard_statistics_vars.mrr_array.august.cancelled,-wu_dashboard_statistics_vars.mrr_array.september.cancelled,-wu_dashboard_statistics_vars.mrr_array.october.cancelled,-wu_dashboard_statistics_vars.mrr_array.november.cancelled,-wu_dashboard_statistics_vars.mrr_array.december.cancelled]}],chartOptions:{chart:{type:"bar",height:300,stacked:!0,toolbar:{show:!1},zoom:{enabled:!0}},dataLabels:{enabled:!1,maxItems:0},responsive:[{breakpoint:480,options:{legend:{position:"bottom",offsetX:-10,offsetY:0}}}],colors:["#3498db","#e74c3c"],plotOptions:{bar:{horizontal:!1,columnWidth:"40%",endingShape:"rounded",startingShape:"rounded"}},xaxis:{categories:wu_dashboard_statistics_vars.month_list,position:"bottom",axisBorder:{show:!0},axisTicks:{show:!0},crosshairs:{fill:{type:"gradient",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}}},tooltip:{enabled:!0}},yaxis:{labels:{formatter:a=>a>=0?wu_format_money(a):"-"+wu_format_money(a)}},legend:{position:"top",offsetY:0},fill:{opacity:1}}}}}})),function(a){a(document).ready((function(){a(".wu-loader").on("click",(function(){wu_block_ui("#wpcontent")})),a("#wu-date-range").flatpickr({mode:"range",dateFormat:"Y-m-d",maxDate:wu_dashboard_statistics_vars.today,defaultDate:[wu_dashboard_statistics_vars.start_date,wu_dashboard_statistics_vars.end_date],onClose(a){const t=new URL(window.location.href);t.searchParams.set("start_date",moment(a[0]).format("YYYY-MM-DD")),t.searchParams.set("end_date",moment(a[1]).format("YYYY-MM-DD")),window.location.href=t.toString(),wu_block_ui("#wpcontent")}})}))}(jQuery),function(a){a(document).ready((function(){a(".wu-export-button").on("click",(function(t){t.preventDefault();const r=t.target.getAttribute("attr-slug-csv"),s=a("#csv_headers_"+r).val(),e=a("#csv_data_"+r).val(),o=a("#csv_action_"+r).val(),_=wu_dashboard_statistics_vars.start_date+"_to_"+wu_dashboard_statistics_vars.end_date,d=wu_block_ui("#wpcontent");setTimeout(()=>{d.unblock()},2e3),a("body").append('<form id="export_csv" method="post" action="'+ajaxurl+'" style="display:none;"><input name="action" value="'+o+'" type="hidden"><input name="slug" value="'+r+'" type="hidden"></form>'),a("<input />").attr("type","hidden").attr("name","headers").attr("value",s).appendTo("#export_csv"),a("<input />").attr("type","hidden").attr("name","data").attr("value",e).appendTo("#export_csv"),a("<input />").attr("type","hidden").attr("name","date_range").attr("value",_).appendTo("#export_csv"),a("#export_csv").submit(),a("#export_csv").remove()}))}))}(jQuery);
|
||||
@@ -0,0 +1,231 @@
|
||||
/* eslint-disable no-lonely-if */
|
||||
/* global Vue, wu_block_ui, ajaxurl, wu_placeholdersl10n */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Vue
|
||||
*/
|
||||
if ($('#wu-template-placeholders').length) {
|
||||
|
||||
window.wu_placeholders = new Vue({
|
||||
el: '#wu-template-placeholders',
|
||||
data: {
|
||||
tax_category: 'default',
|
||||
switching: false,
|
||||
creating: false,
|
||||
create_name: '',
|
||||
toggle: false,
|
||||
loading: true,
|
||||
saving: false,
|
||||
initialLoading: true,
|
||||
error: false,
|
||||
changed: false,
|
||||
data: {
|
||||
placeholders: [],
|
||||
},
|
||||
delete: [],
|
||||
saveMessage: '',
|
||||
errorMessage: '',
|
||||
rate_type: 'standard_rate',
|
||||
},
|
||||
watch: {
|
||||
data: {
|
||||
deep: true,
|
||||
handler() {
|
||||
|
||||
if (this.initialLoading) {
|
||||
|
||||
this.initialLoading = false;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
this.changed = true;
|
||||
|
||||
},
|
||||
},
|
||||
loading(new_value) {
|
||||
|
||||
if (new_value === true) {
|
||||
|
||||
window.wu_blocked_table = wu_block_ui('table.wp-list-table');
|
||||
|
||||
} else {
|
||||
|
||||
if (typeof window.wu_blocked_table !== 'undefined') {
|
||||
|
||||
window.wu_blocked_table.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.loading = true;
|
||||
|
||||
this.pull_data(true);
|
||||
|
||||
$('.wu-tooltip-vue').tipTip();
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
// Create the event.
|
||||
const event = document.createEvent('Event');
|
||||
|
||||
// Define that the event name is 'build'.
|
||||
event.initEvent('vue_loaded', true, true);
|
||||
|
||||
event.vue = this;
|
||||
|
||||
// target can be any Element or other EventTarget.
|
||||
window.dispatchEvent(event);
|
||||
|
||||
},
|
||||
computed: {
|
||||
selected() {
|
||||
|
||||
return $(this.data.placeholders).filter(function(index, item) {
|
||||
|
||||
return item.selected;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
refresh(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
this.loading = true;
|
||||
|
||||
this.pull_data();
|
||||
|
||||
},
|
||||
select_all(event) {
|
||||
|
||||
const toggle = $(event.target).is(':checked');
|
||||
|
||||
this.data.placeholders = $.map(this.data.placeholders, function(item) {
|
||||
|
||||
item.selected = toggle;
|
||||
|
||||
return item;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
pull_data() {
|
||||
|
||||
const that = this;
|
||||
|
||||
jQuery.getJSON(ajaxurl + '?action=wu_get_placeholders').done(function(response) {
|
||||
|
||||
that.loading = false;
|
||||
|
||||
that.data = response.data;
|
||||
|
||||
})
|
||||
.fail(function(error) {
|
||||
|
||||
that.loading = false;
|
||||
|
||||
that.error = true;
|
||||
|
||||
that.errorMessage = error.statusText;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
add_row() {
|
||||
|
||||
Vue.set(this.data, 'placeholders', this.data.placeholders.concat([
|
||||
{
|
||||
placeholder: '',
|
||||
content: '',
|
||||
selected: false,
|
||||
},
|
||||
]));
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
},
|
||||
delete_rows() {
|
||||
|
||||
this.delete = this.delete.concat(this.selected.get());
|
||||
|
||||
// eslint-disable-next-line no-alert
|
||||
const are_you_sure = confirm(wu_placeholdersl10n.confirm_message);
|
||||
|
||||
if (are_you_sure) {
|
||||
|
||||
const cleaned_list = $(this.data.placeholders).filter(function(index, item) {
|
||||
|
||||
return ! item.selected;
|
||||
|
||||
});
|
||||
|
||||
Vue.set(this.data, 'placeholders', cleaned_list.get());
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
} // end if
|
||||
|
||||
},
|
||||
save() {
|
||||
|
||||
const that = this;
|
||||
|
||||
that.saving = true;
|
||||
|
||||
$.post({
|
||||
url: ajaxurl + '?action=wu_save_placeholders&' + $('#nonce_form').serialize(),
|
||||
data: JSON.stringify({
|
||||
placeholders: that.data.placeholders,
|
||||
}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
}).success(function(data) {
|
||||
|
||||
that.saving = false;
|
||||
|
||||
that.changed = false;
|
||||
|
||||
that.delete = [];
|
||||
|
||||
that.saveMessage = data.message;
|
||||
|
||||
if (data.code === 'success') {
|
||||
|
||||
that.loading = true;
|
||||
|
||||
that.initialLoading = true;
|
||||
|
||||
that.pull_data();
|
||||
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
|
||||
that.saveMessage = '';
|
||||
|
||||
}, 6000);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){e("#wu-template-placeholders").length&&(window.wu_placeholders=new Vue({el:"#wu-template-placeholders",data:{tax_category:"default",switching:!1,creating:!1,create_name:"",toggle:!1,loading:!0,saving:!1,initialLoading:!0,error:!1,changed:!1,data:{placeholders:[]},delete:[],saveMessage:"",errorMessage:"",rate_type:"standard_rate"},watch:{data:{deep:!0,handler(){this.initialLoading?this.initialLoading=!1:this.changed=!0}},loading(e){!0===e?window.wu_blocked_table=wu_block_ui("table.wp-list-table"):void 0!==window.wu_blocked_table&&window.wu_blocked_table.unblock()}},mounted(){this.loading=!0,this.pull_data(!0),e(".wu-tooltip-vue").tipTip()},created(){const e=document.createEvent("Event");e.initEvent("vue_loaded",!0,!0),e.vue=this,window.dispatchEvent(e)},computed:{selected(){return e(this.data.placeholders).filter((function(e,t){return t.selected}))}},methods:{refresh(e){e.preventDefault(),this.loading=!0,this.pull_data()},select_all(t){const a=e(t.target).is(":checked");this.data.placeholders=e.map(this.data.placeholders,(function(e){return e.selected=a,e}))},pull_data(){const e=this;jQuery.getJSON(ajaxurl+"?action=wu_get_placeholders").done((function(t){e.loading=!1,e.data=t.data})).fail((function(t){e.loading=!1,e.error=!0,e.errorMessage=t.statusText}))},add_row(){Vue.set(this.data,"placeholders",this.data.placeholders.concat([{placeholder:"",content:"",selected:!1}])),this.$forceUpdate()},delete_rows(){this.delete=this.delete.concat(this.selected.get());if(confirm(wu_placeholdersl10n.confirm_message)){const t=e(this.data.placeholders).filter((function(e,t){return!t.selected}));Vue.set(this.data,"placeholders",t.get()),this.$forceUpdate()}},save(){const t=this;t.saving=!0,e.post({url:ajaxurl+"?action=wu_save_placeholders&"+e("#nonce_form").serialize(),data:JSON.stringify({placeholders:t.data.placeholders}),dataType:"json",contentType:"application/json; charset=utf-8"}).success((function(e){t.saving=!1,t.changed=!1,t.delete=[],t.saveMessage=e.message,"success"===e.code&&(t.loading=!0,t.initialLoading=!0,t.pull_data()),setInterval((function(){t.saveMessage=""}),6e3)}))}}}))}))}(jQuery);
|
||||
@@ -0,0 +1,81 @@
|
||||
/* global ajaxurl, Vue, wu_event_payload_placeholders, _ */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
wu_event_payload_placeholders = new Vue({
|
||||
el: '#wu_event_payload_placeholders',
|
||||
data() {
|
||||
|
||||
return {
|
||||
placeholders: [],
|
||||
event: $("select[name='event']").val(),
|
||||
search: '',
|
||||
loading: true,
|
||||
};
|
||||
|
||||
},
|
||||
computed: {
|
||||
filtered_placeholders() {
|
||||
|
||||
const search = this.search.toLowerCase();
|
||||
|
||||
return _.filter(this.placeholders, function(item) {
|
||||
|
||||
return item.name.toLowerCase().indexOf(search) > -1 || item.placeholder.toLowerCase().indexOf(search) > -1;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
event() {
|
||||
|
||||
this.get_event_payload();
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
get_event_payload() {
|
||||
|
||||
const app = this;
|
||||
|
||||
app.loading = true;
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'wu_get_event_payload_placeholders',
|
||||
email_event: app.event,
|
||||
},
|
||||
success(response) {
|
||||
|
||||
app.placeholders = response;
|
||||
|
||||
app.loading = false;
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.get_event_payload();
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[name="event"]', function() {
|
||||
|
||||
wu_event_payload_placeholders.event = $("select[name='event']").val();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){wu_event_payload_placeholders=new Vue({el:"#wu_event_payload_placeholders",data:()=>({placeholders:[],event:e("select[name='event']").val(),search:"",loading:!0}),computed:{filtered_placeholders(){const e=this.search.toLowerCase();return _.filter(this.placeholders,(function(t){return t.name.toLowerCase().indexOf(e)>-1||t.placeholder.toLowerCase().indexOf(e)>-1}))}},watch:{event(){this.get_event_payload()}},methods:{get_event_payload(){const t=this;t.loading=!0,e.ajax({method:"post",url:ajaxurl,data:{action:"wu_get_event_payload_placeholders",email_event:t.event},success(e){t.placeholders=e,t.loading=!1}})}},mounted(){this.get_event_payload()}}),e(document).on("change",'select[name="event"]',(function(){wu_event_payload_placeholders.event=e("select[name='event']").val()}))}))}(jQuery);
|
||||
@@ -0,0 +1,46 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* global Vue, wu_event_view_payload, ClipboardJS */
|
||||
(function ($) {
|
||||
|
||||
$(function () {
|
||||
|
||||
if (($('#wu_payload').length)) {
|
||||
|
||||
wu_event_view_payload = new Vue({
|
||||
el: '#wu_payload',
|
||||
data() {
|
||||
|
||||
return {
|
||||
loading: false,
|
||||
payload: $('#hidden_textarea').val(),
|
||||
};
|
||||
|
||||
},
|
||||
methods: {},
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const clipboard = new ClipboardJS('.btn-clipboard');
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
|
||||
const target = $(e.trigger);
|
||||
|
||||
const default_text = target.text();
|
||||
|
||||
target.attr('disabled', 'disabled').text('Copied!');
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
target.text(default_text).removeAttr('disabled');
|
||||
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e((function(){e("#wu_payload").length&&(wu_event_view_payload=new Vue({el:"#wu_payload",data:()=>({loading:!1,payload:e("#hidden_textarea").val()}),methods:{}}));new ClipboardJS(".btn-clipboard").on("success",(function(t){const a=e(t.trigger),d=a.text();a.attr("disabled","disabled").text("Copied!"),setTimeout((function(){a.text(d).removeAttr("disabled")}),3e3)}))}))}(jQuery);
|
||||
@@ -0,0 +1,46 @@
|
||||
/* global Vue */
|
||||
|
||||
if (typeof window.Vue !== 'undefined') {
|
||||
|
||||
/**
|
||||
* Registers the ColorPicker component.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
Vue.component('colorPicker', {
|
||||
props: ['value'],
|
||||
template: '<input type="text">',
|
||||
mounted() {
|
||||
|
||||
const vm = this;
|
||||
|
||||
$(this.$el)
|
||||
.val(this.value)
|
||||
.wpColorPicker({
|
||||
width: 200,
|
||||
defaultColor: this.value,
|
||||
change(event, ui) {
|
||||
|
||||
// emit change event on color change using mouse
|
||||
vm.$emit('input', ui.color.toString());
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
|
||||
// update value
|
||||
$(this.$el).wpColorPicker('color', value);
|
||||
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
|
||||
$(this.$el).off().wpColorPicker('destroy'); // (!) Not tested
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
} // end if;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
void 0!==window.Vue&&Vue.component("colorPicker",{props:["value"],template:'<input type="text">',mounted(){const e=this;$(this.$el).val(this.value).wpColorPicker({width:200,defaultColor:this.value,change(o,t){e.$emit("input",t.color.toString())}})},watch:{value(e){$(this.$el).wpColorPicker("color",e)}},destroyed(){$(this.$el).off().wpColorPicker("destroy")}});
|
||||
@@ -0,0 +1,460 @@
|
||||
/* eslint-disable no-undef */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* global wu_settings, wu_input_masks, wu_money_input_masks, Cleave, ClipboardJS, wu_fields, tinymce, wu_media_frame, fontIconPicker */
|
||||
window.wu_initialize_tooltip = function() {
|
||||
|
||||
jQuery('[role="tooltip"]').tipTip({
|
||||
attribute: 'aria-label',
|
||||
});
|
||||
|
||||
}; // end wu_initialize_tooltip;
|
||||
|
||||
window.wu_initialize_editors = function() {
|
||||
|
||||
jQuery('textarea[data-editor]').each(function() {
|
||||
|
||||
tinymce.remove('#' + jQuery(this).attr('id'));
|
||||
|
||||
tinymce.init({
|
||||
selector: '#' + jQuery(this).attr('id'), // change this value according to your HTML
|
||||
menubar: '',
|
||||
theme: 'modern',
|
||||
...wp.editor.getDefaultSettings().tinymce,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}; // end wu_initialize_editors
|
||||
|
||||
window.wu_initialize_imagepicker = function() {
|
||||
|
||||
jQuery('.wu-wrapper-image-field').each(function() {
|
||||
|
||||
const that = jQuery(this);
|
||||
|
||||
that.find('img').css({
|
||||
maxWidth: '100%',
|
||||
});
|
||||
|
||||
const value = that.find('img').attr('src');
|
||||
|
||||
if (value) {
|
||||
|
||||
that.find('.wu-wrapper-image-field-upload-actions').show();
|
||||
|
||||
} else {
|
||||
|
||||
that.find('.wu-add-image-wrapper').show();
|
||||
|
||||
} // end if;
|
||||
|
||||
that.on('click', 'a.wu-add-image', function() {
|
||||
|
||||
if (typeof wu_media_frame !== 'undefined') {
|
||||
|
||||
wu_media_frame.open();
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
wu_media_frame = wp.media({
|
||||
title: wu_fields.l10n.image_picker_title,
|
||||
multiple: false,
|
||||
button: {
|
||||
text: wu_fields.l10n.image_picker_button_text,
|
||||
},
|
||||
});
|
||||
|
||||
wu_media_frame.on('select', function() {
|
||||
|
||||
const mediaObject = wu_media_frame.state().get('selection').first().toJSON();
|
||||
|
||||
const img_el = that.find('img');
|
||||
|
||||
that.find('img').removeClass('wu-absolute').attr('src', mediaObject.url);
|
||||
|
||||
that.find('.wubox').attr('href', mediaObject.url);
|
||||
|
||||
that.find('input').val(mediaObject.id);
|
||||
|
||||
that.find('.wu-add-image-wrapper').hide();
|
||||
|
||||
img_el.on('load', function() {
|
||||
|
||||
that.find('.wu-wrapper-image-field-upload-actions').show();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
wu_media_frame.open();
|
||||
|
||||
});
|
||||
|
||||
that.find('.wu-remove-image').on('click', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
that.find('img').removeAttr('src').addClass('wu-absolute');
|
||||
|
||||
that.find('input').val('');
|
||||
|
||||
that.find('.wu-wrapper-image-field-upload-actions').hide();
|
||||
|
||||
that.find('.wu-add-image-wrapper').show();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}; // end wu_initialize_imagepicker
|
||||
|
||||
window.wu_initialize_colorpicker = function() {
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
jQuery('.wu_color_field').each(function() {
|
||||
|
||||
jQuery(this).wpColorPicker();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}; // end wu_initialize_colorpicker;
|
||||
|
||||
window.wu_initialize_iconfontpicker = function() {
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
if (jQuery('.wu_select_icon').length) {
|
||||
|
||||
jQuery('.wu_select_icon').fontIconPicker({
|
||||
theme: 'wu-theme',
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}; // end wu_initialize_iconfontpicker;
|
||||
|
||||
window.wu_initialize_clipboardjs = function() {
|
||||
|
||||
new ClipboardJS('.wu-copy');
|
||||
|
||||
}; // end wu_initialize_clipboardjs;
|
||||
|
||||
// DatePicker;
|
||||
window.wu_initialize_datepickers = function() {
|
||||
|
||||
jQuery('.wu-datepicker, [wu-datepicker]').each(function() {
|
||||
|
||||
const $this = jQuery(this);
|
||||
|
||||
const format = $this.data('format'),
|
||||
allow_time = $this.data('allow-time');
|
||||
|
||||
$this.flatpickr({
|
||||
animate: false,
|
||||
// locale: wpu.datepicker_locale,
|
||||
time_24hr: true,
|
||||
enableTime: typeof allow_time === 'undefined' ? true : allow_time,
|
||||
dateFormat: format,
|
||||
allowInput: true,
|
||||
defaultDate: $this.val(),
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}; // end wu_initialize_datepickers;
|
||||
|
||||
window.wu_update_clock = function() {
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const yourTimeZoneFrom = wu_ticker.server_clock_offset; // time zone value where you are at
|
||||
|
||||
const d = new Date();
|
||||
//get the timezone offset from local time in minutes
|
||||
|
||||
// eslint-disable-next-line no-mixed-operators
|
||||
const tzDifference = yourTimeZoneFrom * 60 + d.getTimezoneOffset();
|
||||
|
||||
//convert the offset to milliseconds, add to targetTime, and make a new Date
|
||||
const offset = tzDifference * 60 * 1000;
|
||||
|
||||
function callback_update_clock() {
|
||||
|
||||
const tDate = new Date(new Date().getTime() + offset);
|
||||
|
||||
const in_years = tDate.getFullYear();
|
||||
|
||||
let in_months = tDate.getMonth() + 1;
|
||||
|
||||
let in_days = tDate.getDate();
|
||||
|
||||
let in_hours = tDate.getHours();
|
||||
|
||||
let in_minutes = tDate.getMinutes();
|
||||
|
||||
let in_seconds = tDate.getSeconds();
|
||||
|
||||
if (in_months < 10) {
|
||||
|
||||
in_months = '0' + in_months;
|
||||
|
||||
}
|
||||
|
||||
if (in_days < 10) {
|
||||
|
||||
in_days = '0' + in_days;
|
||||
|
||||
}
|
||||
|
||||
if (in_minutes < 10) {
|
||||
|
||||
in_minutes = '0' + in_minutes;
|
||||
|
||||
}
|
||||
|
||||
if (in_seconds < 10) {
|
||||
|
||||
in_seconds = '0' + in_seconds;
|
||||
|
||||
}
|
||||
|
||||
if (in_hours < 10) {
|
||||
|
||||
in_hours = '0' + in_hours;
|
||||
|
||||
}
|
||||
|
||||
jQuery('#wu-ticker').text(in_years + '-' + in_months + '-' + in_days + ' ' + in_hours + ':' + in_minutes + ':' + in_seconds);
|
||||
|
||||
}
|
||||
|
||||
function start_clock() {
|
||||
|
||||
setInterval(callback_update_clock, 500);
|
||||
|
||||
}
|
||||
|
||||
start_clock();
|
||||
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function wu_on_load() {
|
||||
|
||||
wu_initialize_tooltip();
|
||||
|
||||
wu_initialize_datepickers();
|
||||
|
||||
wu_initialize_colorpicker();
|
||||
|
||||
wu_initialize_iconfontpicker();
|
||||
|
||||
wu_initialize_editors();
|
||||
|
||||
wu_update_clock();
|
||||
|
||||
wu_initialize_clipboardjs();
|
||||
|
||||
wu_initialize_imagepicker();
|
||||
|
||||
wu_image_preview();
|
||||
|
||||
} // end wu_on_load;
|
||||
|
||||
window.wu_on_load = wu_on_load;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
window.wu_block_ui = function(el) {
|
||||
|
||||
jQuery(el).wu_block({
|
||||
message: '<div class="spinner is-active wu-float-none" style="float: none !important;"></div>',
|
||||
overlayCSS: {
|
||||
backgroundColor: '#FFF',
|
||||
opacity: 0.6,
|
||||
},
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '50%',
|
||||
fontSize: '14px !important',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: 'none',
|
||||
backgroundColor: 'none',
|
||||
cursor: 'wait',
|
||||
},
|
||||
});
|
||||
|
||||
const el_instance = jQuery(el);
|
||||
|
||||
el_instance.unblock = jQuery(el).wu_unblock;
|
||||
|
||||
return el_instance;
|
||||
|
||||
};
|
||||
|
||||
function wu_format_money(value) {
|
||||
|
||||
value = parseFloat(value.toString().replace(/[^0-9\.]/g, ''));
|
||||
|
||||
const settings = wp.hooks.applyFilters('wu_format_money', {
|
||||
currency: {
|
||||
symbol: wu_settings.currency_symbol, // default currency symbol is '$'
|
||||
format: wu_settings.currency_position, // controls output: %s = symbol, %v = value/number (can be object: see below)
|
||||
decimal: wu_settings.decimal_separator, // decimal point separator
|
||||
thousand: wu_settings.thousand_separator, // thousands separator
|
||||
precision: wu_settings.precision, // decimal places
|
||||
},
|
||||
number: {
|
||||
precision: 0, // default precision on numbers is 0
|
||||
thousand: ',',
|
||||
decimal: ',',
|
||||
},
|
||||
});
|
||||
|
||||
accounting.settings = settings;
|
||||
|
||||
return accounting.formatMoney(value);
|
||||
|
||||
} // end wu_format_money;
|
||||
|
||||
window.wu_image_preview = function() {
|
||||
|
||||
const xOffset = 10;
|
||||
|
||||
const yOffset = 30;
|
||||
|
||||
const preview_el = '#wu-image-preview';
|
||||
|
||||
// eslint-disable-next-line eqeqeq
|
||||
const selector = wu_settings.disable_image_zoom == true ? '.wu-image-preview:not(img)' : '.wu-image-preview';
|
||||
|
||||
const el_id = preview_el.replace('#', '');
|
||||
|
||||
if (jQuery(preview_el).length === 0) {
|
||||
|
||||
jQuery('body').append(
|
||||
"<div id='" + el_id + "' class='wu-rounded wu-p-1 wp-ui-primary' style='max-width: 600px; display: none; z-index: 9999999;'>" +
|
||||
"<img class='wu-rounded wu-block wu-m-0 wu-p-0 wu-bg-gray-100' style='max-width: 100%;' src='' alt=''>" +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
/* END CONFIG */
|
||||
jQuery(selector).hover(function(e) {
|
||||
|
||||
this.t = this.title;
|
||||
|
||||
this.title = '';
|
||||
|
||||
const img = jQuery(this).data('image');
|
||||
|
||||
jQuery(preview_el)
|
||||
.find('img')
|
||||
.attr('src', img)
|
||||
.attr('alt', this.t)
|
||||
.end()
|
||||
.css({
|
||||
position: 'absolute',
|
||||
display: 'none',
|
||||
})
|
||||
.css('top', (e.pageY - xOffset) + 'px')
|
||||
.css('left', (e.pageX + yOffset) + 'px')
|
||||
.fadeIn('fast');
|
||||
|
||||
},
|
||||
function() {
|
||||
|
||||
this.title = this.t;
|
||||
|
||||
jQuery(preview_el).fadeOut('fast');
|
||||
|
||||
});
|
||||
|
||||
jQuery(selector).mousemove(function(e) {
|
||||
|
||||
jQuery(preview_el)
|
||||
.css('top', (e.pageY - xOffset) + 'px')
|
||||
.css('left', (e.pageX + yOffset) + 'px');
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
window.wu_initialize_code_editors = function() {
|
||||
|
||||
if (jQuery('[data-code-editor]').length) {
|
||||
|
||||
if (typeof window.wu_editor_instances === 'undefined') {
|
||||
|
||||
window.wu_editor_instances = {};
|
||||
|
||||
} // end if;
|
||||
|
||||
jQuery('[data-code-editor]').each(function() {
|
||||
|
||||
const code_editor = jQuery(this);
|
||||
|
||||
const editor_id = code_editor.attr('id');
|
||||
|
||||
if (typeof window.wu_editor_instances[editor_id] === 'undefined') {
|
||||
|
||||
if (! code_editor.is(':visible')) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
window.wu_editor_instances[editor_id] = wp.codeEditor.initialize(editor_id, {
|
||||
codemirror: {
|
||||
mode: code_editor.data('code-editor'),
|
||||
lint: true,
|
||||
autoCloseBrackets: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 2,
|
||||
indentWithTabs: true,
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
styleActiveLine: true,
|
||||
continueComments: true,
|
||||
inputStyle: 'contenteditable',
|
||||
direction: 'ltr', // Code is shown in LTR even in RTL languages.
|
||||
gutters: [],
|
||||
extraKeys: {
|
||||
'Ctrl-Space': 'autocomplete',
|
||||
'Ctrl-/': 'toggleComment',
|
||||
'Cmd-/': 'toggleComment',
|
||||
'Alt-F': 'findPersistent',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
}; // end wu_initialize_code_editors;
|
||||
|
||||
/**
|
||||
* Get a timezone-d moment instance.
|
||||
*
|
||||
* @param {*} a The date.
|
||||
* @return moment instance
|
||||
*/
|
||||
window.wu_moment = function(a) {
|
||||
|
||||
return moment.tz(a, 'Etc/UTC');
|
||||
|
||||
}; // end wu_moment;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
function wu_on_load(){wu_initialize_tooltip(),wu_initialize_datepickers(),wu_initialize_colorpicker(),wu_initialize_iconfontpicker(),wu_initialize_editors(),wu_update_clock(),wu_initialize_clipboardjs(),wu_initialize_imagepicker(),wu_image_preview()}function wu_format_money(e){e=parseFloat(e.toString().replace(/[^0-9\.]/g,""));const i=wp.hooks.applyFilters("wu_format_money",{currency:{symbol:wu_settings.currency_symbol,format:wu_settings.currency_position,decimal:wu_settings.decimal_separator,thousand:wu_settings.thousand_separator,precision:wu_settings.precision},number:{precision:0,thousand:",",decimal:","}});return accounting.settings=i,accounting.formatMoney(e)}window.wu_initialize_tooltip=function(){jQuery('[role="tooltip"]').tipTip({attribute:"aria-label"})},window.wu_initialize_editors=function(){jQuery("textarea[data-editor]").each((function(){tinymce.remove("#"+jQuery(this).attr("id")),tinymce.init({selector:"#"+jQuery(this).attr("id"),menubar:"",theme:"modern",...wp.editor.getDefaultSettings().tinymce})}))},window.wu_initialize_imagepicker=function(){jQuery(".wu-wrapper-image-field").each((function(){const e=jQuery(this);e.find("img").css({maxWidth:"100%"});e.find("img").attr("src")?e.find(".wu-wrapper-image-field-upload-actions").show():e.find(".wu-add-image-wrapper").show(),e.on("click","a.wu-add-image",(function(){"undefined"==typeof wu_media_frame?(wu_media_frame=wp.media({title:wu_fields.l10n.image_picker_title,multiple:!1,button:{text:wu_fields.l10n.image_picker_button_text}}),wu_media_frame.on("select",(function(){const i=wu_media_frame.state().get("selection").first().toJSON(),t=e.find("img");e.find("img").removeClass("wu-absolute").attr("src",i.url),e.find(".wubox").attr("href",i.url),e.find("input").val(i.id),e.find(".wu-add-image-wrapper").hide(),t.on("load",(function(){e.find(".wu-wrapper-image-field-upload-actions").show()}))})),wu_media_frame.open()):wu_media_frame.open()})),e.find(".wu-remove-image").on("click",(function(i){i.preventDefault(),e.find("img").removeAttr("src").addClass("wu-absolute"),e.find("input").val(""),e.find(".wu-wrapper-image-field-upload-actions").hide(),e.find(".wu-add-image-wrapper").show()}))}))},window.wu_initialize_colorpicker=function(){jQuery(document).ready((function(){jQuery(".wu_color_field").each((function(){jQuery(this).wpColorPicker()}))}))},window.wu_initialize_iconfontpicker=function(){jQuery(document).ready((function(){jQuery(".wu_select_icon").length&&jQuery(".wu_select_icon").fontIconPicker({theme:"wu-theme"})}))},window.wu_initialize_clipboardjs=function(){new ClipboardJS(".wu-copy")},window.wu_initialize_datepickers=function(){jQuery(".wu-datepicker, [wu-datepicker]").each((function(){const e=jQuery(this),i=e.data("format"),t=e.data("allow-time");e.flatpickr({animate:!1,time_24hr:!0,enableTime:void 0===t||t,dateFormat:i,allowInput:!0,defaultDate:e.val()})}))},window.wu_update_clock=function(){const e=60*(60*wu_ticker.server_clock_offset+(new Date).getTimezoneOffset())*1e3;function i(){const i=new Date((new Date).getTime()+e),t=i.getFullYear();let n=i.getMonth()+1,o=i.getDate(),a=i.getHours(),r=i.getMinutes(),u=i.getSeconds();n<10&&(n="0"+n),o<10&&(o="0"+o),r<10&&(r="0"+r),u<10&&(u="0"+u),a<10&&(a="0"+a),jQuery("#wu-ticker").text(t+"-"+n+"-"+o+" "+a+":"+r+":"+u)}setInterval(i,500)},window.wu_on_load=wu_on_load,window.wu_block_ui=function(e){jQuery(e).wu_block({message:'<div class="spinner is-active wu-float-none" style="float: none !important;"></div>',overlayCSS:{backgroundColor:"#FFF",opacity:.6},css:{padding:0,margin:0,width:"50%",fontSize:"14px !important",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"none",backgroundColor:"none",cursor:"wait"}});const i=jQuery(e);return i.unblock=jQuery(e).wu_unblock,i},window.wu_image_preview=function(){const e="#wu-image-preview",i=1==wu_settings.disable_image_zoom?".wu-image-preview:not(img)":".wu-image-preview",t=e.replace("#","");0===jQuery(e).length&&jQuery("body").append("<div id='"+t+"' class='wu-rounded wu-p-1 wp-ui-primary' style='max-width: 600px; display: none; z-index: 9999999;'><img class='wu-rounded wu-block wu-m-0 wu-p-0 wu-bg-gray-100' style='max-width: 100%;' src='' alt=''></div>"),jQuery(i).hover((function(i){this.t=this.title,this.title="";const t=jQuery(this).data("image");jQuery(e).find("img").attr("src",t).attr("alt",this.t).end().css({position:"absolute",display:"none"}).css("top",i.pageY-10+"px").css("left",i.pageX+30+"px").fadeIn("fast")}),(function(){this.title=this.t,jQuery(e).fadeOut("fast")})),jQuery(i).mousemove((function(i){jQuery(e).css("top",i.pageY-10+"px").css("left",i.pageX+30+"px")}))},window.wu_initialize_code_editors=function(){jQuery("[data-code-editor]").length&&(void 0===window.wu_editor_instances&&(window.wu_editor_instances={}),jQuery("[data-code-editor]").each((function(){const e=jQuery(this),i=e.attr("id");if(void 0===window.wu_editor_instances[i]){if(!e.is(":visible"))return;window.wu_editor_instances[i]=wp.codeEditor.initialize(i,{codemirroLine truncated
|
||||
@@ -0,0 +1,45 @@
|
||||
/* eslint-disable */
|
||||
/* global wu_stripe_checkout, Stripe */
|
||||
|
||||
const stripeCheckout = function(publicKey) {
|
||||
|
||||
wp.hooks.addAction('wu_on_form_success', 'nextpress/wp-ultimo', async function(checkout, results) {
|
||||
|
||||
if (checkout.gateway === 'stripe-checkout' && results.gateway.slug !== 'free' && results.gateway.data && results.gateway.data.stripe_session_id) {
|
||||
|
||||
// Prevent redirect to thank you page
|
||||
// set_prevent_submission not work in this case
|
||||
checkout.prevent_submission = true;
|
||||
|
||||
// When the customer clicks on the button, redirect
|
||||
// them to Checkout.
|
||||
const stripe = await Stripe(publicKey);
|
||||
|
||||
stripe.redirectToCheckout({
|
||||
sessionId: results.gateway.data.stripe_session_id,
|
||||
}).then(function(result) {
|
||||
if (result.error) {
|
||||
|
||||
console.log(result.error.message);
|
||||
|
||||
var displayError = document.getElementById('error-message');
|
||||
|
||||
displayError.textContent = result.error.message;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the Stripe checkout onto the checkout form on load.
|
||||
*/
|
||||
wp.hooks.addAction('wu_checkout_loaded', 'nextpress/wp-ultimo', function() {
|
||||
|
||||
stripeCheckout(wu_stripe_checkout.pk_key);
|
||||
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
const stripeCheckout=function(e){wp.hooks.addAction("wu_on_form_success","nextpress/wp-ultimo",(async function(t,s){if("stripe-checkout"===t.gateway&&"free"!==s.gateway.slug&&s.gateway.data&&s.gateway.data.stripe_session_id){t.prevent_submission=!0;(await Stripe(e)).redirectToCheckout({sessionId:s.gateway.data.stripe_session_id}).then((function(e){e.error&&(console.log(e.error.message),document.getElementById("error-message").textContent=e.error.message)}))}}))};wp.hooks.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(){var e;e=wu_stripe_checkout.pk_key,wp.hooks.addAction("wu_on_form_success","nextpress/wp-ultimo",(async function(t,s){"stripe-checkout"===t.gateway&&"free"!==s.gateway.slug&&s.gateway.data&&s.gateway.data.stripe_session_id&&(t.prevent_submission=!0,(await Stripe(e)).redirectToCheckout({sessionId:s.gateway.data.stripe_session_id}).then((function(e){e.error&&(console.log(e.error.message),document.getElementById("error-message").textContent=e.error.message)})))}))}));
|
||||
@@ -0,0 +1,290 @@
|
||||
/* eslint-disable */
|
||||
/* global wu_stripe, Stripe */
|
||||
let _stripe;
|
||||
let stripeElement;
|
||||
let card;
|
||||
|
||||
const stripeElements = function(publicKey) {
|
||||
|
||||
_stripe = Stripe(publicKey);
|
||||
|
||||
const elements = _stripe.elements();
|
||||
|
||||
card = elements.create('card', {
|
||||
hidePostalCode: true,
|
||||
});
|
||||
|
||||
wp.hooks.addFilter('wu_before_form_submitted', 'nextpress/wp-ultimo', function(promises, checkout, gateway) {
|
||||
|
||||
const cardEl = document.getElementById('card-element');
|
||||
|
||||
if (gateway === 'stripe' && checkout.order.totals.total > 0 && cardEl && cardEl.offsetParent) {
|
||||
|
||||
promises.push(new Promise( async (resolve, reject) => {
|
||||
|
||||
try {
|
||||
|
||||
const paymentMethod = await _stripe.createPaymentMethod({type: 'card', card});
|
||||
|
||||
if (paymentMethod.error) {
|
||||
|
||||
reject(paymentMethod.error);
|
||||
|
||||
} // end if;
|
||||
|
||||
} catch(err) {
|
||||
|
||||
} // end try;
|
||||
|
||||
resolve();
|
||||
|
||||
}));
|
||||
|
||||
} // end if;
|
||||
|
||||
return promises;
|
||||
|
||||
});
|
||||
|
||||
wp.hooks.addAction('wu_on_form_success', 'nextpress/wp-ultimo', function(checkout, results) {
|
||||
|
||||
if (checkout.gateway === 'stripe' && (checkout.order.totals.total > 0 || checkout.order.totals.recurring.total > 0)) {
|
||||
|
||||
checkout.set_prevent_submission(false);
|
||||
|
||||
handlePayment(checkout, results, card);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
wp.hooks.addAction('wu_on_form_updated', 'nextpress/wp-ultimo', function(form) {
|
||||
|
||||
if (form.gateway === 'stripe') {
|
||||
|
||||
try {
|
||||
|
||||
card.mount('#card-element');
|
||||
|
||||
wu_stripe_update_styles(card, '#field-payment_template');
|
||||
|
||||
/*
|
||||
* Prevents the from from submitting while Stripe is
|
||||
* creating a payment source.
|
||||
*/
|
||||
form.set_prevent_submission(form.order && form.order.should_collect_payment && form.payment_method === 'add-new');
|
||||
|
||||
} catch (error) {
|
||||
|
||||
// Silence
|
||||
|
||||
} // end try;
|
||||
|
||||
} else {
|
||||
|
||||
form.set_prevent_submission(false);
|
||||
|
||||
try {
|
||||
|
||||
card.unmount('#card-element');
|
||||
|
||||
} catch (error) {
|
||||
|
||||
// Silence is golden
|
||||
|
||||
} // end try;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
// Element focus ring
|
||||
card.on('focus', function() {
|
||||
|
||||
const el = document.getElementById('card-element');
|
||||
|
||||
el.classList.add('focused');
|
||||
|
||||
});
|
||||
|
||||
card.on('blur', function() {
|
||||
|
||||
const el = document.getElementById('card-element');
|
||||
|
||||
el.classList.remove('focused');
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
wp.hooks.addFilter('wu_before_form_init', 'nextpress/wp-ultimo', function(data) {
|
||||
|
||||
data.add_new_card = wu_stripe.add_new_card;
|
||||
|
||||
data.payment_method = wu_stripe.payment_method;
|
||||
|
||||
return data;
|
||||
|
||||
});
|
||||
|
||||
wp.hooks.addAction('wu_checkout_loaded', 'nextpress/wp-ultimo', function() {
|
||||
|
||||
stripeElement = stripeElements(wu_stripe.pk_key);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Copy styles from an existing element to the Stripe Card Element.
|
||||
*
|
||||
* @param {Object} cardElement Stripe card element.
|
||||
* @param {string} selector Selector to copy styles from.
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
function wu_stripe_update_styles(cardElement, selector) {
|
||||
|
||||
if (undefined === typeof selector) {
|
||||
|
||||
selector = '#field-payment_template';
|
||||
|
||||
}
|
||||
|
||||
const inputField = document.querySelector(selector);
|
||||
|
||||
if (null === inputField) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (document.getElementById('wu-stripe-styles')) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
const inputStyles = window.getComputedStyle(inputField);
|
||||
|
||||
const styleTag = document.createElement('style');
|
||||
|
||||
styleTag.innerHTML = '.StripeElement {' +
|
||||
'background-color:' + inputStyles.getPropertyValue('background-color') + ';' +
|
||||
'border-top-color:' + inputStyles.getPropertyValue('border-top-color') + ';' +
|
||||
'border-right-color:' + inputStyles.getPropertyValue('border-right-color') + ';' +
|
||||
'border-bottom-color:' + inputStyles.getPropertyValue('border-bottom-color') + ';' +
|
||||
'border-left-color:' + inputStyles.getPropertyValue('border-left-color') + ';' +
|
||||
'border-top-width:' + inputStyles.getPropertyValue('border-top-width') + ';' +
|
||||
'border-right-width:' + inputStyles.getPropertyValue('border-right-width') + ';' +
|
||||
'border-bottom-width:' + inputStyles.getPropertyValue('border-bottom-width') + ';' +
|
||||
'border-left-width:' + inputStyles.getPropertyValue('border-left-width') + ';' +
|
||||
'border-top-style:' + inputStyles.getPropertyValue('border-top-style') + ';' +
|
||||
'border-right-style:' + inputStyles.getPropertyValue('border-right-style') + ';' +
|
||||
'border-bottom-style:' + inputStyles.getPropertyValue('border-bottom-style') + ';' +
|
||||
'border-left-style:' + inputStyles.getPropertyValue('border-left-style') + ';' +
|
||||
'border-top-left-radius:' + inputStyles.getPropertyValue('border-top-left-radius') + ';' +
|
||||
'border-top-right-radius:' + inputStyles.getPropertyValue('border-top-right-radius') + ';' +
|
||||
'border-bottom-left-radius:' + inputStyles.getPropertyValue('border-bottom-left-radius') + ';' +
|
||||
'border-bottom-right-radius:' + inputStyles.getPropertyValue('border-bottom-right-radius') + ';' +
|
||||
'padding-top:' + inputStyles.getPropertyValue('padding-top') + ';' +
|
||||
'padding-right:' + inputStyles.getPropertyValue('padding-right') + ';' +
|
||||
'padding-bottom:' + inputStyles.getPropertyValue('padding-bottom') + ';' +
|
||||
'padding-left:' + inputStyles.getPropertyValue('padding-left') + ';' +
|
||||
'line-height:' + inputStyles.getPropertyValue('height') + ';' +
|
||||
'height:' + inputStyles.getPropertyValue('height') + ';' +
|
||||
`display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;` +
|
||||
'}';
|
||||
|
||||
styleTag.id = 'wu-stripe-styles';
|
||||
|
||||
document.body.appendChild(styleTag);
|
||||
|
||||
cardElement.update({
|
||||
style: {
|
||||
base: {
|
||||
color: inputStyles.getPropertyValue('color'),
|
||||
fontFamily: inputStyles.getPropertyValue('font-family'),
|
||||
fontSize: inputStyles.getPropertyValue('font-size'),
|
||||
fontWeight: inputStyles.getPropertyValue('font-weight'),
|
||||
fontSmoothing: inputStyles.getPropertyValue('-webkit-font-smoothing'),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function wu_stripe_handle_intent(handler, client_secret, args) {
|
||||
|
||||
const _handle_error = function (e) {
|
||||
|
||||
wu_checkout_form.unblock();
|
||||
|
||||
if (e.error) {
|
||||
|
||||
wu_checkout_form.errors.push(e.error);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end _handle_error;
|
||||
|
||||
try {
|
||||
|
||||
_stripe[handler](client_secret, args).then(function(results) {
|
||||
|
||||
if (results.error) {
|
||||
|
||||
_handle_error(results);
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
wu_checkout_form.resubmit();
|
||||
|
||||
}, _handle_error);
|
||||
|
||||
} catch(e) {} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
/**
|
||||
* After registration has been processed, handle card payments.
|
||||
*
|
||||
* @param form
|
||||
* @param response
|
||||
* @param card
|
||||
*/
|
||||
function handlePayment(form, response, card) {
|
||||
|
||||
// Trigger error if we don't have a client secret.
|
||||
if (! response.gateway.data.stripe_client_secret) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
const handler = 'payment_intent' === response.gateway.data.stripe_intent_type ? 'confirmCardPayment' : 'confirmCardSetup';
|
||||
|
||||
const args = {
|
||||
payment_method: form.payment_method !== 'add-new' ? form.payment_method : {
|
||||
card,
|
||||
billing_details: {
|
||||
name: response.customer.display_name,
|
||||
email: response.customer.user_email,
|
||||
address: {
|
||||
country: response.customer.billing_address_data.billing_country,
|
||||
postal_code: response.customer.billing_address_data.billing_zip_code,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle payment intent / setup intent.
|
||||
*/
|
||||
wu_stripe_handle_intent(
|
||||
handler, response.gateway.data.stripe_client_secret, args
|
||||
);
|
||||
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
let _stripe,stripeElement,card;const stripeElements=function(e){_stripe=Stripe(e);const t=_stripe.elements();card=t.create("card",{hidePostalCode:!0}),wp.hooks.addFilter("wu_before_form_submitted","nextpress/wp-ultimo",(function(e,t,r){const o=document.getElementById("card-element");return"stripe"===r&&t.order.totals.total>0&&o&&o.offsetParent&&e.push(new Promise(async(e,t)=>{try{const e=await _stripe.createPaymentMethod({type:"card",card:card});e.error&&t(e.error)}catch(e){}e()})),e})),wp.hooks.addAction("wu_on_form_success","nextpress/wp-ultimo",(function(e,t){"stripe"===e.gateway&&(e.order.totals.total>0||e.order.totals.recurring.total>0)&&(e.set_prevent_submission(!1),handlePayment(e,t,card))})),wp.hooks.addAction("wu_on_form_updated","nextpress/wp-ultimo",(function(e){if("stripe"===e.gateway)try{card.mount("#card-element"),wu_stripe_update_styles(card,"#field-payment_template"),e.set_prevent_submission(e.order&&e.order.should_collect_payment&&"add-new"===e.payment_method)}catch(e){}else{e.set_prevent_submission(!1);try{card.unmount("#card-element")}catch(e){}}})),card.on("focus",(function(){document.getElementById("card-element").classList.add("focused")})),card.on("blur",(function(){document.getElementById("card-element").classList.remove("focused")}))};function wu_stripe_update_styles(e,t){void 0===typeof t&&(t="#field-payment_template");const r=document.querySelector(t);if(null===r)return;if(document.getElementById("wu-stripe-styles"))return;const o=window.getComputedStyle(r),d=document.createElement("style");d.innerHTML=".StripeElement {background-color:"+o.getPropertyValue("background-color")+";border-top-color:"+o.getPropertyValue("border-top-color")+";border-right-color:"+o.getPropertyValue("border-right-color")+";border-bottom-color:"+o.getPropertyValue("border-bottom-color")+";border-left-color:"+o.getPropertyValue("border-left-color")+";border-top-width:"+o.getPropertyValue("border-top-width")+";border-right-width:"+o.getPropertyValue("border-right-width")+";border-bottom-width:"+o.getPropertyValue("border-bottom-width")+";border-left-width:"+o.getPropertyValue("border-left-width")+";border-top-style:"+o.getPropertyValue("border-top-style")+";border-right-style:"+o.getPropertyValue("border-right-style")+";border-bottom-style:"+o.getPropertyValue("border-bottom-style")+";border-left-style:"+o.getPropertyValue("border-left-style")+";border-top-left-radius:"+o.getPropertyValue("border-top-left-radius")+";border-top-right-radius:"+o.getPropertyValue("border-top-right-radius")+";border-bottom-left-radius:"+o.getPropertyValue("border-bottom-left-radius")+";border-bottom-right-radius:"+o.getPropertyValue("border-bottom-right-radius")+";padding-top:"+o.getPropertyValue("padding-top")+";padding-right:"+o.getPropertyValue("padding-right")+";padding-bottom:"+o.getPropertyValue("padding-bottom")+";padding-left:"+o.getPropertyValue("padding-left")+";line-height:"+o.getPropertyValue("height")+";height:"+o.getPropertyValue("height")+";display: flex;\n flex-direction: column;\n justify-content: center;}",d.id="wu-stripe-styles",document.body.appendChild(d),e.update({style:{base:{color:o.getPropertyValue("color"),fontFamily:o.getPropertyValue("font-family"),fontSize:o.getPropertyValue("font-size"),fontWeight:o.getPropertyValue("font-weight"),fontSmoothing:o.getPropertyValue("-webkit-font-smoothing")}}})}function wu_stripe_handle_intent(e,t,r){const o=function(e){wu_checkout_form.unblock(),e.error&&wu_checkout_form.errors.push(e.error)};try{_stripe[e](t,r).then((function(e){e.error?o(e):wu_checkout_form.resubmit()}),o)}catch(e){}}function handlePayment(e,t,r){if(!t.gateway.data.stripe_client_secret)return;const o="payment_intent"===t.gateway.data.stripe_intent_type?"confirmCardPayment":"confirmCardSetup",d={payment_method:"add-new"!==e.payment_method?e.payment_method:{card:r,billing_details:{name:t.customer.display_name,email:t.customer.user_email,address:{country:t.customer.billing_address_data.billing_country,postal_code:t.customer.billing_address_data.billing_zip_code}}}};wu_stripe_handle_intent(o,t.gateway.data.stripe_client_secret,d)}wp.hooks.addFilter("wu_before_form_init","nextpress/wp-ultimo",(function(e){return e.add_new_card=wu_stripe.add_new_card,e.payment_method=wu_stripe.payment_method,e})),wp.hooks.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(){stripeElement=stripeElements(wu_stripe.pk_key)}));
|
||||
@@ -0,0 +1,61 @@
|
||||
/* eslint-disable no-multi-str */
|
||||
/* global wu_gutenberg */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Filter that receives the content from the preview markup and make modifications to it.
|
||||
*
|
||||
* @param {*} content
|
||||
*/
|
||||
const custom_gutenberg_preview_message = function(content) {
|
||||
|
||||
content = content.replace(wp.i18n.__('Generating preview…'), wu_gutenberg.replacement_message);
|
||||
|
||||
const img = '<img class="wu-logo" src="' + wu_gutenberg.logo + '"><p>';
|
||||
|
||||
content = content.replace('<p>', img);
|
||||
|
||||
content += '<style> \
|
||||
svg { \
|
||||
display: none !important; \
|
||||
} \
|
||||
img.wu-logo { \
|
||||
opacity: 0; \
|
||||
animation: fade-in-right ease 1s forwards; \
|
||||
max-width: 100px; \
|
||||
height: auto; \
|
||||
padding: 20px; \
|
||||
} \
|
||||
@keyframes fade-in-right { \
|
||||
from { \
|
||||
opacity: 0; \
|
||||
transform: translateY(-15px); \
|
||||
} \
|
||||
to { \
|
||||
opacity: 1; \
|
||||
transform: translateY(0); \
|
||||
} \
|
||||
} \
|
||||
</style>';
|
||||
|
||||
return content;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the hooks are set to avoid bugs and breaking other scripts.
|
||||
*/
|
||||
if (typeof wp === 'object' && typeof wp.hooks === 'object') {
|
||||
|
||||
/**
|
||||
* Pass as a wp hook
|
||||
*/
|
||||
wp.hooks.addFilter('editor.PostPreview.interstitialMarkup', 'wp-ultimo/custom-preview-message', custom_gutenberg_preview_message);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
jQuery(document).ready((function(){const e=function(e){e=e.replace(wp.i18n.__("Generating preview…"),wu_gutenberg.replacement_message);const t='<img class="wu-logo" src="'+wu_gutenberg.logo+'"><p>';return e=e.replace("<p>",t),e+="<style> svg { display: none !important; } img.wu-logo { opacity: 0; animation: fade-in-right ease 1s forwards; max-width: 100px; height: auto; padding: 20px; } @keyframes fade-in-right { from { opacity: 0; transform: translateY(-15px); } to { opacity: 1; transform: translateY(0); } } </style>"};"object"==typeof wp&&"object"==typeof wp.hooks&&wp.hooks.addFilter("editor.PostPreview.interstitialMarkup","wp-ultimo/custom-preview-message",e)}));
|
||||
@@ -0,0 +1,165 @@
|
||||
/* eslint-disable no-undef */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// Adds WUChosen.js to our custom select input
|
||||
const $jumper = $('#wu-jumper-select').selectize({
|
||||
create: false,
|
||||
maxItems: 1,
|
||||
optgroupField: 'group',
|
||||
optgroupValueField: 'value',
|
||||
searchField: ['text', 'name', 'display_name', 'domain', 'title', 'desc', 'code'],
|
||||
render: {
|
||||
option(option) {
|
||||
|
||||
if (typeof option.model === 'undefined') {
|
||||
|
||||
option.model = 'jumper-link';
|
||||
|
||||
} // end if;
|
||||
|
||||
if (typeof option.text === 'undefined') {
|
||||
|
||||
option.text = option.reference_code || option.name || option.title || option.display_name || option.code;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (typeof option.group === 'undefined') {
|
||||
|
||||
option.group = option.model;
|
||||
|
||||
} // end if;
|
||||
|
||||
const template_html = jQuery('#wu-template-' + option.model).length ?
|
||||
jQuery('#wu-template-' + option.model).html() :
|
||||
jQuery('#wu-template-default').html();
|
||||
|
||||
const template = _.template(template_html, {
|
||||
interpolate: /\{\{(.+?)\}\}/g,
|
||||
});
|
||||
|
||||
return template(option);
|
||||
|
||||
},
|
||||
},
|
||||
load(query, callback) {
|
||||
|
||||
if (! query.length) {
|
||||
|
||||
return callback();
|
||||
|
||||
} // end if;
|
||||
|
||||
$('#wu-jumper .wu-jumper-loading').show();
|
||||
|
||||
jQuery.ajax({
|
||||
// eslint-disable-next-line no-undef
|
||||
url: wu_jumper_vars.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wu_search',
|
||||
model: 'all',
|
||||
number: 99,
|
||||
query: {
|
||||
search: '*' + query + '*',
|
||||
},
|
||||
},
|
||||
error() {
|
||||
|
||||
callback();
|
||||
|
||||
},
|
||||
success(res) {
|
||||
|
||||
$('#wu-jumper .wu-jumper-loading').hide();
|
||||
|
||||
callback(res);
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
const is_local_url = function(url) {
|
||||
|
||||
return url.toLowerCase().indexOf(wu_jumper_vars.base_url) >= 0 || url.toLowerCase().indexOf(wu_jumper_vars.network_base_url) >= 0;
|
||||
|
||||
}; // end is_local_url
|
||||
|
||||
// Every time the value changes, we need to redirect the user
|
||||
$jumper.on('change', function() {
|
||||
|
||||
// Check if we need to open this in a new tab
|
||||
if (is_local_url($(this).val())) {
|
||||
|
||||
window.location.href = $(this).val();
|
||||
|
||||
$(this).parent().parent().find('.wu-jumper-redirecting').show();
|
||||
|
||||
} else {
|
||||
|
||||
window.open($(this).val(), '_blank');
|
||||
|
||||
$($jumper.parent()).hide();
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
// Closes on clicking other elements
|
||||
$(document).on('click', ':not(#wu-jumper-button-trigger)', function(e) {
|
||||
|
||||
const target = e.target;
|
||||
|
||||
if ($(target).attr('id') === 'wu-jumper-button-trigger' || $(target).parent().attr('id') === 'wu-jumper-button-trigger') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (! $(target).is($jumper.parent()) && ! $(target).parents().is($jumper.parent())) {
|
||||
|
||||
$($jumper.parent().parent()).hide();
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
const trigger_key = wu_jumper_vars.trigger_key.charAt(0);
|
||||
|
||||
// Our bar is hidden by default, we need to display it when a certain shortcut is pressed
|
||||
Mousetrap.bind(['command+option+' + trigger_key, 'ctrl+alt+' + trigger_key], function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
open_jumper();
|
||||
|
||||
}); // end mousetrap;
|
||||
|
||||
$(document).on('click', '#wu-jumper-button-trigger', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
open_jumper();
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Actually opens the jumper.
|
||||
*/
|
||||
function open_jumper() {
|
||||
|
||||
$('#wu-jumper').show();
|
||||
|
||||
$('#wu-jumper').find('input').focus();
|
||||
|
||||
return false;
|
||||
|
||||
} // end open_jumper;
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){const t=e("#wu-jumper-select").selectize({create:!1,maxItems:1,optgroupField:"group",optgroupValueField:"value",searchField:["text","name","display_name","domain","title","desc","code"],render:{option(e){void 0===e.model&&(e.model="jumper-link"),void 0===e.text&&(e.text=e.reference_code||e.name||e.title||e.display_name||e.code),void 0===e.group&&(e.group=e.model);const t=jQuery("#wu-template-"+e.model).length?jQuery("#wu-template-"+e.model).html():jQuery("#wu-template-default").html();return _.template(t,{interpolate:/\{\{(.+?)\}\}/g})(e)}},load(t,r){if(!t.length)return r();e("#wu-jumper .wu-jumper-loading").show(),jQuery.ajax({url:wu_jumper_vars.ajaxurl,type:"POST",data:{action:"wu_search",model:"all",number:99,query:{search:"*"+t+"*"}},error(){r()},success(t){e("#wu-jumper .wu-jumper-loading").hide(),r(t)}})}});t.on("change",(function(){var r;(r=e(this).val()).toLowerCase().indexOf(wu_jumper_vars.base_url)>=0||r.toLowerCase().indexOf(wu_jumper_vars.network_base_url)>=0?(window.location.href=e(this).val(),e(this).parent().parent().find(".wu-jumper-redirecting").show()):(window.open(e(this).val(),"_blank"),e(t.parent()).hide())})),e(document).on("click",":not(#wu-jumper-button-trigger)",(function(r){const u=r.target;"wu-jumper-button-trigger"!==e(u).attr("id")&&"wu-jumper-button-trigger"!==e(u).parent().attr("id")&&(e(u).is(t.parent())||e(u).parents().is(t.parent())||e(t.parent().parent()).hide())}));const r=wu_jumper_vars.trigger_key.charAt(0);function u(){return e("#wu-jumper").show(),e("#wu-jumper").find("input").focus(),!1}Mousetrap.bind(["command+option+"+r,"ctrl+alt+"+r],(function(e){e.preventDefault(),u()})),e(document).on("click","#wu-jumper-button-trigger",(function(e){e.preventDefault(),u()}))}))}(jQuery);
|
||||
@@ -0,0 +1,13 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
const { addFilter } = window.wp.hooks;
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
addFilter("wu_before_form_init", "nextpress/wp-ultimo", (data) => {
|
||||
if (typeof data !== "undefined") {
|
||||
data.billing_option = 1;
|
||||
data.default_billing_option = 12;
|
||||
}
|
||||
return data;
|
||||
});
|
||||
});
|
||||
})()
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";const{addFilter:o}=window.wp.hooks;document.addEventListener("DOMContentLoaded",(()=>{o("wu_before_form_init","nextpress/wp-ultimo",(o=>(void 0!==o&&(o.billing_option=1,o.default_billing_option=12),o)))}))})();
|
||||
@@ -0,0 +1,413 @@
|
||||
/*!
|
||||
* accounting.js v0.4.2
|
||||
* Copyright 2014 Open Exchange Rates
|
||||
*
|
||||
* Freely distributable under the MIT license.
|
||||
* Portions of accounting.js are inspired or borrowed from underscore.js
|
||||
*
|
||||
* Full details and documentation:
|
||||
* http://openexchangerates.github.io/accounting.js/
|
||||
*/
|
||||
|
||||
(function(root, undefined) {
|
||||
|
||||
/* --- Setup --- */
|
||||
|
||||
// Create the local library object, to be exported or referenced globally later
|
||||
var lib = {};
|
||||
|
||||
// Current version
|
||||
lib.version = '0.4.1';
|
||||
|
||||
|
||||
/* --- Exposed settings --- */
|
||||
|
||||
// The library's settings configuration object. Contains default parameters for
|
||||
// currency and number formatting
|
||||
lib.settings = {
|
||||
currency: {
|
||||
symbol : "$", // default currency symbol is '$'
|
||||
format : "%s%v", // controls output: %s = symbol, %v = value (can be object, see docs)
|
||||
decimal : ".", // decimal point separator
|
||||
thousand : ",", // thousands separator
|
||||
precision : 2, // decimal places
|
||||
grouping : 3 // digit grouping (not implemented yet)
|
||||
},
|
||||
number: {
|
||||
precision : 0, // default precision on numbers is 0
|
||||
grouping : 3, // digit grouping (not implemented yet)
|
||||
thousand : ",",
|
||||
decimal : "."
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* --- Internal Helper Methods --- */
|
||||
|
||||
// Store reference to possibly-available ECMAScript 5 methods for later
|
||||
var nativeMap = Array.prototype.map,
|
||||
nativeIsArray = Array.isArray,
|
||||
toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Tests whether supplied parameter is a string
|
||||
* from underscore.js
|
||||
*/
|
||||
function isString(obj) {
|
||||
return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether supplied parameter is a string
|
||||
* from underscore.js, delegates to ECMA5's native Array.isArray
|
||||
*/
|
||||
function isArray(obj) {
|
||||
return nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether supplied parameter is a true object
|
||||
*/
|
||||
function isObject(obj) {
|
||||
return obj && toString.call(obj) === '[object Object]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends an object with a defaults object, similar to underscore's _.defaults
|
||||
*
|
||||
* Used for abstracting parameter handling from API methods
|
||||
*/
|
||||
function defaults(object, defs) {
|
||||
var key;
|
||||
object = object || {};
|
||||
defs = defs || {};
|
||||
// Iterate over object non-prototype properties:
|
||||
for (key in defs) {
|
||||
if (defs.hasOwnProperty(key)) {
|
||||
// Replace values with defaults only if undefined (allow empty/zero values):
|
||||
if (object[key] == null) object[key] = defs[key];
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `Array.map()` for iteration loops
|
||||
*
|
||||
* Returns a new Array as a result of calling `iterator` on each array value.
|
||||
* Defers to native Array.map if available
|
||||
*/
|
||||
function map(obj, iterator, context) {
|
||||
var results = [], i, j;
|
||||
|
||||
if (!obj) return results;
|
||||
|
||||
// Use native .map method if it exists:
|
||||
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
|
||||
|
||||
// Fallback for native .map:
|
||||
for (i = 0, j = obj.length; i < j; i++ ) {
|
||||
results[i] = iterator.call(context, obj[i], i, obj);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and normalise the value of precision (must be positive integer)
|
||||
*/
|
||||
function checkPrecision(val, base) {
|
||||
val = Math.round(Math.abs(val));
|
||||
return isNaN(val)? base : val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses a format string or object and returns format obj for use in rendering
|
||||
*
|
||||
* `format` is either a string with the default (positive) format, or object
|
||||
* containing `pos` (required), `neg` and `zero` values (or a function returning
|
||||
* either a string or object)
|
||||
*
|
||||
* Either string or format.pos must contain "%v" (value) to be valid
|
||||
*/
|
||||
function checkCurrencyFormat(format) {
|
||||
var defaults = lib.settings.currency.format;
|
||||
|
||||
// Allow function as format parameter (should return string or object):
|
||||
if ( typeof format === "function" ) format = format();
|
||||
|
||||
// Format can be a string, in which case `value` ("%v") must be present:
|
||||
if ( isString( format ) && format.match("%v") ) {
|
||||
|
||||
// Create and return positive, negative and zero formats:
|
||||
return {
|
||||
pos : format,
|
||||
neg : format.replace("-", "").replace("%v", "-%v"),
|
||||
zero : format
|
||||
};
|
||||
|
||||
// If no format, or object is missing valid positive value, use defaults:
|
||||
} else if ( !format || !format.pos || !format.pos.match("%v") ) {
|
||||
|
||||
// If defaults is a string, casts it to an object for faster checking next time:
|
||||
return ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = {
|
||||
pos : defaults,
|
||||
neg : defaults.replace("%v", "-%v"),
|
||||
zero : defaults
|
||||
};
|
||||
|
||||
}
|
||||
// Otherwise, assume format was fine:
|
||||
return format;
|
||||
}
|
||||
|
||||
|
||||
/* --- API Methods --- */
|
||||
|
||||
/**
|
||||
* Takes a string/array of strings, removes all formatting/cruft and returns the raw float value
|
||||
* Alias: `accounting.parse(string)`
|
||||
*
|
||||
* Decimal must be included in the regular expression to match floats (defaults to
|
||||
* accounting.settings.number.decimal), so if the number uses a non-standard decimal
|
||||
* separator, provide it as the second argument.
|
||||
*
|
||||
* Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)
|
||||
*
|
||||
* Doesn't throw any errors (`NaN`s become 0) but this may change in future
|
||||
*/
|
||||
var unformat = lib.unformat = lib.parse = function(value, decimal) {
|
||||
// Recursively unformat arrays:
|
||||
if (isArray(value)) {
|
||||
return map(value, function(val) {
|
||||
return unformat(val, decimal);
|
||||
});
|
||||
}
|
||||
|
||||
// Fails silently (need decent errors):
|
||||
value = value || 0;
|
||||
|
||||
// Return the value as-is if it's already a number:
|
||||
if (typeof value === "number") return value;
|
||||
|
||||
// Default decimal point comes from settings, but could be set to eg. "," in opts:
|
||||
decimal = decimal || lib.settings.number.decimal;
|
||||
|
||||
// Build regex to strip out everything except digits, decimal point and minus sign:
|
||||
var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]),
|
||||
unformatted = parseFloat(
|
||||
("" + value)
|
||||
.replace(/\((.*)\)/, "-$1") // replace bracketed values with negatives
|
||||
.replace(regex, '') // strip out any cruft
|
||||
.replace(decimal, '.') // make sure decimal point is standard
|
||||
);
|
||||
|
||||
// This will fail silently which may cause trouble, let's wait and see:
|
||||
return !isNaN(unformatted) ? unformatted : 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of toFixed() that treats floats more like decimals
|
||||
*
|
||||
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
|
||||
* problems for accounting- and finance-related software.
|
||||
*/
|
||||
var toFixed = lib.toFixed = function(value, precision) {
|
||||
precision = checkPrecision(precision, lib.settings.number.precision);
|
||||
var power = Math.pow(10, precision);
|
||||
|
||||
// Multiply up by precision, round accurately, then divide and use native toFixed():
|
||||
return (Math.round(lib.unformat(value) * power) / power).toFixed(precision);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format a number, with comma-separated thousands and custom precision/decimal places
|
||||
* Alias: `accounting.format()`
|
||||
*
|
||||
* Localise by overriding the precision and thousand / decimal separators
|
||||
* 2nd parameter `precision` can be an object matching `settings.number`
|
||||
*/
|
||||
var formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) {
|
||||
// Resursively format arrays:
|
||||
if (isArray(number)) {
|
||||
return map(number, function(val) {
|
||||
return formatNumber(val, precision, thousand, decimal);
|
||||
});
|
||||
}
|
||||
|
||||
// Clean up number:
|
||||
number = unformat(number);
|
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults(
|
||||
(isObject(precision) ? precision : {
|
||||
precision : precision,
|
||||
thousand : thousand,
|
||||
decimal : decimal
|
||||
}),
|
||||
lib.settings.number
|
||||
),
|
||||
|
||||
// Clean up precision
|
||||
usePrecision = checkPrecision(opts.precision),
|
||||
|
||||
// Do some calc:
|
||||
negative = number < 0 ? "-" : "",
|
||||
base = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + "",
|
||||
mod = base.length > 3 ? base.length % 3 : 0;
|
||||
|
||||
// Format the number:
|
||||
return negative + (mod ? base.substr(0, mod) + opts.thousand : "") + base.substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : "");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format a number into currency
|
||||
*
|
||||
* Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)
|
||||
* defaults: (0, "$", 2, ",", ".", "%s%v")
|
||||
*
|
||||
* Localise by overriding the symbol, precision, thousand / decimal separators and format
|
||||
* Second param can be an object matching `settings.currency` which is the easiest way.
|
||||
*
|
||||
* To do: tidy up the parameters
|
||||
*/
|
||||
var formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {
|
||||
// Resursively format arrays:
|
||||
if (isArray(number)) {
|
||||
return map(number, function(val){
|
||||
return formatMoney(val, symbol, precision, thousand, decimal, format);
|
||||
});
|
||||
}
|
||||
|
||||
// Clean up number:
|
||||
number = unformat(number);
|
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults(
|
||||
(isObject(symbol) ? symbol : {
|
||||
symbol : symbol,
|
||||
precision : precision,
|
||||
thousand : thousand,
|
||||
decimal : decimal,
|
||||
format : format
|
||||
}),
|
||||
lib.settings.currency
|
||||
),
|
||||
|
||||
// Check format (returns object with pos, neg and zero):
|
||||
formats = checkCurrencyFormat(opts.format),
|
||||
|
||||
// Choose which format to use for this value:
|
||||
useFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero;
|
||||
|
||||
// Return with currency symbol added:
|
||||
return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format a list of numbers into an accounting column, padding with whitespace
|
||||
* to line up currency symbols, thousand separators and decimals places
|
||||
*
|
||||
* List should be an array of numbers
|
||||
* Second parameter can be an object containing keys that match the params
|
||||
*
|
||||
* Returns array of accouting-formatted number strings of same length
|
||||
*
|
||||
* NB: `white-space:pre` CSS rule is required on the list container to prevent
|
||||
* browsers from collapsing the whitespace in the output strings.
|
||||
*/
|
||||
lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {
|
||||
if (!list) return [];
|
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults(
|
||||
(isObject(symbol) ? symbol : {
|
||||
symbol : symbol,
|
||||
precision : precision,
|
||||
thousand : thousand,
|
||||
decimal : decimal,
|
||||
format : format
|
||||
}),
|
||||
lib.settings.currency
|
||||
),
|
||||
|
||||
// Check format (returns object with pos, neg and zero), only need pos for now:
|
||||
formats = checkCurrencyFormat(opts.format),
|
||||
|
||||
// Whether to pad at start of string or after currency symbol:
|
||||
padAfterSymbol = formats.pos.indexOf("%s") < formats.pos.indexOf("%v") ? true : false,
|
||||
|
||||
// Store value for the length of the longest string in the column:
|
||||
maxLength = 0,
|
||||
|
||||
// Format the list according to options, store the length of the longest string:
|
||||
formatted = map(list, function(val, i) {
|
||||
if (isArray(val)) {
|
||||
// Recursively format columns if list is a multi-dimensional array:
|
||||
return lib.formatColumn(val, opts);
|
||||
} else {
|
||||
// Clean up the value
|
||||
val = unformat(val);
|
||||
|
||||
// Choose which format to use for this value (pos, neg or zero):
|
||||
var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,
|
||||
|
||||
// Format this value, push into formatted list and save the length:
|
||||
fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));
|
||||
|
||||
if (fVal.length > maxLength) maxLength = fVal.length;
|
||||
return fVal;
|
||||
}
|
||||
});
|
||||
|
||||
// Pad each number in the list and send back the column of numbers:
|
||||
return map(formatted, function(val, i) {
|
||||
// Only if this is a string (not a nested array, which would have already been padded):
|
||||
if (isString(val) && val.length < maxLength) {
|
||||
// Depending on symbol position, pad after symbol or at index 0:
|
||||
return padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(" "))) : (new Array(maxLength - val.length + 1).join(" ")) + val;
|
||||
}
|
||||
return val;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* --- Module Definition --- */
|
||||
|
||||
// Export accounting for CommonJS. If being loaded as an AMD module, define it as such.
|
||||
// Otherwise, just add `accounting` to the global object
|
||||
if (typeof exports !== 'undefined') {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
exports = module.exports = lib;
|
||||
}
|
||||
exports.accounting = lib;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// Return the library as an AMD module:
|
||||
define([], function() {
|
||||
return lib;
|
||||
});
|
||||
} else {
|
||||
// Use accounting.noConflict to restore `accounting` back to its original value.
|
||||
// Returns a reference to the library's `accounting` object;
|
||||
// e.g. `var numbers = accounting.noConflict();`
|
||||
lib.noConflict = (function(oldAccounting) {
|
||||
return function() {
|
||||
// Reset the value of the root's `accounting` variable:
|
||||
root.accounting = oldAccounting;
|
||||
// Delete the noConflict method:
|
||||
lib.noConflict = undefined;
|
||||
// Return reference to the library to re-assign it:
|
||||
return lib;
|
||||
};
|
||||
})(root.accounting);
|
||||
|
||||
// Declare `fx` on the root (global/window) object:
|
||||
root['accounting'] = lib;
|
||||
}
|
||||
|
||||
// Root will be `window` in browser or `global` on the server:
|
||||
}(this));
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* accounting.js v0.4.2
|
||||
* Copyright 2014 Open Exchange Rates
|
||||
*
|
||||
* Freely distributable under the MIT license.
|
||||
* Portions of accounting.js are inspired or borrowed from underscore.js
|
||||
*
|
||||
* Full details and documentation:
|
||||
* http://openexchangerates.github.io/accounting.js/
|
||||
*/
|
||||
!function(n,r){var e={version:"0.4.1",settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},t=Array.prototype.map,o=Array.isArray,a=Object.prototype.toString;function i(n){return!!(""===n||n&&n.charCodeAt&&n.substr)}function u(n){return o?o(n):"[object Array]"===a.call(n)}function c(n){return n&&"[object Object]"===a.call(n)}function s(n,r){var e;for(e in n=n||{},r=r||{})r.hasOwnProperty(e)&&null==n[e]&&(n[e]=r[e]);return n}function f(n,r,e){var o,a,i=[];if(!n)return i;if(t&&n.map===t)return n.map(r,e);for(o=0,a=n.length;o<a;o++)i[o]=r.call(e,n[o],o,n);return i}function p(n,r){return n=Math.round(Math.abs(n)),isNaN(n)?r:n}function l(n){var r=e.settings.currency.format;return"function"==typeof n&&(n=n()),i(n)&&n.match("%v")?{pos:n,neg:n.replace("-","").replace("%v","-%v"),zero:n}:n&&n.pos&&n.pos.match("%v")?n:i(r)?e.settings.currency.format={pos:r,neg:r.replace("%v","-%v"),zero:r}:r}var m,d=e.unformat=e.parse=function(n,r){if(u(n))return f(n,(function(n){return d(n,r)}));if("number"==typeof(n=n||0))return n;r=r||e.settings.number.decimal;var t=new RegExp("[^0-9-"+r+"]",["g"]),o=parseFloat((""+n).replace(/\((.*)\)/,"-$1").replace(t,"").replace(r,"."));return isNaN(o)?0:o},g=e.toFixed=function(n,r){r=p(r,e.settings.number.precision);var t=Math.pow(10,r);return(Math.round(e.unformat(n)*t)/t).toFixed(r)},h=e.formatNumber=e.format=function(n,r,t,o){if(u(n))return f(n,(function(n){return h(n,r,t,o)}));n=d(n);var a=s(c(r)?r:{precision:r,thousand:t,decimal:o},e.settings.number),i=p(a.precision),l=n<0?"-":"",m=parseInt(g(Math.abs(n||0),i),10)+"",y=m.length>3?m.length%3:0;return l+(y?m.substr(0,y)+a.thousand:"")+m.substr(y).replace(/(\d{3})(?=\d)/g,"$1"+a.thousand)+(i?a.decimal+g(Math.abs(n),i).split(".")[1]:"")},y=e.formatMoney=function(n,r,t,o,a,i){if(u(n))return f(n,(function(n){return y(n,r,t,o,a,i)}));n=d(n);var m=s(c(r)?r:{symbol:r,precision:t,thousand:o,decimal:a,format:i},e.settings.currency),g=l(m.format);return(n>0?g.pos:n<0?g.neg:g.zero).replace("%s",m.symbol).replace("%v",h(Math.abs(n),p(m.precision),m.thousand,m.decimal))};e.formatColumn=function(n,r,t,o,a,m){if(!n)return[];var g=s(c(r)?r:{symbol:r,precision:t,thousand:o,decimal:a,format:m},e.settings.currency),y=l(g.format),b=y.pos.indexOf("%s")<y.pos.indexOf("%v"),v=0,x=f(n,(function(n,r){if(u(n))return e.formatColumn(n,g);var t=((n=d(n))>0?y.pos:n<0?y.neg:y.zero).replace("%s",g.symbol).replace("%v",h(Math.abs(n),p(g.precision),g.thousand,g.decimal));return t.length>v&&(v=t.length),t}));return f(x,(function(n,r){return i(n)&&n.length<v?b?n.replace(g.symbol,g.symbol+new Array(v-n.length+1).join(" ")):new Array(v-n.length+1).join(" ")+n:n}))},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.accounting=e):"function"==typeof define&&define.amd?define([],(function(){return e})):(e.noConflict=(m=n.accounting,function(){return n.accounting=m,e.noConflict=void 0,e}),n.accounting=e)}(this);
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ApexCharts v3.6.3
|
||||
* (c) 2018-2019 Juned Chhipa
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ApexCharts=e()}(this,function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function s(t,e,s){return e&&i(t.prototype,e),s&&i(t,s),t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function n(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},s=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(i).filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable}))),s.forEach(function(e){a(t,e,i[e])})}return t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var d=function(){function i(){e(this,i)}return s(i,[{key:"shadeRGBColor",value:function(t,e){var i=e.split(","),s=t<0?0:255,a=t<0?-1*t:t,n=parseInt(i[0].slice(4)),r=parseInt(i[1]),o=parseInt(i[2]);return"rgb("+(Math.round((s-n)*a)+n)+","+(Math.round((s-r)*a)+r)+","+(Math.round((s-o)*a)+o)+")"}},{key:"shadeHexColor",value:function(t,e){var i=parseInt(e.slice(1),16),s=t<0?0:255,a=t<0?-1*t:t,n=i>>16,r=i>>8&255,o=255&i;return"#"+(16777216+65536*(Math.round((s-n)*a)+n)+256*(Math.round((s-r)*a)+r)+(Math.round((s-o)*a)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(t,e){return e.length>7?this.shadeRGBColor(t,e):this.shadeHexColor(t,e)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(e){return e&&"object"===t(e)&&!Array.isArray(e)&&null!=e}},{key:"extend",value:function(t,e){var i=this;"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)s.hasOwnProperty(a)&&(e[a]=s[a])}return e});var s=Object.assign({},t);return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach(function(n){i.isObject(e[n])&&n in t?s[n]=i.extend(t[n],e[n]):Object.assign(s,a({},n,e[n]))}),s}},{key:"extendArray",value:function(t,e){var s=[];return t.map(function(t){s.push(i.extend(e,t))}),t=s}},{key:"monthMod",value:function(t){return t%12}},{key:"addProps",value:function(t,e,i){"string"==typeof e&&(e=e.split(".")),t[e[0]]=t[e[0]]||{};var s=t[e[0]];return e.length>1?(e.shift(),this.addProps(s,e,i)):t[e[0]]=i,t}},{key:"clone",value:function(e){if("[object Array]"===Object.prototype.toString.call(e)){for(var i=[],s=0;s<e.length;s++)i[s]=this.clone(e[s]);return i}if("object"===t(e)){var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=this.clone(e[n]));return a}return e}},{key:"log10",value:function(t){return Math.log(t)/Math.LN10}},{key:"roundToBase10",value:function(t){return Math.pow(10,Math.floor(Math.log10(t)))}},{key:"roundToBase",value:function(t,e){return Math.pow(e,Math.floor(Math.log(t)/Math.log(e)))}},{key:"parseNumber",value:function(t){return null===t?t:parseFloat(t)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t),i=[],s=t.clientHeight,a=t.clientWidth;return s-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),a-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),i.push(a),i.push(s),i}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height,x:e.x,y:e.y}}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"Line truncated
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* ApexCharts v3.6.3
|
||||
* (c) 2018-2019 Juned Chhipa
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ApexCharts=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function s(t,e,s){return e&&i(t.prototype,e),s&&i(t,s),t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function n(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},s=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(i).filter((function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})))),s.forEach((function(e){a(t,e,i[e])}))}return t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&function(t,e){(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var c=function(){function i(){e(this,i)}return s(i,[{key:"shadeRGBColor",value:function(t,e){var i=e.split(","),s=t<0?0:255,a=t<0?-1*t:t,n=parseInt(i[0].slice(4)),r=parseInt(i[1]),o=parseInt(i[2]);return"rgb("+(Math.round((s-n)*a)+n)+","+(Math.round((s-r)*a)+r)+","+(Math.round((s-o)*a)+o)+")"}},{key:"shadeHexColor",value:function(t,e){var i=parseInt(e.slice(1),16),s=t<0?0:255,a=t<0?-1*t:t,n=i>>16,r=i>>8&255,o=255&i;return"#"+(16777216+65536*(Math.round((s-n)*a)+n)+256*(Math.round((s-r)*a)+r)+(Math.round((s-o)*a)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(t,e){return e.length>7?this.shadeRGBColor(t,e):this.shadeHexColor(t,e)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(e){return e&&"object"===t(e)&&!Array.isArray(e)&&null!=e}},{key:"extend",value:function(t,e){var i=this;"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)s.hasOwnProperty(a)&&(e[a]=s[a])}return e});var s=Object.assign({},t);return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach((function(n){i.isObject(e[n])&&n in t?s[n]=i.extend(t[n],e[n]):Object.assign(s,a({},n,e[n]))})),s}},{key:"extendArray",value:function(t,e){var s=[];return t.map((function(t){s.push(i.extend(e,t))})),s}},{key:"monthMod",value:function(t){return t%12}},{key:"addProps",value:function(t,e,i){"string"==typeof e&&(e=e.split(".")),t[e[0]]=t[e[0]]||{};var s=t[e[0]];return e.length>1?(e.shift(),this.addProps(s,e,i)):t[e[0]]=i,t}},{key:"clone",value:function(e){if("[object Array]"===Object.prototype.toString.call(e)){for(var i=[],s=0;s<e.length;s++)i[s]=this.clone(e[s]);return i}if("object"===t(e)){var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=this.clone(e[n]));return a}return e}},{key:"log10",value:function(t){return Math.log(t)/Math.LN10}},{key:"roundToBase10",value:function(t){return Math.pow(10,Math.floor(Math.log10(t)))}},{key:"roundToBase",value:function(t,e){return Math.pow(e,Math.floor(Math.log(t)/Math.log(e)))}},{key:"parseNumber",value:function(t){return null===t?t:parseFloat(t)}},{key:"getDimensions",value:function(t){var e=getComputedStyle(t),i=[],s=t.clientHeight,a=t.clientWidth;return s-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),a-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),i.push(a),i.push(s),i}},{key:"getBoundingClientRect",value:function(t){var e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height,x:e.x,y:e.y}}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==tLine truncated
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
*
|
||||
* detectIncognito v22.01.x - (c) 2022 Joe Rutkowski <Joe@dreggle.com> (https://github.com/Joe12387/detectIncognito)
|
||||
*
|
||||
* Incognito & Private Browsing detection
|
||||
*
|
||||
* Support: Safari for iOS -- 8 to 15
|
||||
* Safari for macOS <= 15
|
||||
* Chrome/Chromium -- 50 to 96
|
||||
* Edge -- 15 - 18; 79 to 96
|
||||
* Firefox -- 44 to 95
|
||||
* MSIE >= 10
|
||||
*
|
||||
**/
|
||||
var detectIncognito = function (callback) {
|
||||
var browserName = "Unknown";
|
||||
|
||||
function __callback(isPrivate) {
|
||||
callback({
|
||||
isPrivate: isPrivate,
|
||||
browserName: browserName
|
||||
});
|
||||
}
|
||||
|
||||
function identifyChromium() {
|
||||
var ua = navigator.userAgent;
|
||||
if (ua.match(/Chrome/)) {
|
||||
if (ua.match(/Edg/)) {
|
||||
return "Edge"
|
||||
} else if (navigator.brave !== undefined) {
|
||||
return "Brave";
|
||||
} else if (navigator.opr !== undefined) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Chrome";
|
||||
} else {
|
||||
return "Chromium";
|
||||
}
|
||||
}
|
||||
|
||||
function assertEvalToString(value) {
|
||||
return value === eval.toString().length;
|
||||
}
|
||||
|
||||
function isSafari() {
|
||||
var v = navigator.vendor;
|
||||
return v !== undefined && v.indexOf("Apple") === 0 && assertEvalToString(37);
|
||||
}
|
||||
|
||||
function isChrome() {
|
||||
var v = navigator.vendor;
|
||||
return v !== undefined && v.indexOf("Google") === 0 && assertEvalToString(33);
|
||||
}
|
||||
|
||||
function isFirefox() {
|
||||
return document.documentElement !== undefined && document.documentElement.style.MozAppearance !== undefined && assertEvalToString(37);
|
||||
}
|
||||
|
||||
function isMSIE() {
|
||||
return navigator.msSaveBlob !== undefined && assertEvalToString(39);
|
||||
}
|
||||
|
||||
/**
|
||||
* Safari (Safari for iOS & macOS)
|
||||
**/
|
||||
|
||||
function macOS_safari14() {
|
||||
try {
|
||||
window.safari.pushNotification.requestPermission("https://example.com", "private", {}, (function () { }));
|
||||
} catch (e) {
|
||||
return __callback(!new RegExp("gesture").test(e));
|
||||
}
|
||||
return __callback(false);
|
||||
}
|
||||
|
||||
function iOS_safari14() {
|
||||
var tripped = false;
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.style.display = "none";
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
iframe.contentWindow.applicationCache.addEventListener("error", function () {
|
||||
tripped = true;
|
||||
return __callback(true);
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!tripped) {
|
||||
__callback(false);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function oldSafariTest() {
|
||||
var openDB = window.openDatabase;
|
||||
var storage = window.localStorage;
|
||||
try {
|
||||
openDB(null, null, null, null);
|
||||
} catch (e) {
|
||||
return __callback(true);
|
||||
}
|
||||
try {
|
||||
storage.setItem("test", "1");
|
||||
storage.removeItem("test");
|
||||
} catch (e) {
|
||||
return __callback(true);
|
||||
}
|
||||
return __callback(false);
|
||||
}
|
||||
|
||||
function safariPrivateTest() {
|
||||
var w = window;
|
||||
if (navigator.maxTouchPoints !== undefined) {
|
||||
if (w.safari !== undefined && w.DeviceMotionEvent === undefined) {
|
||||
browserName = "Safari for macOS";
|
||||
macOS_safari14();
|
||||
} else if (w.DeviceMotionEvent !== undefined) {
|
||||
browserName = "Safari for iOS";
|
||||
iOS_safari14();
|
||||
} else {
|
||||
throw new Error("detectIncognito Could not identify this version of Safari");
|
||||
}
|
||||
} else {
|
||||
oldSafariTest();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Chrome
|
||||
**/
|
||||
|
||||
function getQuotaLimit() {
|
||||
var w = window;
|
||||
if (w.performance !== undefined && w.performance.memory !== undefined && w.performance.memory.jsHeapSizeLimit !== undefined) {
|
||||
return performance.memory.jsHeapSizeLimit;
|
||||
}
|
||||
return 1073741824;
|
||||
}
|
||||
|
||||
// >= 76
|
||||
function storageQuotaChromePrivateTest() {
|
||||
navigator.webkitTemporaryStorage.queryUsageAndQuota(
|
||||
function (usage, quota) {
|
||||
__callback(quota < getQuotaLimit());
|
||||
},
|
||||
function (e) {
|
||||
throw new Error("detectIncognito somehow failed to query storage quota: " + e.message);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 50 to 75
|
||||
function oldChromePrivateTest() {
|
||||
var fs = window.webkitRequestFileSystem;
|
||||
var success = function () {
|
||||
__callback(false);
|
||||
};
|
||||
var error = function () {
|
||||
__callback(true);
|
||||
};
|
||||
fs(0, 1, success, error);
|
||||
}
|
||||
|
||||
function chromePrivateTest() {
|
||||
if (Promise !== undefined && Promise.allSettled !== undefined) {
|
||||
storageQuotaChromePrivateTest();
|
||||
} else {
|
||||
oldChromePrivateTest();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Firefox
|
||||
**/
|
||||
|
||||
function firefoxPrivateTest() {
|
||||
__callback(navigator.serviceWorker === undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIE
|
||||
**/
|
||||
|
||||
function msiePrivateTest() {
|
||||
__callback(window.indexedDB === undefined);
|
||||
}
|
||||
|
||||
function main() {
|
||||
if (isSafari()) {
|
||||
safariPrivateTest();
|
||||
} else if (isChrome()) {
|
||||
browserName = identifyChromium();
|
||||
chromePrivateTest();
|
||||
} else if (isFirefox()) {
|
||||
browserName = "Firefox";
|
||||
firefoxPrivateTest();
|
||||
} else if (isMSIE()) {
|
||||
browserName = "Internet Explorer";
|
||||
msiePrivateTest();
|
||||
} else {
|
||||
throw new Error("detectIncognito cannot determine the browser");
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
};
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
var detectIncognito=function(e){var o="Unknown";function n(n){e({isPrivate:n,browserName:o})}function t(e){return e===eval.toString().length}function i(){var e,t,i=window;if(void 0!==navigator.maxTouchPoints)if(void 0!==i.safari&&void 0===i.DeviceMotionEvent)o="Safari for macOS",function(){try{window.safari.pushNotification.requestPermission("https://example.com","private",{},(function(){}))}catch(e){return n(!new RegExp("gesture").test(e))}n(!1)}();else{if(void 0===i.DeviceMotionEvent)throw new Error("detectIncognito Could not identify this version of Safari");o="Safari for iOS",e=!1,(t=document.createElement("iframe")).style.display="none",document.body.appendChild(t),t.contentWindow.applicationCache.addEventListener("error",(function(){return e=!0,n(!0)})),setTimeout((function(){e||n(!1)}),100)}else!function(){var e=window.openDatabase,o=window.localStorage;try{e(null,null,null,null)}catch(e){return n(!0)}try{o.setItem("test","1"),o.removeItem("test")}catch(e){return n(!0)}n(!1)}()}function r(){navigator.webkitTemporaryStorage.queryUsageAndQuota((function(e,o){var t;n(o<(void 0!==(t=window).performance&&void 0!==t.performance.memory&&void 0!==t.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824))}),(function(e){throw new Error("detectIncognito somehow failed to query storage quota: "+e.message)}))}function a(){void 0!==Promise&&void 0!==Promise.allSettled?r():(0,window.webkitRequestFileSystem)(0,1,(function(){n(!1)}),(function(){n(!0)}))}!function(){if(void 0!==(r=navigator.vendor)&&0===r.indexOf("Apple")&&t(37))i();else if(function(){var e=navigator.vendor;return void 0!==e&&0===e.indexOf("Google")&&t(33)}())e=navigator.userAgent,o=e.match(/Chrome/)?e.match(/Edg/)?"Edge":void 0!==navigator.brave?"Brave":void 0!==navigator.opr?"Opera":"Chrome":"Chromium",a();else if(void 0!==document.documentElement&&void 0!==document.documentElement.style.MozAppearance&&t(37))o="Firefox",n(void 0===navigator.serviceWorker);else{if(void 0===navigator.msSaveBlob||!t(39))throw new Error("detectIncognito cannot determine the browser");o="Internet Explorer",n(void 0===window.indexedDB)}var e,r}()};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*!
|
||||
* @overview es6-promise - a tiny implementation of Promises/A+.
|
||||
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
||||
* @license Licensed under MIT license
|
||||
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
||||
* @version v4.2.8+1e68dce6
|
||||
* @link https://github.com/stefanpenner/es6-promise
|
||||
*/
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<N;t+=2){var e=Q[t],n=Q[t+1];e(n),Q[t]=void 0,Q[t+1]=void 0}N=0}function f(){try{var t=Function("return this")().require("vertx");return U=t.runOnLoop||t.runOnContext,i()}catch(e){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[V]&&x(r);var o=n._state;if(o){var i=arguments[o-1];z(function(){return T(o,r,i,n._result)})}else j(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return w(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function y(t,e,n){z(function(t){var r=!1,o=_(n,e,function(n){r||(r=!0,e!==n?w(t,n):A(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,S(t,o))},t)}function m(t,e){e._state===Z?A(t,e._result):e._state===$?S(t,e._result):j(e,void 0,function(e){return w(t,e)},function(e){return S(t,e)})}function b(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?m(t,n):void 0===r?A(t,n):e(r)?y(t,n,r):A(t,n)}function w(e,n){if(e===n)S(e,v());else if(t(n)){var r=void 0;try{r=n.then}catch(o){return void S(e,o)}b(e,n,r)}else A(e,n)}function g(t){t._onerror&&t._onerror(t._result),E(t)}function A(t,e){t._state===X&&(t._result=e,t._state=Z,0!==t._subscribers.length&&z(E,t))}function S(t,e){t._state===X&&(t._state=$,t._result=e,z(g,t))}function j(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Z]=n,o[i+$]=r,0===i&&t._state&&z(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?T(n,r,o,i):o(i);t._subscribers.length=0}}function T(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=!0;if(i){try{s=r(o)}catch(a){c=!1,u=a}if(n===s)return void S(n,d())}else s=o;n._state!==X||(i&&c?w(n,s):c===!1?S(n,u):t===Z?A(n,s):t===$&&S(n,s))}function M(t,e){try{e(function(e){w(t,e)},function(e){S(t,e)})}catch(n){S(t,n)}}function P(){return tt++}function x(t){t[V]=tt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function C(){return new Error("Array Methods must be provided an Array")}function O(t){return new et(this,t).promise}function k(t){var e=this;return new e(L(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return S(n,t),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=nt}var K=void 0;K=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var L=K,N=0,U=void 0,W=void 0,z=function(t,e){Q[N]=t,Q[N+1]=e,N+=2,2===N&&(W?W(a):R())},B="undefined"!=typeof window?window:void 0,G=B||{},H=G.MutationObserver||G.WebKitMutationObserver,I="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),R=void 0;R=I?o():H?s():J?u():void 0===B&&"function"==typeof require?f():c();var V=Math.random().toString(36).substring(2),X=void 0,Z=1,$=2,tt=0,et=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[V]||x(this.promise),L(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&A(this.promise,this._resulLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/* flatpickr v4.6.3, @license MIT */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).flatpickr=t()}(this,(function(){"use strict";
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n={_disable:[],_enable:[],allowInput:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enable:[],enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},a={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},i=function(e){return("0"+e).slice(-2)},o=function(e){return!0===e?1:0};function r(e,t,n){var a;return void 0===n&&(n=!1),function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout((function(){a=null,n||e.apply(i,o)}),t),n&&!a&&e.apply(i,o)}}var l=function(e){return e instanceof Array?e:[e]};function c(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function d(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function s(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function u(e,t){var n=d("div","numInputWrapper"),a=d("input","numInput "+e),i=d("span","arrowUp"),o=d("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==t)for(var r in t)a.setAttribute(r,t[r]);return n.appendChild(a),n.appendChild(i),n.appendChild(o),n}var f=function(){},m=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},g={D:f,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*o(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var a=parseInt(t),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+n.firstDayOfWeek),i},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:f,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:f,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},p={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",Line truncated
|
||||
@@ -0,0 +1,622 @@
|
||||
/*!
|
||||
* jQuery blockUI plugin
|
||||
* Version 2.70.0-2014.11.23
|
||||
* Requires jQuery v1.7 or later
|
||||
*
|
||||
* This was heavily modified to make use of the new jQuery apis and remove deprecated code.
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/block/
|
||||
* Copyright (c) 2007-2013 M. Alsup
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
/*jshint eqeqeq:false curly:false latedef:false */
|
||||
"use strict";
|
||||
|
||||
function setup($) {
|
||||
$.fn._fadeIn = $.fn.fadeIn;
|
||||
|
||||
var noOp = $.noop || function() {};
|
||||
|
||||
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
|
||||
// confusing userAgent strings on Vista)
|
||||
var msie = /MSIE/.test(navigator.userAgent);
|
||||
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
|
||||
var mode = document.documentMode || 0;
|
||||
var setExpr = typeof document.createElement('div').style.setExpression === "function";
|
||||
|
||||
// global $ methods for blocking/unblocking the entire page
|
||||
$.blockUI = function(opts) { install(window, opts); };
|
||||
$.unblockUI = function(opts) { remove(window, opts); };
|
||||
|
||||
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
|
||||
$.growlUI = function(title, message, timeout, onClose) {
|
||||
var $m = $('<div class="growlUI"></div>');
|
||||
if (title) $m.append('<h1>'+title+'</h1>');
|
||||
if (message) $m.append('<h2>'+message+'</h2>');
|
||||
if (timeout === undefined) timeout = 3000;
|
||||
|
||||
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
|
||||
var callBlock = function(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
$.blockUI({
|
||||
message: $m,
|
||||
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
|
||||
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
|
||||
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
|
||||
centerY: false,
|
||||
showOverlay: false,
|
||||
onUnblock: onClose,
|
||||
css: $.blockUI.defaults.growlCSS
|
||||
});
|
||||
};
|
||||
|
||||
callBlock();
|
||||
var nonmousedOpacity = $m.css('opacity');
|
||||
$m.mouseover(function() {
|
||||
callBlock({
|
||||
fadeIn: 0,
|
||||
timeout: 30000
|
||||
});
|
||||
|
||||
var displayBlock = $('.blockMsg');
|
||||
displayBlock.stop(); // cancel fadeout if it has started
|
||||
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
|
||||
}).mouseout(function() {
|
||||
$('.blockMsg').fadeOut(1000);
|
||||
});
|
||||
// End konapun additions
|
||||
};
|
||||
|
||||
// plugin method for blocking element content
|
||||
$.fn.wu_block = function(opts) {
|
||||
if ( this[0] === window ) {
|
||||
$.blockUI( opts );
|
||||
return this;
|
||||
}
|
||||
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
this.each(function() {
|
||||
var $el = $(this);
|
||||
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
|
||||
return;
|
||||
$el.wu_unblock({ fadeOut: 0 });
|
||||
});
|
||||
|
||||
return this.each(function() {
|
||||
if ($.css(this,'position') == 'static') {
|
||||
this.style.position = 'relative';
|
||||
$(this).data('blockUI.static', true);
|
||||
}
|
||||
this.style.zoom = 1; // force 'hasLayout' in ie
|
||||
install(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
// plugin method for unblocking element content
|
||||
$.fn.wu_unblock = function(opts) {
|
||||
if ( this[0] === window ) {
|
||||
$.unblockUI( opts );
|
||||
return this;
|
||||
}
|
||||
return this.each(function() {
|
||||
remove(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
$.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
|
||||
|
||||
// override these in your code to change the default behavior and style
|
||||
$.blockUI.defaults = {
|
||||
// message displayed when blocking (use null for no message)
|
||||
message: '<h1>Please wait...</h1>',
|
||||
|
||||
title: null, // title string; only used when theme == true
|
||||
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
|
||||
|
||||
theme: false, // set to true to use with jQuery UI themes
|
||||
|
||||
// styles for the message when blocking; if you wish to disable
|
||||
// these and use an external stylesheet then do this in your code:
|
||||
// $.blockUI.defaults.css = {};
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '30%',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: '3px solid #aaa',
|
||||
backgroundColor:'#fff',
|
||||
cursor: 'wait'
|
||||
},
|
||||
|
||||
// minimal style set used when themes are used
|
||||
themedCSS: {
|
||||
width: '30%',
|
||||
top: '40%',
|
||||
left: '35%'
|
||||
},
|
||||
|
||||
// styles for the overlay
|
||||
overlayCSS: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.6,
|
||||
cursor: 'wait'
|
||||
},
|
||||
|
||||
// style to replace wait cursor before unblocking to correct issue
|
||||
// of lingering wait cursor
|
||||
cursorReset: 'default',
|
||||
|
||||
// styles applied when using $.growlUI
|
||||
growlCSS: {
|
||||
width: '350px',
|
||||
top: '10px',
|
||||
left: '',
|
||||
right: '10px',
|
||||
border: 'none',
|
||||
padding: '5px',
|
||||
opacity: 0.6,
|
||||
cursor: 'default',
|
||||
color: '#fff',
|
||||
backgroundColor: '#000',
|
||||
'-webkit-border-radius':'10px',
|
||||
'-moz-border-radius': '10px',
|
||||
'border-radius': '10px'
|
||||
},
|
||||
|
||||
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
|
||||
// (hat tip to Jorge H. N. de Vasconcelos)
|
||||
/*jshint scripturl:true */
|
||||
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
|
||||
|
||||
// force usage of iframe in non-IE browsers (handy for blocking applets)
|
||||
forceIframe: false,
|
||||
|
||||
// z-index for the blocking overlay
|
||||
baseZ: 1000,
|
||||
|
||||
// set these to true to have the message automatically centered
|
||||
centerX: true, // <-- only effects element blocking (page block controlled via css above)
|
||||
centerY: true,
|
||||
|
||||
// allow body element to be stetched in ie6; this makes blocking look better
|
||||
// on "short" pages. disable if you wish to prevent changes to the body height
|
||||
allowBodyStretch: true,
|
||||
|
||||
// enable if you want key and mouse events to be disabled for content that is blocked
|
||||
bindEvents: true,
|
||||
|
||||
// be default blockUI will supress tab navigation from leaving blocking content
|
||||
// (if bindEvents is true)
|
||||
constrainTabKey: true,
|
||||
|
||||
// fadeIn time in millis; set to 0 to disable fadeIn on block
|
||||
fadeIn: 200,
|
||||
|
||||
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
|
||||
fadeOut: 400,
|
||||
|
||||
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
|
||||
timeout: 0,
|
||||
|
||||
// disable if you don't want to show the overlay
|
||||
showOverlay: true,
|
||||
|
||||
// if true, focus will be placed in the first available input field when
|
||||
// page blocking
|
||||
focusInput: true,
|
||||
|
||||
// elements that can receive focus
|
||||
focusableElements: ':input:enabled:visible',
|
||||
|
||||
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
|
||||
// no longer needed in 2012
|
||||
// applyPlatformOpacityRules: true,
|
||||
|
||||
// callback method invoked when fadeIn has completed and blocking message is visible
|
||||
onBlock: null,
|
||||
|
||||
// callback method invoked when unblocking has completed; the callback is
|
||||
// passed the element that has been unblocked (which is the window object for page
|
||||
// blocks) and the options that were passed to the unblock call:
|
||||
// onUnblock(element, options)
|
||||
onUnblock: null,
|
||||
|
||||
// callback method invoked when the overlay area is clicked.
|
||||
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
|
||||
onOverlayClick: null,
|
||||
|
||||
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
|
||||
quirksmodeOffsetHack: 4,
|
||||
|
||||
// class name of the message block
|
||||
blockMsgClass: 'blockMsg',
|
||||
|
||||
// if it is already blocked, then ignore it (don't unblock and reblock)
|
||||
ignoreIfBlocked: false
|
||||
};
|
||||
|
||||
// private data and functions follow...
|
||||
|
||||
var pageBlock = null;
|
||||
var pageBlockEls = [];
|
||||
|
||||
function install(el, opts) {
|
||||
var css, themedCSS;
|
||||
var full = (el == window);
|
||||
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
|
||||
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
|
||||
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
|
||||
return;
|
||||
|
||||
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
|
||||
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
|
||||
if (opts.onOverlayClick)
|
||||
opts.overlayCSS.cursor = 'pointer';
|
||||
|
||||
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
|
||||
msg = msg === undefined ? opts.message : msg;
|
||||
|
||||
// remove the current block (if there is one)
|
||||
if (full && pageBlock)
|
||||
remove(window, {fadeOut:0});
|
||||
|
||||
// if an existing element is being used as the blocking content then we capture
|
||||
// its current place in the DOM (and current display style) so we can restore
|
||||
// it when we unblock
|
||||
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
|
||||
var node = msg.jquery ? msg[0] : msg;
|
||||
var data = {};
|
||||
$(el).data('blockUI.history', data);
|
||||
data.el = node;
|
||||
data.parent = node.parentNode;
|
||||
data.display = node.style.display;
|
||||
data.position = node.style.position;
|
||||
if (data.parent)
|
||||
data.parent.removeChild(node);
|
||||
}
|
||||
|
||||
$(el).data('blockUI.onUnblock', opts.onUnblock);
|
||||
var z = opts.baseZ;
|
||||
|
||||
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
|
||||
// layer1 is the iframe layer which is used to supress bleed through of underlying content
|
||||
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
|
||||
// layer3 is the message content that is displayed while blocking
|
||||
var lyr1, lyr2, lyr3, s;
|
||||
if (msie || opts.forceIframe)
|
||||
lyr1 = $('<iframe class="wu_blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
|
||||
else
|
||||
lyr1 = $('<div class="wu_blockUI" style="display:none"></div>');
|
||||
|
||||
if (opts.theme)
|
||||
lyr2 = $('<div class="wu_blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
|
||||
else
|
||||
lyr2 = $('<div class="wu_blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
|
||||
|
||||
if (opts.theme && full) {
|
||||
s = '<div class="wu_blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
|
||||
if ( opts.title ) {
|
||||
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
||||
}
|
||||
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
||||
s += '</div>';
|
||||
}
|
||||
else if (opts.theme) {
|
||||
s = '<div class="wu_blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
|
||||
if ( opts.title ) {
|
||||
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
||||
}
|
||||
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
||||
s += '</div>';
|
||||
}
|
||||
else if (full) {
|
||||
s = '<div class="wu_blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
|
||||
}
|
||||
else {
|
||||
s = '<div class="wu_blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
|
||||
}
|
||||
lyr3 = $(s);
|
||||
|
||||
// if we have a message, style it
|
||||
if (msg) {
|
||||
if (opts.theme) {
|
||||
lyr3.css(themedCSS);
|
||||
lyr3.addClass('ui-widget-content');
|
||||
}
|
||||
else
|
||||
lyr3.css(css);
|
||||
}
|
||||
|
||||
// style the overlay
|
||||
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
|
||||
lyr2.css(opts.overlayCSS);
|
||||
lyr2.css('position', full ? 'fixed' : 'absolute');
|
||||
|
||||
// make iframe layer transparent in IE
|
||||
if (msie || opts.forceIframe)
|
||||
lyr1.css('opacity',0.0);
|
||||
|
||||
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
|
||||
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
|
||||
$.each(layers, function() {
|
||||
this.appendTo($par);
|
||||
});
|
||||
|
||||
if (opts.theme && opts.draggable && $.fn.draggable) {
|
||||
lyr3.draggable({
|
||||
handle: '.ui-dialog-titlebar',
|
||||
cancel: 'li'
|
||||
});
|
||||
}
|
||||
|
||||
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
|
||||
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
|
||||
if (ie6 || expr) {
|
||||
// give body 100% height
|
||||
if (full && opts.allowBodyStretch && $.support.boxModel)
|
||||
$('html,body').css('height','100%');
|
||||
|
||||
// fix ie6 issue when blocked element has a border width
|
||||
if ((ie6 || !$.support.boxModel) && !full) {
|
||||
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
|
||||
var fixT = t ? '(0 - '+t+')' : 0;
|
||||
var fixL = l ? '(0 - '+l+')' : 0;
|
||||
}
|
||||
|
||||
// simulate fixed position
|
||||
$.each(layers, function(i,o) {
|
||||
var s = o[0].style;
|
||||
s.position = 'absolute';
|
||||
if (i < 2) {
|
||||
if (full)
|
||||
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
|
||||
else
|
||||
s.setExpression('height','this.parentNode.offsetHeight + "px"');
|
||||
if (full)
|
||||
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
|
||||
else
|
||||
s.setExpression('width','this.parentNode.offsetWidth + "px"');
|
||||
if (fixL) s.setExpression('left', fixL);
|
||||
if (fixT) s.setExpression('top', fixT);
|
||||
}
|
||||
else if (opts.centerY) {
|
||||
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
|
||||
s.marginTop = 0;
|
||||
}
|
||||
else if (!opts.centerY && full) {
|
||||
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
|
||||
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
|
||||
s.setExpression('top',expression);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// show the message
|
||||
if (msg) {
|
||||
if (opts.theme)
|
||||
lyr3.find('.ui-widget-content').append(msg);
|
||||
else
|
||||
lyr3.append(msg);
|
||||
if (msg.jquery || msg.nodeType)
|
||||
$(msg).show();
|
||||
}
|
||||
|
||||
if ((msie || opts.forceIframe) && opts.showOverlay)
|
||||
lyr1.show(); // opacity is zero
|
||||
if (opts.fadeIn) {
|
||||
var cb = opts.onBlock ? opts.onBlock : noOp;
|
||||
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
|
||||
var cb2 = msg ? cb : noOp;
|
||||
if (opts.showOverlay)
|
||||
lyr2._fadeIn(opts.fadeIn, cb1);
|
||||
if (msg)
|
||||
lyr3._fadeIn(opts.fadeIn, cb2);
|
||||
}
|
||||
else {
|
||||
if (opts.showOverlay)
|
||||
lyr2.show();
|
||||
if (msg)
|
||||
lyr3.show();
|
||||
if (opts.onBlock)
|
||||
opts.onBlock.bind(lyr3)();
|
||||
}
|
||||
|
||||
// bind key and mouse events
|
||||
bind(1, el, opts);
|
||||
|
||||
if (full) {
|
||||
pageBlock = lyr3[0];
|
||||
pageBlockEls = $(opts.focusableElements,pageBlock);
|
||||
if (opts.focusInput)
|
||||
setTimeout(focus, 20);
|
||||
}
|
||||
else
|
||||
center(lyr3[0], opts.centerX, opts.centerY);
|
||||
|
||||
if (opts.timeout) {
|
||||
// auto-unblock
|
||||
var to = setTimeout(function() {
|
||||
if (full)
|
||||
$.unblockUI(opts);
|
||||
else
|
||||
$(el).wu_unblock(opts);
|
||||
}, opts.timeout);
|
||||
$(el).data('blockUI.timeout', to);
|
||||
}
|
||||
}
|
||||
|
||||
// remove the block
|
||||
function remove(el, opts) {
|
||||
var count;
|
||||
var full = (el == window);
|
||||
var $el = $(el);
|
||||
var data = $el.data('blockUI.history');
|
||||
var to = $el.data('blockUI.timeout');
|
||||
if (to) {
|
||||
clearTimeout(to);
|
||||
$el.removeData('blockUI.timeout');
|
||||
}
|
||||
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
bind(0, el, opts); // unbind events
|
||||
|
||||
if (opts.onUnblock === null) {
|
||||
opts.onUnblock = $el.data('blockUI.onUnblock');
|
||||
$el.removeData('blockUI.onUnblock');
|
||||
}
|
||||
|
||||
var els;
|
||||
if (full) // crazy selector to handle odd field errors in ie6/7
|
||||
els = $('body').children().filter('.wu_blockUI').add('body > .wu_blockUI');
|
||||
else
|
||||
els = $el.find('> .wu_blockUI');
|
||||
|
||||
// fix cursor issue
|
||||
if ( opts.cursorReset ) {
|
||||
if ( els.length > 1 )
|
||||
els[1].style.cursor = opts.cursorReset;
|
||||
if ( els.length > 2 )
|
||||
els[2].style.cursor = opts.cursorReset;
|
||||
}
|
||||
|
||||
if (full)
|
||||
pageBlock = pageBlockEls = null;
|
||||
|
||||
if (opts.fadeOut) {
|
||||
count = els.length;
|
||||
els.stop().fadeOut(opts.fadeOut, function() {
|
||||
if ( --count === 0)
|
||||
reset(els,data,opts,el);
|
||||
});
|
||||
}
|
||||
else
|
||||
reset(els, data, opts, el);
|
||||
}
|
||||
|
||||
// move blocking element back into the DOM where it started
|
||||
function reset(els,data,opts,el) {
|
||||
var $el = $(el);
|
||||
if ( $el.data('blockUI.isBlocked') )
|
||||
return;
|
||||
|
||||
els.each(function(i,o) {
|
||||
// remove via DOM calls so we don't lose event handlers
|
||||
if (this.parentNode)
|
||||
this.parentNode.removeChild(this);
|
||||
});
|
||||
|
||||
if (data && data.el) {
|
||||
data.el.style.display = data.display;
|
||||
data.el.style.position = data.position;
|
||||
data.el.style.cursor = 'default'; // #59
|
||||
if (data.parent)
|
||||
data.parent.appendChild(data.el);
|
||||
$el.removeData('blockUI.history');
|
||||
}
|
||||
|
||||
if ($el.data('blockUI.static')) {
|
||||
$el.css('position', 'static'); // #22
|
||||
}
|
||||
|
||||
if (typeof opts.onUnblock == 'function')
|
||||
opts.onUnblock(el,opts);
|
||||
|
||||
// fix issue in Safari 6 where block artifacts remain until reflow
|
||||
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
|
||||
body.width(w-1).width(w);
|
||||
body[0].style.width = cssW;
|
||||
}
|
||||
|
||||
// bind/unbind the handler
|
||||
function bind(b, el, opts) {
|
||||
var full = el == window, $el = $(el);
|
||||
|
||||
// don't bother unbinding if there is nothing to unbind
|
||||
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
|
||||
return;
|
||||
|
||||
$el.data('blockUI.isBlocked', b);
|
||||
|
||||
// don't bind events when overlay is not in use or if bindEvents is false
|
||||
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
|
||||
return;
|
||||
|
||||
// bind anchors and inputs for mouse and key events
|
||||
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
|
||||
if (b)
|
||||
$(document).bind(events, opts, handler);
|
||||
else
|
||||
$(document).unbind(events, handler);
|
||||
|
||||
// former impl...
|
||||
// var $e = $('a,:input');
|
||||
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
|
||||
}
|
||||
|
||||
// event handler to suppress keyboard/mouse events when blocking
|
||||
function handler(e) {
|
||||
// allow tab navigation (conditionally)
|
||||
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
|
||||
if (pageBlock && e.data.constrainTabKey) {
|
||||
var els = pageBlockEls;
|
||||
var fwd = !e.shiftKey && e.target === els[els.length-1];
|
||||
var back = e.shiftKey && e.target === els[0];
|
||||
if (fwd || back) {
|
||||
setTimeout(function(){focus(back);},10);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
var opts = e.data;
|
||||
var target = $(e.target);
|
||||
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
|
||||
opts.onOverlayClick(e);
|
||||
|
||||
// allow events within the message content
|
||||
if (target.parents('div.' + opts.blockMsgClass).length > 0)
|
||||
return true;
|
||||
|
||||
// allow events for content that is not being blocked
|
||||
return target.parents().children().filter('div.wu_blockUI').length === 0;
|
||||
}
|
||||
|
||||
function focus(back) {
|
||||
if (!pageBlockEls)
|
||||
return;
|
||||
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
|
||||
if (e)
|
||||
e.focus();
|
||||
}
|
||||
|
||||
function center(el, x, y) {
|
||||
var p = el.parentNode, s = el.style;
|
||||
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
|
||||
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
|
||||
if (x) s.left = l > 0 ? (l+'px') : '0';
|
||||
if (y) s.top = t > 0 ? (t+'px') : '0';
|
||||
}
|
||||
|
||||
function sz(el, p) {
|
||||
return parseInt($.css(el,p),10)||0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*global define:true */
|
||||
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
|
||||
define(['jquery'], setup);
|
||||
} else {
|
||||
setup(jQuery);
|
||||
}
|
||||
|
||||
})();
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* jQuery blockUI plugin
|
||||
* Version 2.70.0-2014.11.23
|
||||
* Requires jQuery v1.7 or later
|
||||
*
|
||||
* This was heavily modified to make use of the new jQuery apis and remove deprecated code.
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/block/
|
||||
* Copyright (c) 2007-2013 M. Alsup
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
||||
*/
|
||||
!function(){"use strict";function e(e){e.fn._fadeIn=e.fn.fadeIn;var o=e.noop||function(){},t=/MSIE/.test(navigator.userAgent),i=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),n=(document.documentMode,"function"==typeof document.createElement("div").style.setExpression);e.blockUI=function(e){a(window,e)},e.unblockUI=function(e){d(window,e)},e.growlUI=function(o,t,i,n){var l=e('<div class="growlUI"></div>');o&&l.append("<h1>"+o+"</h1>"),t&&l.append("<h2>"+t+"</h2>"),void 0===i&&(i=3e3);var s=function(o){o=o||{},e.blockUI({message:l,fadeIn:void 0!==o.fadeIn?o.fadeIn:700,fadeOut:void 0!==o.fadeOut?o.fadeOut:1e3,timeout:void 0!==o.timeout?o.timeout:i,centerY:!1,showOverlay:!1,onUnblock:n,css:e.blockUI.defaults.growlCSS})};s();l.css("opacity");l.mouseover((function(){s({fadeIn:0,timeout:3e4});var o=e(".blockMsg");o.stop(),o.fadeTo(300,1)})).mouseout((function(){e(".blockMsg").fadeOut(1e3)}))},e.fn.wu_block=function(o){if(this[0]===window)return e.blockUI(o),this;var t=e.extend({},e.blockUI.defaults,o||{});return this.each((function(){var o=e(this);t.ignoreIfBlocked&&o.data("blockUI.isBlocked")||o.wu_unblock({fadeOut:0})})),this.each((function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,a(this,o)}))},e.fn.wu_unblock=function(o){return this[0]===window?(e.unblockUI(o),this):this.each((function(){d(this,o)}))},e.blockUI.version=2.7,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var l=null,s=[];function a(a,c){var u,p,h=a==window,k=c&&void 0!==c.message?c.message:void 0;if(!(c=e.extend({},e.blockUI.defaults,c||{})).ignoreIfBlocked||!e(a).data("blockUI.isBlocked")){if(c.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,c.overlayCSS||{}),u=e.extend({},e.blockUI.defaults.css,c.css||{}),c.onOverlayClick&&(c.overlayCSS.cursor="pointer"),p=e.extend({},e.blockUI.defaults.themedCSS,c.themedCSS||{}),k=void 0===k?c.message:k,h&&l&&d(window,{fadeOut:0}),k&&"string"!=typeof k&&(k.parentNode||k.jquery)){var y=k.jquery?k[0]:k,v={};e(a).data("blockUI.history",v),v.el=y,v.parent=y.parentNode,v.display=y.style.display,v.position=y.style.position,v.parent&&v.parent.removeChild(y)}e(a).data("blockUI.onUnblock",c.onUnblock);var m,g,w,I,U=c.baseZ;m=t||c.forceIframe?e('<iframe class="wu_blockUI" style="z-index:'+U+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+c.iframeSrc+'"></iframe>'):e('<div class="wu_blockUI" style="display:none"></div>'),g=c.theme?e('<div class="wu_blockUI blockOverlay ui-widget-overlay" style="z-index:'+U+++';display:none"></div>'):e('<div class="wu_blockUI blockOverlay" style="z-index:'+U+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),c.theme&&h?(I='<div class="wu_blockUI '+c.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(U+10)+';display:none;position:fixed">',c.title&&(I+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(c.title||" ")+"</div>"),I+='<div class="ui-widget-content ui-dialog-content"></div>',I+="</div>"):c.theme?(I='<div class="wu_blockUI '+c.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(U+10)+';display:none;position:absolute">',c.title&&(I+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(c.title||" ")+"</div>"),I+='<div class="ui-widget-content ui-dialog-content"></div>',I+="</div>"):I=h?'<div class="wu_blockUI '+c.blockMsgClass+' blockPage" style="z-index:'+(U+10)+';display:none;position:fixed"></div>':'<div class="wu_blockUI '+c.blockMsgClass+' blockElement" style="z-index:'+(U+10)+';display:none;position:absolute"></div>',w=e(I),k&&(c.theme?(w.css(p),w.addClass("ui-widget-content")):w.css(u)),c.theme||g.css(c.overlayCSS),g.css("position",h?"fixed":"absolute"),(t||c.forceIframe)&&m.css("opacity",0);var x=[m,g,w],C=e(h?"body":a);e.each(x,(function(){this.appendTo(C)})),c.theme&&c.draggable&&e.fn.draggable&&w.draggLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* jQuery fontIconPicker - 3.1.1
|
||||
*
|
||||
* An icon picker built on top of font icons and jQuery
|
||||
*
|
||||
* http://codeb.it/fontIconPicker
|
||||
*
|
||||
* @author Alessandro Benoit & Swashata Ghosh
|
||||
* @license MIT License
|
||||
*
|
||||
* {@link https://github.com/micc83/fontIconPicker}
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.initFontIconPickerNode=e(t.jQuery)}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}t=t&&t.hasOwnProperty("default")?t.default:t;var s={theme:"fip-grey",source:!1,emptyIcon:!0,emptyIconValue:"",autoClose:!0,iconsPerPage:20,hasSearch:!0,searchSource:!1,appendTo:"self",useAttribute:!1,attributeName:"data-icon",convertToHex:!0,allCategoryText:"From all categories",unCategorizedText:"Uncategorized",iconGenerator:null,windowDebounceDelay:150,searchPlaceholder:"Search Icons"},n=t,o=0;function r(t,e){this.element=n(t),this.settings=n.extend({},s,e),this.settings.emptyIcon&&this.settings.iconsPerPage--,this.iconPicker=n("<div/>",{class:"icons-selector",style:"position: relative",html:this._getPickerTemplate(),attr:{"data-fip-origin":this.element.attr("id")}}),this.iconContainer=this.iconPicker.find(".fip-icons-container"),this.searchIcon=this.iconPicker.find(".selector-search i"),this.selectorPopup=this.iconPicker.find(".selector-popup-wrap"),this.selectorButton=this.iconPicker.find(".selector-button"),this.iconsSearched=[],this.isSearch=!1,this.totalPage=1,this.currentPage=1,this.currentIcon=!1,this.iconsCount=0,this.open=!1,this.guid=o++,this.eventNameSpace=".fontIconPicker".concat(o),this.searchValues=[],this.availableCategoriesSearch=[],this.triggerEvent=null,this.backupSource=[],this.backupSearch=[],this.isCategorized=!1,this.selectCategory=this.iconPicker.find(".icon-category-select"),this.selectedCategory=!1,this.availableCategories=[],this.unCategorizedKey=null,this.init()}function c(t){return function(t){return!!t.fn&&(t.fn&&t.fn.fontIconPicker||(t.fn.fontIconPicker=function(e){var i=this;return this.each((function(){t.data(this,"fontIconPicker")||t.data(this,"fontIconPicker",new r(this,e))})),this.setIcons=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.each((function(){t.data(this,"fontIconPicker").setIcons(e,s)}))},this.setIcon=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";i.each((function(){t.data(this,"fontIconPicker").setIcon(e)}))},this.destroyPicker=function(){i.each((function(){t.data(this,"fontIconPicker")&&(t.data(this,"fontIconPicker").destroy(),t.removeData(this,"fontIconPicker"))}))},this.refreshPicker=function(s){s||(s=e),i.destroyPicker(),i.each((function(){t.data(this,"fontIconPicker")||t.data(this,"fontIconPicker",new r(this,s))}))},this.repositionPicker=function(){i.each((function(){t.data(this,"fontIconPicker").resetPosition()}))},this.setPage=function(e){i.each((function(){t.data(this,"fontIconPicker").setPage(e)}))},this}),!0)}(t)}r.prototype={init:function(){this.iconPicker.addClass(this.settings.theme),this.iconPicker.css({left:-9999}).appendTo("body");var t=this.iconPicker.outerHeight(),e=this.iconPicker.outerWidth();this.iconPicker.css({left:""}),this.element.before(this.iconPicker),this.element.css({visibility:"hidden",top:0,position:"relative",zIndex:"-1",left:"-"+e+"px",display:"inline-block",height:t+"px",width:e+"px",padding:"0",margin:"0 -"+e+"px 0 0",border:"0 none",verticalAlign:"top",float:"none"}),this.element.is("select")||(this.triggerEvent="input"),!this.settings.source&&this.element.is("select")?this._populateSourceFromSelect():this._initSourceIndex(),this._loadCategories(),this._loadIcons(),this._initDropDown(),this._initCategoryChanger(),this._initPagination(),this._initIconSearch(),this._initIconSelect(),this._initAutoClose(),this._initFixOnResize()},setIcons:function(t,e){this.settings.source=Array.isArray(t)?i(t):n.extend({},t),this.settings.searchSource=Array.isArray(e)?i(e):n.extend({},e),this._initSourceIndex(),this._loadCategories(),this._resetSearch(),this._loadIcons()},setIcon:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._setSelectedIcon(t)},destroy:function(){this.iconPicker.off().remove(),this.element.css({visibility:"",top:"",position:"",zIndex:"",left:"",display:"",height:"",width:"",padding:"",margin:"",border:"",verticalAlign:"",float:""}),n(window).off("resize"+this.eventNameSpace),n("html").off("click"+this.eventNameSpace)},resetPosition:function(){this._fixOnResize()},setPage:function(t){"first"==t&&(t=1),"last"==t&&(t=this.totalPage),t=parseInt(t,10),isNaN(t)&&(t=1),t>this.totalPage&&(t=this.totLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,t,n){if(e){for(var r,o={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},i={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},c={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},s=1;s<20;++s)o[111+s]="f"+s;for(s=0;s<=9;++s)o[s+96]=s.toString();d.prototype.bind=function(e,t,n){return e=e instanceof Array?e:[e],this._bindMultiple.call(this,e,t,n),this},d.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},d.prototype.trigger=function(e,t){return this._directMap[e+":"+t]&&this._directMap[e+":"+t]({},e),this},d.prototype.reset=function(){return this._callbacks={},this._directMap={},this},d.prototype.stopCallback=function(e,n){if((" "+n.className+" ").indexOf(" mousetrap ")>-1)return!1;if(function e(n,r){return null!==n&&n!==t&&(n===r||e(n.parentNode,r))}(n,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var r=e.composedPath()[0];r!==e.target&&(n=r)}return"INPUT"==n.tagName||"SELECT"==n.tagName||"TEXTAREA"==n.tagName||n.isContentEditable},d.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},d.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t]);r=null},d.init=function(){var e=d(t);for(var n in e)"_"!==n.charAt(0)&&(d[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n))},d.init(),e.Mousetrap=d,"undefined"!=typeof module&&module.exports&&(module.exports=d),"function"==typeof define&&define.amd&&define((function(){return d}))}function u(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function l(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return o[e.which]?o[e.which]:i[e.which]?i[e.which]:String.fromCharCode(e.which).toLowerCase()}function f(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function p(e,t,n){return n||(n=function(){if(!r)for(var e in r={},o)e>95&&e<112||o.hasOwnProperty(e)&&(r[o[e]]=e);return r}()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function h(e,t){var n,r,o,i=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),o=0;o<n.length;++o)r=n[o],c[r]&&(r=c[r]),t&&"keypress"!=t&&a[r]&&(r=a[r],i.push("shift")),f(r)&&i.push(r);return{key:r,modifiers:i,action:t=p(r,i,t)}}function d(e){var n=this;if(e=e||t,!(n instanceof d))return new d(e);n.target=e,n._callbacks={},n._directMap={};var r,o={},i=!1,a=!1,c=!1;function s(e){e=e||{};var t,n=!1;for(t in o)e[t]?n=!0:o[t]=0;n||(c=!1)}function p(e,t,r,i,a,c){var s,u,l,p,h=[],d=r.type;if(!n._callbacks[e])return[];for("keyup"==d&&f(e)&&(t=[e]),s=0;s<n._callbacks[e].length;++s)if(u=n._callbacks[e][s],(i||!u.seq||o[u.seq]==u.level)&&d==u.action&&("keypress"==d&&!r.metaKey&&!r.ctrlKey||(l=t,p=u.modifiers,l.sort().join(",")===p.sort().join(",")))){var y=!i&&u.combo==a,m=i&&u.seq==i&&u.level==c;(y||m)&&n._callbacks[e].splice(s,1),h.push(u)}return h}function y(e,t,r,o){n.stopCallback(t,t.target||t.srcElement,r,o)||!1===e(t,r)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(t),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(t))}function m(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t=l(e);t&&("keyup"!=e.type||i!==t?n.handleKey(t,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):i=!1)}function k(e,t,n,a){function u(t){return function(){c=t,++o[e],clearTimeout(r),r=setTimeout(s,1e3)}}function f(t){y(n,t,e),"keyup"!==a&&(i=l(t)),setTimeout(s,10)}o[e]=0;for(var p=0;p<t.length;++p){var d=p+1===t.length?f:u(a||h(t[p+1]).action);v(t[p],d,a,e,p)}}function v(e,t,r,o,i){n._directMap[e+":"+r]=t;var a,c=(e=e.replace(/\s+/g," ")).split(" ");c.length>1?k(e,c,t,r):(a=h(e,r),n._callbacks[a.key]=n._callbacks[a.key]||[],p(a.key,a.modifiers,{type:a.action},o,e,i),n._callbacks[a.key][o?"unshift":"push"]({callback:t,modifiers:a.modifiers,action:a.action,seq:o,level:i,combo:e}))}n._handleKey=function(e,t,n){var r,o=p(e,t,n),i={},u=0,l=!1;for(r=0;r<o.length;++r)o[r].seq&&(u=Math.max(u,o[r].level));for(r=0;r<o.length;++r)if(o[r].seq){if(o[r].level!=u)continue;l=!0,i[o[r].seq]=1,y(o[r].callback,n,o[r].combo,o[r].seq)}else l||y(o[r].callback,n,o[r].combo);var h="keypress"==n.type&&a;n.type!=c||f(e)||h||s(i),a=l&&"keydown"==n.type},n._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)v(e[r],t,n)},u(e,"keypress",m),u(e,"keydown",m),u(e,"keyup",m)}}("undefined"!=typeof window?window:nullLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t,e){"function"==typeof define&&define.amd?define("sifter",e):"object"==typeof exports?module.exports=e():t.Sifter=e()}(this,(function(){var t=function(t,e){this.items=t,this.settings=e||{diacritics:!0}};t.prototype.tokenize=function(t){if(!(t=s(String(t||"").toLowerCase()))||!t.length)return[];var e,i,n,r,l=[],h=t.split(/ +/);for(e=0,i=h.length;e<i;e++){if(n=o(h[e]),this.settings.diacritics)for(r in a)a.hasOwnProperty(r)&&(n=n.replace(new RegExp(r,"g"),a[r]));l.push({string:h[e],regex:new RegExp(n,"i")})}return l},t.prototype.iterator=function(t,e){(r(t)?Array.prototype.forEach||function(t){for(var e=0,i=this.length;e<i;e++)t(this[e],e,this)}:function(t){for(var e in this)this.hasOwnProperty(e)&&t(this[e],e,this)}).apply(t,[e])},t.prototype.getScoreFunction=function(t,e){var i,s,o,r;t=this.prepareSearch(t,e),s=t.tokens,i=t.options.fields,o=s.length,r=t.options.nesting;var a,l=function(t,e){var i,n;return t?-1===(n=(t=String(t||"")).search(e.regex))?0:(i=e.string.length/t.length,0===n&&(i+=.5),i):0},h=(a=i.length)?1===a?function(t,e){return l(n(e,i[0],r),t)}:function(t,e){for(var s=0,o=0;s<a;s++)o+=l(n(e,i[s],r),t);return o/a}:function(){return 0};return o?1===o?function(t){return h(s[0],t)}:"and"===t.options.conjunction?function(t){for(var e,i=0,n=0;i<o;i++){if((e=h(s[i],t))<=0)return 0;n+=e}return n/o}:function(t){for(var e=0,i=0;e<o;e++)i+=h(s[e],t);return i/o}:function(){return 0}},t.prototype.getSortFunction=function(t,i){var s,o,r,a,l,h,p,u,c,d,g;if(g=!(t=(r=this).prepareSearch(t,i)).query&&i.sort_empty||i.sort,c=function(t,e){return"$score"===t?e.score:n(r.items[e.id],t,i.nesting)},l=[],g)for(s=0,o=g.length;s<o;s++)(t.query||"$score"!==g[s].field)&&l.push(g[s]);if(t.query){for(d=!0,s=0,o=l.length;s<o;s++)if("$score"===l[s].field){d=!1;break}d&&l.unshift({field:"$score",direction:"desc"})}else for(s=0,o=l.length;s<o;s++)if("$score"===l[s].field){l.splice(s,1);break}for(u=[],s=0,o=l.length;s<o;s++)u.push("desc"===l[s].direction?-1:1);return(h=l.length)?1===h?(a=l[0].field,p=u[0],function(t,i){return p*e(c(a,t),c(a,i))}):function(t,i){var n,s,o;for(n=0;n<h;n++)if(o=l[n].field,s=u[n]*e(c(o,t),c(o,i)))return s;return 0}:null},t.prototype.prepareSearch=function(t,e){if("object"==typeof t)return t;var n=(e=i({},e)).fields,s=e.sort,o=e.sort_empty;return n&&!r(n)&&(e.fields=[n]),s&&!r(s)&&(e.sort=[s]),o&&!r(o)&&(e.sort_empty=[o]),{options:e,query:String(t||"").toLowerCase(),tokens:this.tokenize(t),total:0,items:[]}},t.prototype.search=function(t,e){var i,n,s,o;return n=this.prepareSearch(t,e),e=n.options,t=n.query,o=e.score||this.getScoreFunction(n),t.length?this.iterator(this.items,(function(t,s){i=o(t),(!1===e.filter||i>0)&&n.items.push({score:i,id:s})})):this.iterator(this.items,(function(t,e){n.items.push({score:1,id:e})})),(s=this.getSortFunction(n,e))&&n.items.sort(s),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n};var e=function(t,e){return"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=l(String(t||"")))>(e=l(String(e||"")))?1:e>t?-1:0},i=function(t,e){var i,n,s,o;for(i=1,n=arguments.length;i<n;i++)if(o=arguments[i])for(s in o)o.hasOwnProperty(s)&&(t[s]=o[s]);return t},n=function(t,e,i){if(t&&e){if(!i)return t[e];for(var n=e.split(".");n.length&&(t=t[n.shift()]););return t}},s=function(t){return(t+"").replace(/^\s+|\s+$|/g,"")},o=function(t){return(t+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},r=Array.isArray||"undefined"!=typeof $&&$.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var t,e,iLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
/*! shepherd.js 5.0.1 */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Shepherd=t()}(this,(function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var r={object:!0,symbol:!0},o=function(){if(this)return this;Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0});try{return __global__}finally{delete Object.prototype.__global__}}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var a,s,l,p,c=function(e){return null!=e},u={object:!0,function:!0,undefined:!0},f=function(e){if(!function(e){return!!c(e)&&hasOwnProperty.call(u,typeof e)}(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}},d=/^\s*class[\s{/}]/,h=Function.prototype.toString,m=function(e){return!!function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!f(e)}(e)&&!d.test(h.call(e))},v=function(e){return null!=e},b=Object.keys,y=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}()?Object.keys:function(e){return b(v(e)?Object(e):e)},g=function(e){if(!v(e))throw new TypeError("Cannot use null or undefined");return e},w=Math.max,x=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}()?Object.assign:function(e,t){var n,r,o,i=w(arguments.length,2);for(e=Object(g(e)),o=function(r){try{e[r]=t[r]}catch(e){n||(n=e)}},r=1;r<i;++r)y(t=arguments[r]).forEach(o);if(void 0!==n)throw n;return e},T=Array.prototype.forEach,S=Object.create,E=function(e,t){var n;for(n in e)t[n]=e[n]},_=function(e){var t=S(null);return T.call(arguments,(function(e){v(e)&&E(Object(e),t)})),t},O="razdwatrzy",C=String.prototype.indexOf,k="function"==typeof O.contains&&!0===O.contains("dwa")&&!1===O.contains("foo")?String.prototype.contains:function(e){return C.call(this,e,arguments[1])>-1},P=i((function(e){(e.exports=function(e,t){var n,r,o,i,a;return arguments.length<2||"string"!=typeof e?(i=t,t=e,e=null):i=arguments[2],c(e)?(n=k.call(e,"c"),r=k.call(e,"e"),o=k.call(e,"w")):(n=o=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:o},i?x(_(i),a):a}).gs=function(e,t,n){var r,o,i,a;return"string"!=typeof e?(i=n,n=t,t=e,e=null):i=arguments[3],c(t)?m(t)?c(n)?m(n)||(i=n,n=void 0):n=void 0:(i=t,t=n=void 0):t=void 0,c(e)?(r=k.call(e,"c"),o=k.call(e,"e")):(r=!0,o=!1),a={get:t,set:n,configurable:r,enumerable:o},i?x(_(i),a):a}})),A=function(e){if(!(t=e)||!("symbol"==typeof t||t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag]))throw new TypeError(e+" is not a symbol");var t;return e},L=Object.create,I=Object.defineProperties,B=Object.defineProperty,M=Object.prototype,N=L(null);if("function"==typeof Symbol){a=Symbol;try{String(a()),p=!0}catch(e){}}var F,j=(F=L(null),function(e){for(var t,n,r=0;F[e+(r||"")];)++r;return F[e+=r||""]=!0,B(M,t="@@"+e,P.gs(null,(function(e){n||(n=!0,B(this,t,P(e)),n=!1)}))),t});l=function(e){if(this instanceof l)throw new TypeError("Symbol is not a constructor");return s(e)};var D=s=function e(t){var n;if(this instanceof e)throw new TypeError("Symbol is not a constructor");return p?a(t):(n=L(l.prototype),t=void 0===t?"":String(t),I(n,{__description__:P("",t),__name__:P("",j(t))}))};I(s,{for:P((function(e){return N[e]?N[e]:N[e]=s(String(e))})),keyFor:P((function(e){var t;for(t in A(e),N)if(N[t]===e)return t})),hasInstance:P("",a&&a.hasInstance||s("hasInstance")),isConcatSpreadable:P("",a&&a.isConcatSpreadable||s("isConcatSpreadable")),iterator:P("",a&&a.iterator||s("iterator")),match:P("",a&&a.match||s("match")),replace:P("",a&&a.replace||s("replace")),search:P("",a&&a.search||s("search")),species:P("",a&&a.species||s("species")),split:P("",a&&a.split||s("split")),toPrimitive:P("",a&&a.toPrimitive||s("toPrimitive")),toStringTag:P("",a&&a.toStringTag||s("toStringTag")),unscopables:P("",a&&a.unscopables||s("unscopables"))}),I(l.prototype,{constructor:P(s),toString:P("",(function(){return this.__name__}))}),I(s.prototype,{toString:P((function(){return"Symbol ("+A(this).__description__+")"})),valueOf:P((function(){return A(this)}))}),B(s.prototype,s.toPrimitive,P("",(function(){var e=A(this);return"symbol"==typeof e?e:e.toString()}))),B(s.prototype,s.toStringTag,P("c","SymLine truncated
|
||||
/*!
|
||||
* isobject <https://github.com/jonschlinkert/isobject>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/;var H=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)},R=function(e,t,n){if(H(n)||(n={default:n}),!z(e))return void 0!==n.default?n.default:e;"number"==typeof t&&(t=String(t));const r=Array.isArray(t),o="string"==typeof t,i=n.separator||".",a=n.joinChar||("string"==typeof i?i:".");if(!o&&!r)return e;if(o&&t in e)return W(t,e,n)?e[t]:n.default;let s=r?t:function(e,t,n){if("function"==typeof n.split)return n.split(e);return e.split(t)}(t,i,n),l=s.length,p=0;do{let t=s[p];for("number"==typeof t&&(t=String(t));t&&"\\"===t.slice(-1);)t=V([t.slice(0,-1),s[++p]||""],a,n);if(t in e){if(!W(t,e,n))return n.default;e=e[t]}else{let r=!1,o=p+1;for(;o<l;)if(t=V([t,s[o++]],a,n),r=t in e){if(!W(t,e,n))return n.default;e=e[t],p=o-1;break}if(!r)return n.default}}while(++p<l&&z(e));return p===l?e:n.default};
|
||||
/*!
|
||||
* get-value <https://github.com/jonschlinkert/get-value>
|
||||
*
|
||||
* Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/function V(e,t,n){return"function"==typeof n.join?n.join(e):e[0]+t+e[1]}function W(e,t,n){return"function"!=typeof n.isValid||n.isValid(e,t)}function z(e){return H(e)||Array.isArray(e)||"function"==typeof e}var U=function(){},q={},Y=[],X=[];function $(e,t){var n,r,o,i,a=X;for(i=arguments.length;i-- >2;)Y.push(arguments[i]);for(t&&null!=t.children&&(Y.length||Y.push(t.children),delete t.children);Y.length;)if((r=Y.pop())&&void 0!==r.pop)for(i=r.length;i--;)Y.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(o=!1)),o&&n?a[a.length-1]+=r:a===X?a=[r]:a.push(r),n=o;var s=new U;return s.nodeName=e,s.children=a,s.attributes=null==t?void 0:t,s.key=null==t?void 0:t.key,s}function K(e,t){for(var n in t)e[n]=t[n];return e}function Z(e,t){e&&("function"==typeof e?e(t):e.current=t)}var G="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;var J=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,Q=[];function ee(e){!e._dirty&&(e._dirty=!0)&&1==Q.push(e)&&G(te)}function te(){for(var e;e=Q.pop();)e._dirty&&xe(e)}function ne(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&re(e,t.nodeName):n||e._componentConstructor===t.nodeName}function re(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function oe(e){var t=K({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function ie(e){var t=e.parentNode;t&&t.removeChild(e)}function ae(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)Z(n,null),Z(r,e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===J.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var a=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,se,a):e.removeEventListener(t,se,a),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var s=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?s?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(s?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function se(e){return this._listeners[e.type](e)}var le=[],pe=0,ce=!1,ue=!1;function fe(){for(var e;e=le.shift();)e.componentDidMount&&e.componentDidMount()}function de(e,t,n,r,o,i){pe++||(ce=null!=o&&void 0!==o.ownerSVGElement,ue=null!=e&&!("__preactattr_"in e));var a=he(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--pe||(ue=!1,i||fe()),a}function he(e,t,n,r,o){var i=e,a=ce;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),me(e,!0))),i.__preactattr_=!0,i;var s,l,p=t.nodeName;if("function"==typeof p)return function(e,t,n,r){var o=e&&e._component,i=o,a=e,s=o&&e._componentConstructor===t.nodeName,l=s,p=oe(t);for(;o&&!l&&(o=o._parentComponent);)l=o.constructor===t.nodeName;o&&l&&(!r||o._component)?(we(o,p,3,n,r),e=o.base):(i&&!s&&(Te(i),e=a=null),o=ye(t.nodeName,p,n),e&&!o.nextBase&&(o.nextBase=e,a=null),we(o,p,1,n,r),e=o.base,a&&e!==a&&(a._component=null,me(a,!1)));return e}(e,t,n,r);if(ce="svg"===p||"foreignObject"!==p&&ce,p=String(p),(!e||!re(e,p))&&(s=p,(l=ce?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)).normalizedNodeName=s,i=l,e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),me(e,!0)}var c=i.firstChild,u=i.__preactattr_,f=t.children;if(null==u){u=i.__preactattr_={};for(var d=i.attributes,h=d.length;h--;)u[d[h].name]=d[h].value}return!ue&&f&&1===f.length&&"string"==typeof f[0]&&null!=c&&void 0!==c.splitText&&null==c.nextSibling?c.nodeValue!=f[0]&&(c.nodeValue=f[0]):(f&&f.length||null!=c)&&function(e,t,n,r,o){var i,a,s,l,p,c=e.childNodes,u=[],f={},d=0,h=0,m=c.length,v=0,b=t?t.length:0;if(0!==m)for(var y=0;y<m;y++){var g=c[y],w=g.__preactattr_;null!=(x=b&&w?g._component?g._component.__key:w.key:null)?(d++,f[x]=g):(w||(void 0!==g.splitText?!o||g.nodeValue.trim():o))&&(u[v++]=g)}if(0!==b)for(y=0;y<b;y++){var x;if(l=t[y],p=null,null!=(x=l.key))d&&void 0!==f[x]&&(p=f[x],f[x]=void 0,d--);else if(h<v)for(i=h;i<v;i++)if(void 0!==u[i]&&ne(a=u[i],l,o)){p=a,u[i]=void 0,i===v-1&&v--,i===h&&h++;break}p=he(p,l,n,r),s=c[y],p&&p!==e&&p!==s&&(null==s?e.appendChild(p):p===sLine truncated
|
||||
/**!
|
||||
* tippy.js v5.0.0-beta.1
|
||||
* (c) 2017-2019 atomiks
|
||||
* MIT License
|
||||
*/function Ne(){return(Ne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Fe="undefined"!=typeof window&&"undefined"!=typeof document,je=Fe?navigator.userAgent:"",De=/MSIE |Trident\//.test(je),He=/UCBrowser\//.test(je),Re=Fe&&/iPhone|iPad|iPod/.test(navigator.platform),Ve={allowHTML:!0,animateFill:!1,animation:"fade",appendTo:function(){return document.body},aria:"describedby",arrow:!0,boundary:"scrollParent",content:"",delay:0,distance:10,duration:[325,275],flip:!0,flipBehavior:"flip",flipOnUpdate:!1,followCursor:!1,hideOnClick:!0,ignoreAttributes:!1,inertia:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,lazy:!0,maxWidth:350,multiple:!1,offset:0,onCreate:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},placement:"top",popperOptions:{},role:"tooltip",showOnCreate:!1,sticky:!1,theme:"",touch:!0,trigger:"mouseenter focus",triggerTarget:null,updateDuration:0,zIndex:9999},We=["arrow","boundary","distance","flip","flipBehavior","flipOnUpdate","offset","placement","popperOptions"],ze={passive:!0},Ue={isTouch:!1},qe=0;function Ye(){Ue.isTouch||(Ue.isTouch=!0,Re&&document.body.classList.add("tippy-iOS"),window.performance&&document.addEventListener("mousemove",Xe))}function Xe(){var e=performance.now();e-qe<20&&(Ue.isTouch=!1,document.removeEventListener("mousemove",Xe),Re||document.body.classList.remove("tippy-iOS")),qe=e}function $e(){var e=document.activeElement,t=e._tippy;e&&e.blur&&t&&!t.state.isVisible&&e.blur()}var Ke=Object.keys(Ve);function Ze(e,t){return{}.hasOwnProperty.call(e,t)}function Ge(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function Je(e,t){return e&&e.modifiers&&e.modifiers[t]}function Qe(e){return e instanceof Element}function et(e,t){return"function"==typeof e?e.apply(null,t):e}function tt(e,t){e.filter((function(e){return"flip"===e.name}))[0].enabled=t}function nt(){return document.createElement("div")}function rt(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function ot(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function it(e,t){var n=Ne({},t,{content:et(t.content,[e])},t.ignoreAttributes?{}:function(e){return Ke.reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e));return n.animateFill&&(n.arrow=!1),(n.arrow||He)&&(n.animateFill=!1),n}function at(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function st(e,t,n){e&&e!==t&&e.apply(null,n)}function lt(e){return[].slice.call(e)}function pt(e,t){return e.indexOf(t)>-1}function ct(e,t){e.innerHTML=Qe(t)?t.innerHTML:t}function ut(e,t){if(Qe(t.content))ct(e,""),e.appendChild(t.content);else if("function"!=typeof t.content){e[t.allowHTML?"innerHTML":"textContent"]=t.content}}function ft(e){return{tooltip:e.querySelector(".tippy-tooltip"),backdrop:e.querySelector(".tippy-backdrop"),content:e.querySelector(".tippy-content"),arrow:e.querySelector(".tippy-arrow")||e.querySelector(".tippy-svg-arrow")}}function dt(e){e.setAttribute("data-inertia","")}function ht(e){var t=nt();return!0===e?t.className="tippy-arrow":(t.className="tippy-svg-arrow",Qe(e)?t.appendChild(e):ct(t,"round"===e?'<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16.012 7.005 18 7 18 7H0z"/></svg>':e)),t}function mt(e){var t=nt();return t.className="tippy-backdrop",t.setAttribute("data-state",e?"visible":"hidden"),t}function vt(e){e.setAttribute("data-interactive","")}function bt(e,t,n){var r=He&&void 0!==document.body.style.webkitTransition?"webkitTransitionEnd":"transitionend";e[t+"EventListener"](r,n)}function yt(e){return e.split("-")[0]}function gt(e,t,n){n.split(" ").forEach((function(n){n&&e.classList[t](n+"-theme")}))}function wt(e,t){var n=nt();n.className="tippy-popper",n.style.position="absolute",n.style.top="0",n.style.left="0";var r=nt();r.className="tippy-tooltip",r.id="tippy-"+e,r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1"),gt(r,"add",t.theme);var o=nt();return o.className="tippy-content",o.setAttribute("data-state","hidden"),t.interactive&&vt(r),t.arrow&&(r.setAttribute("data-arrow",""),r.appendChild(ht(t.arrow))),t.animateFill&&(r.appendChild(mt(!1)),r.setAttribute("data-animatefill","")),t.inertia&&dt(r),ut(o,t),r.appendChild(o),n.appendChild(r),xt(n,t,t,!1),n}function xt(e,t,n,r){var o=ft(e),i=o.tooltip,a=o.content,s=o.backdrop,l=o.arrow;e.style.zIndex=""+n.zIndex,i.setAttribute("data-animation",n.animation),i.style.maxWidth=n.maxWidth+("number"==typeof n.maxWidth?"px":""),n.role?i.setAttribute("role",n.role):i.remoLine truncated
|
||||
/**!
|
||||
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
||||
* @version 1.15.0
|
||||
* @license
|
||||
* Copyright (c) 2016 Federico Zivolo and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
var Tt="undefined"!=typeof window&&"undefined"!=typeof document,St=["Edge","Trident","Firefox"],Et=0,_t=0;_t<St.length;_t+=1)if(Tt&&navigator.userAgent.indexOf(St[_t])>=0){Et=1;break}var Ot=Tt&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then((function(){t=!1,e()})))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout((function(){t=!1,e()}),Et))}};function Ct(e){return e&&"[object Function]"==={}.toString.call(e)}function kt(e,t){if(1!==e.nodeType)return[];var n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function Pt(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function At(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=kt(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:At(Pt(e))}var Lt=Tt&&!(!window.MSInputMethodContext||!document.documentMode),It=Tt&&/MSIE 10/.test(navigator.userAgent);function Bt(e){return 11===e?Lt:10===e?It:Lt||It}function Mt(e){if(!e)return document.documentElement;for(var t=Bt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return r&&"BODY"!==r&&"HTML"!==r?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===kt(n,"position")?Mt(n):n:e?e.ownerDocument.documentElement:document.documentElement}function Nt(e){return null!==e.parentNode?Nt(e.parentNode):e}function Ft(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var a,s,l=i.commonAncestorContainer;if(e!==l&&t!==l||r.contains(o))return"BODY"===(s=(a=l).nodeName)||"HTML"!==s&&Mt(a.firstElementChild)!==a?Mt(l):l;var p=Nt(e);return p.host?Ft(p.host,t):Ft(e,Nt(t).host)}function jt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===t?"scrollTop":"scrollLeft",r=e.nodeName;if("BODY"===r||"HTML"===r){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function Dt(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=jt(t,"top"),o=jt(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function Ht(e,t){var n="x"===t?"Left":"Top",r="Left"===n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"],10)+parseFloat(e["border"+r+"Width"],10)}function Rt(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],Bt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+("Height"===e?"Top":"Left")])+parseInt(r["margin"+("Height"===e?"Bottom":"Right")]):0)}function Vt(e){var t=e.body,n=e.documentElement,r=Bt(10)&&getComputedStyle(n);return{height:Rt("Height",t,n,r),width:Rt("Width",t,n,r)}}var Wt=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},zt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Ut=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},qt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function Yt(e){return qt({},e,{right:e.left+e.width,bottom:e.top+e.height})}function Xt(e){var t={};try{if(Bt(10)){t=e.getBoundingClientRect();var n=jt(e,"top"),r=jt(e,"left");t.top+=n,t.left+=r,t.bottom+=n,t.right+=r}else t=e.getBoundingClientRect()}catch(e){}var o={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},i="HTML"===e.nodeName?Vt(e.ownerDocument):{},a=i.width||e.clientWidth||o.right-o.left,s=i.height||e.clientHeight||o.bottom-o.top,l=e.offsetWidth-a,p=e.offsetHeight-s;if(l||p){var c=kt(e);l-=Ht(c,"x"),p-=Ht(c,"y"),o.width-=l,o.height-=p}return Yt(o)}function $t(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Bt(10),o="HTML"===t.nodeName,i=Xt(e),a=Xt(t),s=At(e),l=kt(t),p=parseFloat(l.borderTopWidth,10),c=parseFloat(l.borderLeftWidth,10);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var u=Yt({top:i.top-a.top-p,left:i.left-a.left-c,width:i.width,height:i.height});if(u.marginTop=0,u.marginLeft=0,!r&&o){var f=parseFloat(l.marginTop,10),d=parseFloat(l.marginLeft,10);u.top-=p-f,u.bottom-=p-f,u.left-=c-d,u.right-=c-d,u.marginTop=f,u.marginLeft=d}return(r&&!n?t.contains(s):t===s&&"BODY"!==s.nodeName)&&(u=Dt(u,t)),u}function Kt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.ownerDocument.documentElement,r=$t(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:jt(n),s=t?0:jt(n,"left"),l={top:a-r.top+r.marginTop,left:s-r.leLine truncated
|
||||
/**!
|
||||
* tippy.js v5.0.0-beta.1
|
||||
* (c) 2017-2019 atomiks
|
||||
* MIT License
|
||||
*/
|
||||
var Pn=1,An=[];function Ln(e,t){var n,r,o,i,a=it(e,t);if(!a.multiple&&e._tippy)return null;var s,l,p=!1,c=!1,u=!1,f=[],d=at(M,a.interactiveDebounce),h=Pn++,m=wt(h,a),v=ft(m),b=v.tooltip,y=v.content,g={currentPlacement:a.placement,isScheduledToShow:!1,isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},w={id:h,reference:e,popper:m,popperChildren:v,popperInstance:null,props:a,state:g,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)},setProps:function(t){var n=Ne({},t);if(w.state.isDestroyed)return;I();var r=w.props,o=it(e,Ne({},w.props,{},n,{ignoreAttributes:!0}));o.ignoreAttributes=Ze(n,"ignoreAttributes")?n.ignoreAttributes||!1:r.ignoreAttributes,w.props=o,L(),_(),d=at(M,o.interactiveDebounce),xt(m,r,o,w.state.isVisible),w.popperChildren=ft(m),w.popperInstance&&(We.some((function(e){return Ze(n,e)&&n[e]!==r[e]}))?(w.popperInstance.destroy(),D(),w.state.isVisible&&w.popperInstance.enableEventListeners()):w.popperInstance.update())},setContent:function(e){w.setProps({content:e})},show:function(t,n){void 0===t&&(t=Ge(w.props.duration,0,Ve.duration));void 0===n&&(n=!0);var r=w.state.isVisible,o=w.state.isDestroyed,i=!w.state.isEnabled,a=Ue.isTouch&&!w.props.touch;if(r||o||i||a)return;if(E().hasAttribute("disabled"))return;if(!1===w.props.onShow(w))return;C(),m.style.visibility="visible",w.state.isVisible=!0;var l=S();rt(n?l.concat(m):l,0),s=function(){w.state.isVisible&&(w.popperInstance.update(),w.props.onMount(w),w.state.isMounted=!0,y.style.transitionDelay=w.popperChildren.backdrop?Math.round(t/12)+"ms":"",w.props.sticky&&function(){rt([m],De?0:w.props.updateDuration);var t=e.getBoundingClientRect();!function n(){var r=e.getBoundingClientRect();t.top===r.top&&t.right===r.right&&t.bottom===r.bottom&&t.left===r.left||w.popperInstance.scheduleUpdate(),t=r,w.state.isMounted&&requestAnimationFrame(n)}()}(),rt([m],w.props.updateDuration),rt(l,t),ot(l,"visible"),function(e,t){P(e,t)}(t,(function(){if(w.props.aria){var e=E(),t="aria-"+w.props.aria,n=e.getAttribute(t),r=n?n+" "+b.id:b.id;e.setAttribute(t,r)}w.props.onShown(w),w.state.isShown=!0})))},function(){c=!1;var t=w.props.appendTo,n="parent"===t?e.parentNode:et(t,[e]);n.contains(m)||n.appendChild(m);w.popperInstance?(tt(w.popperInstance.modifiers,w.props.flip),w.popperInstance.enableEventListeners(),w.popperInstance.scheduleUpdate()):(D(),w.popperInstance.enableEventListeners())}()},hide:function(e){void 0===e&&(e=Ge(w.props.duration,1,Ve.duration));var t=!w.state.isVisible&&!p,n=w.state.isDestroyed,r=!w.state.isEnabled&&!p;if(t||n||r)return;if(!1===w.props.onHide(w)&&!p)return;k(),m.style.visibility="hidden",w.state.isVisible=!1,w.state.isShown=!1;var o=S();rt(o,e),ot(o,"hidden"),function(e,t){P(e,(function(){!w.state.isVisible&&m.parentNode&&m.parentNode.contains(m)&&t()}))}(e,(function(){if(w.props.aria){var e=E(),t="aria-"+w.props.aria,n=e.getAttribute(t),r=n?n.replace(b.id,"").trim():null;r?e.setAttribute(t,r):e.removeAttribute(t)}w.popperInstance.disableEventListeners(),w.popperInstance.options.placement=w.props.placement,m.parentNode.removeChild(m),w.props.onHidden(w),w.state.isMounted=!1}))},enable:function(){w.state.isEnabled=!0},disable:function(){w.hide(),w.state.isEnabled=!1},destroy:function(){if(w.state.isDestroyed)return;p=!0,w.hide(0),I(),delete e._tippy,w.popperInstance&&w.popperInstance.destroy();p=!1,w.state.isDestroyed=!0}};return e._tippy=w,m._tippy=w,L(),a.lazy||D(),a.showOnCreate&&R(),m.addEventListener("mouseenter",(function(){w.props.interactive&&w.state.isVisible&&"mouseenter"===n&&w.clearDelayTimeouts()})),m.addEventListener("mouseleave",(function(){w.props.interactive&&"mouseenter"===n&&document.addEventListener("mousemove",d)})),a.onCreate(w),w;function x(){var e=w.props.touch;return Array.isArray(e)?e:[e,0]}function T(){return"hold"===x()[0]}function S(){return[b,y,w.popperChildren.backdrop]}function E(){return w.props.triggerTarget||e}function _(){document.body.removeEventListener("mouseleave",V),document.removeEventListener("mousemove",d),An=An.filter((function(e){return e!==d}))}function O(e){if(!w.props.interactive||!m.contains(e.target)){if(E().contains(e.target)){if(Ue.isTouch)return;if(w.state.isVisible&&pt(w.props.trigger,"click"))return}!0===w.props.hideOnClick&&(w.clearDelayTimeouts(),w.hide(),u=!0,setTimeout((function(){u=!1})),w.state.isMounted||k())}}function C(){document.addEventListener("mousedown",O,!0)}function k(){document.removeEventListener("mousedown",O,!0)}function P(e,t){function n(e){e.target===b&&(bt(b,"remove",n),t())}if(0===e)return t();bt(b,"remove",l),bt(b,"add",n),l=n}function A(e,t,n){void 0===n&&(n=!1),E().addEventListener(e,t,n),f.push({eventType:e,handler:t,options:n})}function L(){T()&&(A("touchstart",B,ze),A("touchend",N,ze)),pt(w.props.trigger,"click")||A("click",(function(){Ue.isTouch||!0!==w.props.hideOnClick||w.hide()})),w.props.trigger.trim().split(" ").forEach((function(e){if("manual"!==e)switch(A(e,B),e){case"mouseenter":A("mouseleave",NLine truncated
|
||||
/**!
|
||||
* tippy.js v5.0.0-beta.1
|
||||
* (c) 2017-2019 atomiks
|
||||
* MIT License
|
||||
*/;function Bn(e){return Ce(e)&&""!==e?"-"!==e.charAt(e.length-1)?e+"-":e:""}function Mn(t){var n=t.options.attachTo||{},r=e({},n);if(Ce(n.element)){try{r.element=document.querySelector(n.element)}catch(e){}r.element||console.error("The element for this Shepherd step was not found "+n.element)}return r}function Nn(t){if(ke(In))throw new Error("Using the attachment feature of Shepherd requires the Tippy.js library");t.tooltip&&t.tooltip.destroy();var n=Mn(t);t.tooltip=function(t,n){var r={},o=document.body;t.element&&t.on?(r=function(t,n){var r=Me(n),o=r.popperOptions,i=r.tippyOptions;i.flipOnUpdate=!0,i.placement=t.on||"right";var a=R(n,"options.tippyOptions.popperOptions");return a&&(o=e({},o,{},a,{modifiers:e({},o.modifiers,{},a.modifiers)})),i.popperOptions=o,i}(t,n),o=t.element):r=Be(n);return In(o,r)}(n,t),t.target=n.element}Fe&&function(e){var t=document.createElement("style");t.textContent=e,t.setAttribute("data-tippy-stylesheet","");var n=document.head,r=n.querySelector("style,link");r?n.insertBefore(t,r):n.appendChild(t)}(".tippy-tooltip[data-animation=fade][data-state=hidden]{opacity:0}.tippy-iOS{cursor:pointer!important;-webkit-tap-highlight-color:transparent}.tippy-popper{pointer-events:none;max-width:calc(100% - 10px);transition-timing-function:cubic-bezier(.165,.84,.44,1)}.tippy-tooltip{position:relative;color:#fff;border-radius:.25rem;font-size:.875rem;line-height:1.4;background-color:#333;overflow:hidden;transition-property:visibility,opacity,transform;outline:0}.tippy-tooltip[data-placement^=top] .tippy-arrow{border-width:8px 8px 0;border-top-color:#333;margin:0 3px;transform-origin:50% 0;bottom:-7px}.tippy-tooltip[data-placement^=bottom] .tippy-arrow{border-width:0 8px 8px;border-bottom-color:#333;margin:0 3px;transform-origin:50% 7px;top:-7px}.tippy-tooltip[data-placement^=left] .tippy-arrow{border-width:8px 0 8px 8px;border-left-color:#333;margin:3px 0;transform-origin:0 50%;right:-7px}.tippy-tooltip[data-placement^=right] .tippy-arrow{border-width:8px 8px 8px 0;border-right-color:#333;margin:3px 0;transform-origin:7px 50%;left:-7px}.tippy-tooltip[data-arrow]{overflow:visible}.tippy-tooltip[data-animatefill]{background-color:transparent!important}.tippy-tooltip[data-interactive]{pointer-events:auto}.tippy-tooltip[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-tooltip[data-inertia][data-state=hidden]{transition-timing-function:ease}.tippy-arrow{border-color:transparent;border-style:solid;position:absolute}.tippy-arrow[data-state=hidden]{opacity:0}.tippy-content{padding:.3125rem .5625rem}");var Fn=function(e){function n(){return e.apply(this,arguments)||this}return t(n,e),n.prototype.render=function(e){var t=e.classPrefix,n=e.config,r=e.step,o=e.styles,i=n.action,a=n.classes,s=n.secondary,l=n.text;return Ee.h("button",{className:(a||"")+o.button+(s?" "+t+"shepherd-button-secondary":""),onClick:i?i.bind(r.tour):null,tabindex:"0"},l)},n}(Ee.Component),jn=function(e){function n(){return e.apply(this,arguments)||this}t(n,e);var r=n.prototype;return r.render=function(e){var t=e.classPrefix,n=e.step,r=e.styles,o=n.options.buttons;return Ee.h("footer",{className:r.footer.trim()},this._addButtons(o,t,n,r))},r._addButtons=function(e,t,n,r){return e?e.map((function(e){return Ee.h(Fn,{classPrefix:t,config:e,key:e.toString(),step:n,styles:r})})):null},n}(Ee.Component),Dn=function(e){function r(t){var r;return(r=e.call(this,t)||this).step=t.step,r.handleCancelClick=r.handleCancelClick.bind(n(r)),r}t(r,e);var o=r.prototype;return o.render=function(e){var t=e.labelId,n=e.step,r=e.styles,o=n.options,i=o.cancelIcon,a=o.title;return Ee.h("header",{className:r.header.trim()},this.constructor._addTitle(t,r,a),this._addCancelLink(i,r))},o.handleCancelClick=function(e){e.preventDefault(),this.step.cancel()},r._addTitle=function(e,t,n){return n?Ee.h("h3",{id:e,className:t.title.trim()},n):null},o._addCancelLink=function(e,t){return e&&e.enabled?Ee.h("button",{"aria-label":e.label?e.label:"Close Tour",className:t["cancel-icon"].trim(),onClick:this.handleCancelClick,type:"button"},Ee.h("span",{"aria-hidden":"true"},"×")):null},r}(Ee.Component),Hn=function(e){function n(){return e.apply(this,arguments)||this}t(n,e);var r=n.prototype;return r.shouldComponentUpdate=function(){return!1},r.componentDidMount=function(){var e=this.props.step,t=e.options.text;Oe(t)&&(t=t.call(e)),_e(t)&&this.base.appendChild(t)},r.render=function(e){var t=e.descriptionId,n=e.step,r=e.styles,o=n.options.text;return Oe(o)&&(o=o.call(n)),Ee.h("div",{className:r.text.trim(),dangerouslySetInnerHTML:{__html:_e(o)?null:o},id:t})},n}(Ee.Component),Rn=function(e){function n(){return e.apply(this,arguments)||this}return t(n,e),n.prototype.render=function(e){var t=e.classPrefix,r=e.descriptionId,o=e.labelId,i=e.step,a=e.styles;return Ee.h("div",{className:a.content.trim()},Ee.h(Dn,{labelId:o,step:i,styles:a}),n._addShepherdText(r,i,a),n._addShepherdFooter(t,i,a))},n._addShepherdText=function(e,Line truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* sweetalert2 v9.10.7
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sweetalert2=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function l(t,e,n){return(l=r()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var a=new(Function.bind.apply(t,o));return n&&i(a,n.prototype),a}).apply(null,arguments)}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(o){var a=Object.getOwnPropertyDescriptor(o,e);return a.get?a.get.call(n):a.value}})(t,e,n||t)}var d=function(t){return Object.keys(t).map((function(e){return t[e]}))},p=function(t){return Array.prototype.slice.call(t)},m=function(t){console.warn("".concat("SweetAlert2:"," ").concat(t))},w=function(t){console.error("".concat("SweetAlert2:"," ").concat(t))},f=[],g=function(t,e){var n;n='"'.concat(t,'" is deprecated and will be removed in the next major release. Please use "').concat(e,'" instead.'),-1===f.indexOf(n)&&(f.push(n),m(n))},h=function(t){return"function"==typeof t?t():t},b=function(t){return t&&Promise.resolve(t)===t},y=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),v=function(e){return e instanceof Element||function(e){return"object"===t(e)&&e.jquery}(e)},k=function(t){var e={};for(var n in t)e[t[n]]="swal2-"+t[n];return e},x=k(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","toast-column","show","hide","close","title","header","content","html-container","actions","confirm","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),C=k(["success","warning","info","question","error"]),P=function(){return document.body.querySelector(".".concat(x.container))},A=function(t){var e=P();return e?e.querySelector(t):null},S=function(t){return A(".".concat(t))},B=function(){return S(x.popup)},E=function(){var t=B();return p(t.querySelectorAll(".".concat(x.icon)))},O=function(){var t=E().filter((function(t){return it(t)}));return t.length?t[0]:null},T=function(){return S(x.title)},j=function(){return S(x.content)},L=function(){return S(x.image)},z=function(){return S(x["progress-steps"])},q=function(){return S(x["validation-message"])},I=function(){return A(".".concat(x.actions," .").concat(x.confirm))},M=function(){return A(".".concat(x.actions," .").concat(x.cancel))},V=function(){return S(x.actions)},R=function(){return S(x.header)},H=function(){return S(x.footer)},D=function(){return S(x["timer-progress-bar"])},N=function(){return S(x.close)},U=function(){var t=p(B().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort((function(t,e){return(t=parseInt(t.getAttribute("tabindex")))>(e=parseInt(e.getAttribute("tabindex")))?1:t<e?-1:0})),e=p(B().querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disLine truncated
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* TipTip
|
||||
* Copyright 2010 Drew Wilson
|
||||
* www.drewwilson.com
|
||||
* code.drewwilson.com/entry/tiptip-jquery-plugin
|
||||
*
|
||||
* Version 1.3 - Updated: Mar. 23, 2010
|
||||
*
|
||||
* This Plug-In will create a custom tooltip to replace the default
|
||||
* browser tooltip. It is extremely lightweight and very smart in
|
||||
* that it detects the edges of the browser window and will make sure
|
||||
* the tooltip stays within the current window size. As a result the
|
||||
* tooltip will adjust itself to be displayed above, below, to the left
|
||||
* or to the right depending on what is necessary to stay within the
|
||||
* browser window. It is completely customizable as well via CSS.
|
||||
*
|
||||
* This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
(function($){
|
||||
$.fn.tipTip = function(options) {
|
||||
var defaults = {
|
||||
activation: "hover",
|
||||
keepAlive: false,
|
||||
maxWidth: "200px",
|
||||
edgeOffset: 10,
|
||||
defaultPosition: "bottom",
|
||||
delay: 400,
|
||||
fadeIn: 200,
|
||||
fadeOut: 200,
|
||||
attribute: "title",
|
||||
content: false, // HTML or String to fill TipTIp with
|
||||
enter: function(){},
|
||||
exit: function(){}
|
||||
};
|
||||
var opts = $.extend(defaults, options);
|
||||
|
||||
// Setup tip tip elements and render them to the DOM
|
||||
if($("#tiptip_holder").length <= 0){
|
||||
var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
|
||||
var tiptip_content = $('<div id="tiptip_content"></div>');
|
||||
var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
|
||||
$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
|
||||
} else {
|
||||
var tiptip_holder = $("#tiptip_holder");
|
||||
var tiptip_content = $("#tiptip_content");
|
||||
var tiptip_arrow = $("#tiptip_arrow");
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var org_elem = $(this);
|
||||
if(opts.content){
|
||||
var org_title = opts.content;
|
||||
} else {
|
||||
var org_title = org_elem.attr(opts.attribute);
|
||||
}
|
||||
if(org_title != ""){
|
||||
if(!opts.content){
|
||||
// org_elem.removeAttr(opts.attribute); //remove original Attribute
|
||||
org_elem.attr('data-' + opts.attribute, org_title); //saves a backup
|
||||
}
|
||||
var timeout = false;
|
||||
|
||||
if(opts.activation == "hover"){
|
||||
org_elem.hover(function(){
|
||||
active_tiptip();
|
||||
}, function(){
|
||||
if(!opts.keepAlive){
|
||||
deactive_tiptip();
|
||||
}
|
||||
});
|
||||
if(opts.keepAlive){
|
||||
tiptip_holder.hover(function(){}, function(){
|
||||
deactive_tiptip();
|
||||
});
|
||||
}
|
||||
} else if(opts.activation == "focus"){
|
||||
org_elem.focus(function(){
|
||||
active_tiptip();
|
||||
}).blur(function(){
|
||||
deactive_tiptip();
|
||||
});
|
||||
} else if(opts.activation == "click"){
|
||||
org_elem.click(function(){
|
||||
active_tiptip();
|
||||
return false;
|
||||
}).hover(function(){},function(){
|
||||
if(!opts.keepAlive){
|
||||
deactive_tiptip();
|
||||
}
|
||||
});
|
||||
if(opts.keepAlive){
|
||||
tiptip_holder.hover(function(){}, function(){
|
||||
deactive_tiptip();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function active_tiptip(){
|
||||
opts.enter.call(this);
|
||||
tiptip_content.html(org_title);
|
||||
tiptip_holder.hide().removeAttr("class").css("margin","0");
|
||||
tiptip_arrow.removeAttr("style");
|
||||
|
||||
var top = parseInt(org_elem.offset()['top']);
|
||||
var left = parseInt(org_elem.offset()['left']);
|
||||
var org_width = parseInt(org_elem.outerWidth());
|
||||
var org_height = parseInt(org_elem.outerHeight());
|
||||
var tip_w = tiptip_holder.outerWidth();
|
||||
var tip_h = tiptip_holder.outerHeight();
|
||||
var w_compare = Math.round((org_width - tip_w) / 2);
|
||||
var h_compare = Math.round((org_height - tip_h) / 2);
|
||||
var marg_left = Math.round(left + w_compare);
|
||||
var marg_top = Math.round(top + org_height + opts.edgeOffset);
|
||||
var t_class = "";
|
||||
var arrow_top = "";
|
||||
var arrow_left = Math.round(tip_w - 12) / 2;
|
||||
|
||||
if(opts.defaultPosition == "bottom"){
|
||||
t_class = "_bottom";
|
||||
} else if(opts.defaultPosition == "top"){
|
||||
t_class = "_top";
|
||||
} else if(opts.defaultPosition == "left"){
|
||||
t_class = "_left";
|
||||
} else if(opts.defaultPosition == "right"){
|
||||
t_class = "_right";
|
||||
}
|
||||
|
||||
var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
|
||||
var left_compare = (tip_w + left) > parseInt($(window).width());
|
||||
|
||||
if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
|
||||
t_class = "_right";
|
||||
arrow_top = Math.round(tip_h - 13) / 2;
|
||||
arrow_left = -12;
|
||||
marg_left = Math.round(left + org_width + opts.edgeOffset);
|
||||
marg_top = Math.round(top + h_compare);
|
||||
} else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
|
||||
t_class = "_left";
|
||||
arrow_top = Math.round(tip_h - 13) / 2;
|
||||
arrow_left = Math.round(tip_w);
|
||||
marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
|
||||
marg_top = Math.round(top + h_compare);
|
||||
}
|
||||
|
||||
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
|
||||
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
|
||||
|
||||
if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
|
||||
if(t_class == "_top" || t_class == "_bottom"){
|
||||
t_class = "_top";
|
||||
} else {
|
||||
t_class = t_class+"_top";
|
||||
}
|
||||
arrow_top = tip_h;
|
||||
marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
|
||||
} else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
|
||||
if(t_class == "_top" || t_class == "_bottom"){
|
||||
t_class = "_bottom";
|
||||
} else {
|
||||
t_class = t_class+"_bottom";
|
||||
}
|
||||
arrow_top = -12;
|
||||
marg_top = Math.round(top + org_height + opts.edgeOffset);
|
||||
}
|
||||
|
||||
if(t_class == "_right_top" || t_class == "_left_top"){
|
||||
marg_top = marg_top + 5;
|
||||
} else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
|
||||
marg_top = marg_top - 5;
|
||||
}
|
||||
if(t_class == "_left_top" || t_class == "_left_bottom"){
|
||||
marg_left = marg_left + 5;
|
||||
}
|
||||
tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
|
||||
tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
|
||||
|
||||
if (timeout){ clearTimeout(timeout); }
|
||||
timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
|
||||
}
|
||||
|
||||
function deactive_tiptip(){
|
||||
opts.exit.call(this);
|
||||
if (timeout){ clearTimeout(timeout); }
|
||||
tiptip_holder.fadeOut(opts.fadeOut);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t){t.fn.tipTip=function(e){var o=t.extend({activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:10,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},e);if(t("#tiptip_holder").length<=0){var i=t('<div id="tiptip_holder" style="max-width:'+o.maxWidth+';"></div>'),n=t('<div id="tiptip_content"></div>'),r=t('<div id="tiptip_arrow"></div>');t("body").append(i.html(n).prepend(r.html('<div id="tiptip_arrow_inner"></div>')))}else i=t("#tiptip_holder"),n=t("#tiptip_content"),r=t("#tiptip_arrow");return this.each((function(){var e=t(this);if(o.content)var a=o.content;else a=e.attr(o.attribute);if(""!=a){o.content||e.attr("data-"+o.attribute,a);var f=!1;function d(){o.enter.call(this),n.html(a),i.hide().removeAttr("class").css("margin","0"),r.removeAttr("style");var d=parseInt(e.offset().top),u=parseInt(e.offset().left),p=parseInt(e.outerWidth()),l=parseInt(e.outerHeight()),h=i.outerWidth(),c=i.outerHeight(),s=Math.round((p-h)/2),_=Math.round((l-c)/2),v=Math.round(u+s),m=Math.round(d+l+o.edgeOffset),g="",b="",M=Math.round(h-12)/2;"bottom"==o.defaultPosition?g="_bottom":"top"==o.defaultPosition?g="_top":"left"==o.defaultPosition?g="_left":"right"==o.defaultPosition&&(g="_right");var w=s+u<parseInt(t(window).scrollLeft()),O=h+u>parseInt(t(window).width());w&&s<0||"_right"==g&&!O||"_left"==g&&u<h+o.edgeOffset+5?(g="_right",b=Math.round(c-13)/2,M=-12,v=Math.round(u+p+o.edgeOffset),m=Math.round(d+_)):(O&&s<0||"_left"==g&&!w)&&(g="_left",b=Math.round(c-13)/2,M=Math.round(h),v=Math.round(u-(h+o.edgeOffset+5)),m=Math.round(d+_));var x=d+l+o.edgeOffset+c+8>parseInt(t(window).height()+t(window).scrollTop()),I=d+l-(o.edgeOffset+c+8)<0;x||"_bottom"==g&&x||"_top"==g&&!I?("_top"==g||"_bottom"==g?g="_top":g+="_top",b=c,m=Math.round(d-(c+5+o.edgeOffset))):(I|("_top"==g&&I)||"_bottom"==g&&!x)&&("_top"==g||"_bottom"==g?g="_bottom":g+="_bottom",b=-12,m=Math.round(d+l+o.edgeOffset)),"_right_top"==g||"_left_top"==g?m+=5:"_right_bottom"!=g&&"_left_bottom"!=g||(m-=5),"_left_top"!=g&&"_left_bottom"!=g||(v+=5),r.css({"margin-left":M+"px","margin-top":b+"px"}),i.css({"margin-left":v+"px","margin-top":m+"px"}).attr("class","tip"+g),f&&clearTimeout(f),f=setTimeout((function(){i.stop(!0,!0).fadeIn(o.fadeIn)}),o.delay)}function u(){o.exit.call(this),f&&clearTimeout(f),i.fadeOut(o.fadeOut)}"hover"==o.activation?(e.hover((function(){d()}),(function(){o.keepAlive||u()})),o.keepAlive&&i.hover((function(){}),(function(){u()}))):"focus"==o.activation?e.focus((function(){d()})).blur((function(){u()})):"click"==o.activation&&(e.click((function(){return d(),!1})).hover((function(){}),(function(){o.keepAlive||u()})),o.keepAlive&&i.hover((function(){}),(function(){u()})))}}))}}(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
(function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VMoney=t():e.VMoney=t()})(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p=".",t(t.s=9)}([function(e,t,n){"use strict";t.a={prefix:"",suffix:"",thousands:",",decimal:".",precision:2}},function(e,t,n){"use strict";var r=n(2),i=n(5),u=n(0);t.a=function(e,t){if(t.value){var o=n.i(i.a)(u.a,t.value);if("INPUT"!==e.tagName.toLocaleUpperCase()){var a=e.getElementsByTagName("input");1!==a.length||(e=a[0])}e.oninput=function(){var t=e.value.length-e.selectionEnd;e.value=n.i(r.a)(e.value,o),t=Math.max(t,o.suffix.length),t=e.value.length-t,t=Math.max(t,o.prefix.length+1),n.i(r.b)(e,t),e.dispatchEvent(n.i(r.c)("change"))},e.onfocus=function(){n.i(r.b)(e,e.value.length-o.suffix.length)},e.oninput(),e.dispatchEvent(n.i(r.c)("input"))}}},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m.a;"number"==typeof e&&(e=e.toFixed(o(t.precision)));var n=e.indexOf("-")>=0?"-":"",r=u(e),i=c(r,t.precision),a=d(i).split("."),p=a[0],l=a[1];return p=f(p,t.thousands),t.prefix+n+s(p,l,t.decimal)+t.suffix}function i(e,t){var n=e.indexOf("-")>=0?-1:1,r=u(e),i=c(r,t);return parseFloat(i)*n}function u(e){return d(e).replace(/\D+/g,"")||"0"}function o(e){return a(0,e,20)}function a(e,t,n){return Math.max(e,Math.min(t,n))}function c(e,t){var n=Math.pow(10,t);return(parseFloat(e)/n).toFixed(o(t))}function f(e,t){return e.replace(/(\d)(?=(?:\d{3})+\b)/gm,"$1"+t)}function s(e,t,n){return t?e+n+t:e}function d(e){return e?e.toString():""}function p(e,t){var n=function(){e.setSelectionRange(t,t)};e===document.activeElement&&(n(),setTimeout(n,1))}function l(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var m=n(0);n.d(t,"a",function(){return r}),n.d(t,"d",function(){return i}),n.d(t,"b",function(){return p}),n.d(t,"c",function(){return l})},function(e,t,n){"use strict";function r(e,t){t&&Object.keys(t).map(function(e){a.a[e]=t[e]}),e.directive("money",o.a),e.component("money",u.a)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),u=n.n(i),o=n(1),a=n(0);n.d(t,"Money",function(){return u.a}),n.d(t,"VMoney",function(){return o.a}),n.d(t,"options",function(){return a.a}),n.d(t,"VERSION",function(){return c});var c="0.8.1";t.default=r,"undefined"!=typeof window&&window.Vue&&window.Vue.use(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(0),u=n(2);t.default={name:"Money",props:{value:{required:!0,type:[Number,String],default:0},masked:{type:Boolean,default:!1},precision:{type:Number,default:function(){return i.a.precision}},decimal:{type:String,default:function(){return i.a.decimal}},thousands:{type:String,default:function(){return i.a.thousands}},prefix:{type:String,default:function(){return i.a.prefix}},suffix:{type:String,default:function(){return i.a.suffix}}},directives:{money:r.a},data:function(){return{formattedValue:""}},watch:{value:{immediate:!0,handler:function(e,t){var r=n.i(u.a)(e,this.$props);r!==this.formattedValue&&(this.formattedValue=r)}}},methods:{change:function(e){this.$emit("input",this.masked?e.target.value:n.i(u.d)(e.target.value,this.precision))}}}},function(e,t,n){"use strict";t.a=function(e,t){return e=e||{},t=t||{},Object.keys(e).concat(Object.keys(t)).reduce(function(n,r){return n[r]=void 0===t[r]?e[r]:t[r],n},{})}},function(e,t,n){var r=n(7)(n(4),n(8),null,null);e.exports=r.exports},function(e,t){e.exports=function(e,t,n,r){var i,u=e=e||{},o=typeof e.default;"object"!==o&&"function"!==o||(i=e,u=e.default);var a="function"==typeof u?u.options:u;if(t&&(a.render=t.render,a.staticRenderFns=t.staticRenderFns),n&&(a._scopeId=n),r){var c=a.computed||(a.computed={});Object.keys(r).forEach(function(e){var t=r[e];c[e]=function(){return t}})}return{esModule:i,exports:u,options:a}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("input",{directives:[{name:"money",rawName:"v-money",value:{precision:e.precision,decimal:e.decimal,thousands:e.thousands,prefix:e.prefix,suffix:e.suffix},expression:"{precision, decimal, thousands, prefix, suffix}"}],staticClass:"v-money",attrs:{type:"tel"},domProps:{value:e.formattedValue},on:{change:e.change}})},staticRenderFns:[]}},function(e,t,n){e.exports=n(3)}])});
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VMoney=t():e.VMoney=t()}(this,(function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p=".",t(t.s=9)}([function(e,t,n){"use strict";t.a={prefix:"",suffix:"",thousands:",",decimal:".",precision:2}},function(e,t,n){"use strict";var r=n(2),i=n(5),u=n(0);t.a=function(e,t){if(t.value){var o=n.i(i.a)(u.a,t.value);if("INPUT"!==e.tagName.toLocaleUpperCase()){var a=e.getElementsByTagName("input");1!==a.length||(e=a[0])}e.oninput=function(){var t=e.value.length-e.selectionEnd;e.value=n.i(r.a)(e.value,o),t=Math.max(t,o.suffix.length),t=e.value.length-t,t=Math.max(t,o.prefix.length+1),n.i(r.b)(e,t),e.dispatchEvent(n.i(r.c)("change"))},e.onfocus=function(){n.i(r.b)(e,e.value.length-o.suffix.length)},e.oninput(),e.dispatchEvent(n.i(r.c)("input"))}}},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.a;"number"==typeof e&&(e=e.toFixed(o(t.precision)));var n=e.indexOf("-")>=0?"-":"",r=u(e),i=a(r,t.precision),d=s(i).split("."),p=d[0],m=d[1];return p=c(p,t.thousands),t.prefix+n+f(p,m,t.decimal)+t.suffix}function i(e,t){var n=e.indexOf("-")>=0?-1:1,r=a(u(e),t);return parseFloat(r)*n}function u(e){return s(e).replace(/\D+/g,"")||"0"}function o(e){return function(e,t,n){return Math.max(e,Math.min(t,n))}(0,e,20)}function a(e,t){var n=Math.pow(10,t);return(parseFloat(e)/n).toFixed(o(t))}function c(e,t){return e.replace(/(\d)(?=(?:\d{3})+\b)/gm,"$1"+t)}function f(e,t,n){return t?e+n+t:e}function s(e){return e?e.toString():""}function d(e,t){var n=function(){e.setSelectionRange(t,t)};e===document.activeElement&&(n(),setTimeout(n,1))}function p(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var l=n(0);n.d(t,"a",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return p}))},function(e,t,n){"use strict";function r(e,t){t&&Object.keys(t).map((function(e){a.a[e]=t[e]})),e.directive("money",o.a),e.component("money",u.a)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),u=n.n(i),o=n(1),a=n(0);n.d(t,"Money",(function(){return u.a})),n.d(t,"VMoney",(function(){return o.a})),n.d(t,"options",(function(){return a.a})),n.d(t,"VERSION",(function(){return c}));var c="0.8.1";t.default=r,"undefined"!=typeof window&&window.Vue&&window.Vue.use(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(0),u=n(2);t.default={name:"Money",props:{value:{required:!0,type:[Number,String],default:0},masked:{type:Boolean,default:!1},precision:{type:Number,default:function(){return i.a.precision}},decimal:{type:String,default:function(){return i.a.decimal}},thousands:{type:String,default:function(){return i.a.thousands}},prefix:{type:String,default:function(){return i.a.prefix}},suffix:{type:String,default:function(){return i.a.suffix}}},directives:{money:r.a},data:function(){return{formattedValue:""}},watch:{value:{immediate:!0,handler:function(e,t){var r=n.i(u.a)(e,this.$props);r!==this.formattedValue&&(this.formattedValue=r)}}},methods:{change:function(e){this.$emit("input",this.masked?e.target.value:n.i(u.d)(e.target.value,this.precision))}}}},function(e,t,n){"use strict";t.a=function(e,t){return e=e||{},t=t||{},Object.keys(e).concat(Object.keys(t)).reduce((function(n,r){return n[r]=void 0===t[r]?e[r]:t[r],n}),{})}},function(e,t,n){var r=n(7)(n(4),n(8),null,null);e.exports=r.exports},function(e,t){e.exports=function(e,t,n,r){var i,u=e=e||{},o=typeof e.default;"object"!==o&&"function"!==o||(i=e,u=e.default);var a="function"==typeof u?u.options:u;if(t&&(a.render=t.render,a.staticRenderFns=t.staticRenderFns),n&&(a._scopeId=n),r){var c=a.computed||(a.computed={});Object.keys(r).forEach((function(e){var t=r[e];c[e]=function(){return t}}))}return{esModule:i,exports:u,options:a}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("input",{directives:[{name:"money",rawName:"v-money",value:{precision:e.precision,decimal:e.decimal,thousands:e.thousands,prefix:e.prefix,suffix:e.suffix},expression:"{precision, decimal, thousands, prefix, suffix}"}],staticClass:"v-money",attrs:{type:"tel"},domProps:{value:e.formattedValue},on:{change:e.change}})},staticRenderFns:[]}},function(e,t,n){e.exports=n(3)}])}));
|
||||
@@ -0,0 +1,263 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('apexcharts')) :
|
||||
typeof define === 'function' && define.amd ? define(['apexcharts'], factory) :
|
||||
(global.VueApexCharts = factory(global.ApexCharts));
|
||||
}(this, (function (ApexCharts) { 'use strict';
|
||||
|
||||
ApexCharts = ApexCharts && ApexCharts.hasOwnProperty('default') ? ApexCharts['default'] : ApexCharts;
|
||||
|
||||
function _typeof(obj) {
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
};
|
||||
} else {
|
||||
_typeof = function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
}
|
||||
|
||||
return _typeof(obj);
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
var ApexChartsComponent = {
|
||||
props: {
|
||||
options: {
|
||||
type: Object
|
||||
},
|
||||
type: {
|
||||
type: String
|
||||
},
|
||||
series: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
width: {
|
||||
default: "100%"
|
||||
},
|
||||
height: {
|
||||
default: "auto"
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
chart: null
|
||||
};
|
||||
},
|
||||
beforeMount: function beforeMount() {
|
||||
window.ApexCharts = ApexCharts;
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.init();
|
||||
},
|
||||
created: function created() {
|
||||
var _this = this;
|
||||
|
||||
this.$watch("options", function (options) {
|
||||
if (!_this.chart && options) {
|
||||
_this.init();
|
||||
} else {
|
||||
_this.chart.updateOptions(_this.options);
|
||||
}
|
||||
});
|
||||
this.$watch("series", function (series) {
|
||||
if (!_this.chart && series) {
|
||||
_this.init();
|
||||
} else {
|
||||
_this.chart.updateSeries(_this.series);
|
||||
}
|
||||
});
|
||||
var watched = ["type", "width", "height"];
|
||||
watched.forEach(function (prop) {
|
||||
_this.$watch(prop, function () {
|
||||
_this.refresh();
|
||||
});
|
||||
});
|
||||
},
|
||||
beforeDestroy: function beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.destroy();
|
||||
},
|
||||
render: function render(createElement) {
|
||||
return createElement("div");
|
||||
},
|
||||
methods: {
|
||||
init: function init() {
|
||||
var _this2 = this;
|
||||
|
||||
var newOptions = {
|
||||
chart: {
|
||||
type: this.type || this.options.chart.type || "line",
|
||||
height: this.height,
|
||||
width: this.width,
|
||||
events: {}
|
||||
},
|
||||
series: this.series
|
||||
};
|
||||
Object.keys(this.$listeners).forEach(function (evt) {
|
||||
newOptions.chart.events[evt] = _this2.$listeners[evt];
|
||||
});
|
||||
var config = this.extend(this.options, newOptions);
|
||||
this.chart = new ApexCharts(this.$el, config);
|
||||
return this.chart.render();
|
||||
},
|
||||
isObject: function isObject(item) {
|
||||
return item && _typeof(item) === "object" && !Array.isArray(item) && item != null;
|
||||
},
|
||||
extend: function extend(target, source) {
|
||||
var _this3 = this;
|
||||
|
||||
if (typeof Object.assign !== "function") {
|
||||
(function () {
|
||||
Object.assign = function (target) {
|
||||
// We must check against these specific cases.
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError("Cannot convert undefined or null to object");
|
||||
}
|
||||
|
||||
var output = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var _source = arguments[index];
|
||||
|
||||
if (_source !== undefined && _source !== null) {
|
||||
for (var nextKey in _source) {
|
||||
if (_source.hasOwnProperty(nextKey)) {
|
||||
output[nextKey] = _source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
var output = Object.assign({}, target);
|
||||
|
||||
if (this.isObject(target) && this.isObject(source)) {
|
||||
Object.keys(source).forEach(function (key) {
|
||||
if (_this3.isObject(source[key])) {
|
||||
if (!(key in target)) {
|
||||
Object.assign(output, _defineProperty({}, key, source[key]));
|
||||
} else {
|
||||
output[key] = _this3.extend(target[key], source[key]);
|
||||
}
|
||||
} else {
|
||||
Object.assign(output, _defineProperty({}, key, source[key]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
refresh: function refresh() {
|
||||
this.destroy();
|
||||
return this.init();
|
||||
},
|
||||
destroy: function destroy() {
|
||||
this.chart.destroy();
|
||||
},
|
||||
updateSeries: function updateSeries(newSeries, animate) {
|
||||
return this.chart.updateSeries(newSeries, animate);
|
||||
},
|
||||
updateOptions: function updateOptions(newOptions, redrawPaths, animate, updateSyncedCharts) {
|
||||
return this.chart.updateOptions(newOptions, redrawPaths, animate, updateSyncedCharts);
|
||||
},
|
||||
toggleSeries: function toggleSeries(seriesName) {
|
||||
return this.chart.toggleSeries(seriesName);
|
||||
},
|
||||
showSeries: function showSeries(seriesName) {
|
||||
this.chart.showSeries(seriesName);
|
||||
},
|
||||
hideSeries: function hideSeries(seriesName) {
|
||||
this.chart.hideSeries(seriesName);
|
||||
},
|
||||
appendSeries: function appendSeries(newSeries, animate) {
|
||||
return this.chart.appendSeries(newSeries, animate);
|
||||
},
|
||||
resetSeries: function resetSeries() {
|
||||
this.chart.resetSeries();
|
||||
},
|
||||
zoomX: function zoomX(min, max) {
|
||||
this.chart.zoomX(min, max);
|
||||
},
|
||||
toggleDataPointSelection: function toggleDataPointSelection(seriesIndex, dataPointIndex) {
|
||||
this.chart.toggleDataPointSelection(seriesIndex, dataPointIndex);
|
||||
},
|
||||
appendData: function appendData(newData) {
|
||||
return this.chart.appendData(newData);
|
||||
},
|
||||
addText: function addText(options) {
|
||||
this.chart.addText(options);
|
||||
},
|
||||
addImage: function addImage(options) {
|
||||
this.chart.addImage(options);
|
||||
},
|
||||
addShape: function addShape(options) {
|
||||
this.chart.addShape(options);
|
||||
},
|
||||
dataURI: function dataURI() {
|
||||
return this.chart.dataURI();
|
||||
},
|
||||
setLocale: function setLocale(localeName) {
|
||||
return this.chart.setLocale(localeName);
|
||||
},
|
||||
addXaxisAnnotation: function addXaxisAnnotation(options, pushToMemory) {
|
||||
this.chart.addXaxisAnnotation(options, pushToMemory);
|
||||
},
|
||||
addYaxisAnnotation: function addYaxisAnnotation(options, pushToMemory) {
|
||||
this.chart.addYaxisAnnotation(options, pushToMemory);
|
||||
},
|
||||
addPointAnnotation: function addPointAnnotation(options, pushToMemory) {
|
||||
this.chart.addPointAnnotation(options, pushToMemory);
|
||||
},
|
||||
removeAnnotation: function removeAnnotation(id, options) {
|
||||
this.chart.removeAnnotation(id, options);
|
||||
},
|
||||
clearAnnotations: function clearAnnotations() {
|
||||
this.chart.clearAnnotations();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var VueApexCharts = ApexChartsComponent;
|
||||
window.ApexCharts = ApexCharts;
|
||||
|
||||
VueApexCharts.install = function (Vue) {
|
||||
//adding a global method or property
|
||||
Vue.ApexCharts = ApexCharts;
|
||||
window.ApexCharts = ApexCharts; // add the instance method
|
||||
|
||||
Object.defineProperty(Vue.prototype, '$apexcharts', {
|
||||
get: function get() {
|
||||
return ApexCharts;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return VueApexCharts;
|
||||
|
||||
})));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("apexcharts")):"function"==typeof define&&define.amd?define(["apexcharts"],e):t.VueApexCharts=e(t.ApexCharts)}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}t=t&&t.hasOwnProperty("default")?t.default:t;var i={props:{options:{type:Object},type:{type:String},series:{type:Array,required:!0,default:function(){return[]}},width:{default:"100%"},height:{default:"auto"}},data:function(){return{chart:null}},beforeMount:function(){window.ApexCharts=t},mounted:function(){this.init()},created:function(){var t=this;this.$watch("options",(function(e){!t.chart&&e?t.init():t.chart.updateOptions(t.options)})),this.$watch("series",(function(e){!t.chart&&e?t.init():t.chart.updateSeries(t.series)}));["type","width","height"].forEach((function(e){t.$watch(e,(function(){t.refresh()}))}))},beforeDestroy:function(){this.chart&&this.destroy()},render:function(t){return t("div")},methods:{init:function(){var e=this,n={chart:{type:this.type||this.options.chart.type||"line",height:this.height,width:this.width,events:{}},series:this.series};Object.keys(this.$listeners).forEach((function(t){n.chart.events[t]=e.$listeners[t]}));var i=this.extend(this.options,n);return this.chart=new t(this.$el,i),this.chart.render()},isObject:function(t){return t&&"object"===e(t)&&!Array.isArray(t)&&null!=t},extend:function(t,e){var i=this;"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e});var r=Object.assign({},t);return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach((function(o){i.isObject(e[o])&&o in t?r[o]=i.extend(t[o],e[o]):Object.assign(r,n({},o,e[o]))})),r},refresh:function(){return this.destroy(),this.init()},destroy:function(){this.chart.destroy()},updateSeries:function(t,e){return this.chart.updateSeries(t,e)},updateOptions:function(t,e,n,i){return this.chart.updateOptions(t,e,n,i)},toggleSeries:function(t){return this.chart.toggleSeries(t)},showSeries:function(t){this.chart.showSeries(t)},hideSeries:function(t){this.chart.hideSeries(t)},appendSeries:function(t,e){return this.chart.appendSeries(t,e)},resetSeries:function(){this.chart.resetSeries()},zoomX:function(t,e){this.chart.zoomX(t,e)},toggleDataPointSelection:function(t,e){this.chart.toggleDataPointSelection(t,e)},appendData:function(t){return this.chart.appendData(t)},addText:function(t){this.chart.addText(t)},addImage:function(t){this.chart.addImage(t)},addShape:function(t){this.chart.addShape(t)},dataURI:function(){return this.chart.dataURI()},setLocale:function(t){return this.chart.setLocale(t)},addXaxisAnnotation:function(t,e){this.chart.addXaxisAnnotation(t,e)},addYaxisAnnotation:function(t,e){this.chart.addYaxisAnnotation(t,e)},addPointAnnotation:function(t,e){this.chart.addPointAnnotation(t,e)},removeAnnotation:function(t,e){this.chart.removeAnnotation(t,e)},clearAnnotations:function(){this.chart.clearAnnotations()}}};return window.ApexCharts=t,i.install=function(e){e.ApexCharts=t,window.ApexCharts=t,Object.defineProperty(e.prototype,"$apexcharts",{get:function(){return t}})},i}));
|
||||
@@ -0,0 +1 @@
|
||||
(function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTheMask=t():e.VueTheMask=t()})(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p=".",t(t.s=10)}([function(e,t){e.exports={"#":{pattern:/\d/},X:{pattern:/[0-9a-zA-Z]/},S:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleUpperCase()}},a:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleLowerCase()}},"!":{escape:!0}}},function(e,t,n){"use strict";function r(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var a=n(2),o=n(0),i=n.n(o);t.a=function(e,t){var o=t.value;if((Array.isArray(o)||"string"==typeof o)&&(o={mask:o,tokens:i.a}),"INPUT"!==e.tagName.toLocaleUpperCase()){var u=e.getElementsByTagName("input");if(1!==u.length)throw new Error("v-mask directive requires 1 input, found "+u.length);e=u[0]}e.oninput=function(t){if(t.isTrusted){var i=e.selectionEnd,u=e.value[i-1];for(e.value=n.i(a.a)(e.value,o.mask,!0,o.tokens);i<e.value.length&&e.value.charAt(i-1)!==u;)i++;e===document.activeElement&&(e.setSelectionRange(i,i),setTimeout(function(){e.setSelectionRange(i,i)},0)),e.dispatchEvent(r("input"))}};var s=n.i(a.a)(e.value,o.mask,!0,o.tokens);s!==e.value&&(e.value=s,e.dispatchEvent(r("input")))}},function(e,t,n){"use strict";var r=n(6),a=n(5);t.a=function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments[3];return Array.isArray(t)?n.i(a.a)(r.a,t,i)(e,t,o,i):n.i(r.a)(e,t,o,i)}},function(e,t,n){"use strict";function r(e){e.component(s.a.name,s.a),e.directive("mask",i.a)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=n.n(a),i=n(1),u=n(7),s=n.n(u);n.d(t,"TheMask",function(){return s.a}),n.d(t,"mask",function(){return i.a}),n.d(t,"tokens",function(){return o.a}),n.d(t,"version",function(){return c});var c="0.11.1";t.default=r,"undefined"!=typeof window&&window.Vue&&window.Vue.use(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),a=n(0),o=n.n(a),i=n(2);t.default={name:"TheMask",props:{value:[String,Number],mask:{type:[String,Array],required:!0},masked:{type:Boolean,default:!1},tokens:{type:Object,default:function(){return o.a}}},directives:{mask:r.a},data:function(){return{lastValue:null,display:this.value}},watch:{value:function(e){e!==this.lastValue&&(this.display=e)},masked:function(){this.refresh(this.display)}},computed:{config:function(){return{mask:this.mask,tokens:this.tokens,masked:this.masked}}},methods:{onInput:function(e){e.isTrusted||this.refresh(e.target.value)},refresh:function(e){this.display=e;var e=n.i(i.a)(e,this.mask,this.masked,this.tokens);e!==this.lastValue&&(this.lastValue=e,this.$emit("input",e))}}}},function(e,t,n){"use strict";function r(e,t,n){return t=t.sort(function(e,t){return e.length-t.length}),function(r,a){for(var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;i<t.length;){var u=t[i];i++;var s=t[i];if(!(s&&e(r,s,!0,n).length>u.length))return e(r,u,o,n)}return""}}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments[3];e=e||"",t=t||"";for(var a=0,o=0,i="";a<t.length&&o<e.length;){var u=t[a],s=r[u],c=e[o];s&&!s.escape?(s.pattern.test(c)&&(i+=s.transform?s.transform(c):c,a++),o++):(s&&s.escape&&(a++,u=t[a]),n&&(i+=u),c===u&&o++,a++)}for(var f="";a<t.length&&n;){var u=t[a];if(r[u]){f="";break}f+=u,a++}return i+f}t.a=r},function(e,t,n){var r=n(8)(n(4),n(9),null,null);e.exports=r.exports},function(e,t){e.exports=function(e,t,n,r){var a,o=e=e||{},i=typeof e.default;"object"!==i&&"function"!==i||(a=e,o=e.default);var u="function"==typeof o?o.options:o;if(t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns),n&&(u._scopeId=n),r){var s=u.computed||(u.computed={});Object.keys(r).forEach(function(e){var t=r[e];s[e]=function(){return t}})}return{esModule:a,exports:o,options:u}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("input",{directives:[{name:"mask",rawName:"v-mask",value:e.config,expression:"config"}],attrs:{type:"text"},domProps:{value:e.display},on:{input:e.onInput}})},staticRenderFns:[]}},function(e,t,n){e.exports=n(3)}])});
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTheMask=t():e.VueTheMask=t()}(this,(function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p=".",t(t.s=10)}([function(e,t){e.exports={"#":{pattern:/\d/},X:{pattern:/[0-9a-zA-Z]/},S:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleUpperCase()}},a:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleLowerCase()}},"!":{escape:!0}}},function(e,t,n){"use strict";function r(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var a=n(2),o=n(0),i=n.n(o);t.a=function(e,t){var o=t.value;if((Array.isArray(o)||"string"==typeof o)&&(o={mask:o,tokens:i.a}),"INPUT"!==e.tagName.toLocaleUpperCase()){var u=e.getElementsByTagName("input");if(1!==u.length)throw new Error("v-mask directive requires 1 input, found "+u.length);e=u[0]}e.oninput=function(t){if(t.isTrusted){var i=e.selectionEnd,u=e.value[i-1];for(e.value=n.i(a.a)(e.value,o.mask,!0,o.tokens);i<e.value.length&&e.value.charAt(i-1)!==u;)i++;e===document.activeElement&&(e.setSelectionRange(i,i),setTimeout((function(){e.setSelectionRange(i,i)}),0)),e.dispatchEvent(r("input"))}};var s=n.i(a.a)(e.value,o.mask,!0,o.tokens);s!==e.value&&(e.value=s,e.dispatchEvent(r("input")))}},function(e,t,n){"use strict";var r=n(6),a=n(5);t.a=function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments[3];return Array.isArray(t)?n.i(a.a)(r.a,t,i)(e,t,o,i):n.i(r.a)(e,t,o,i)}},function(e,t,n){"use strict";function r(e){e.component(s.a.name,s.a),e.directive("mask",i.a)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=n.n(a),i=n(1),u=n(7),s=n.n(u);n.d(t,"TheMask",(function(){return s.a})),n.d(t,"mask",(function(){return i.a})),n.d(t,"tokens",(function(){return o.a})),n.d(t,"version",(function(){return c}));var c="0.11.1";t.default=r,"undefined"!=typeof window&&window.Vue&&window.Vue.use(r)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),a=n(0),o=n.n(a),i=n(2);t.default={name:"TheMask",props:{value:[String,Number],mask:{type:[String,Array],required:!0},masked:{type:Boolean,default:!1},tokens:{type:Object,default:function(){return o.a}}},directives:{mask:r.a},data:function(){return{lastValue:null,display:this.value}},watch:{value:function(e){e!==this.lastValue&&(this.display=e)},masked:function(){this.refresh(this.display)}},computed:{config:function(){return{mask:this.mask,tokens:this.tokens,masked:this.masked}}},methods:{onInput:function(e){e.isTrusted||this.refresh(e.target.value)},refresh:function(e){this.display=e,(e=n.i(i.a)(e,this.mask,this.masked,this.tokens))!==this.lastValue&&(this.lastValue=e,this.$emit("input",e))}}}},function(e,t,n){"use strict";t.a=function(e,t,n){return t=t.sort((function(e,t){return e.length-t.length})),function(r,a){for(var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;i<t.length;){var u=t[i];i++;var s=t[i];if(!(s&&e(r,s,!0,n).length>u.length))return e(r,u,o,n)}return""}}},function(e,t,n){"use strict";t.a=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments[3];e=e||"",t=t||"";for(var a=0,o=0,i="";a<t.length&&o<e.length;){var u=r[f=t[a]],s=e[o];u&&!u.escape?(u.pattern.test(s)&&(i+=u.transform?u.transform(s):s,a++),o++):(u&&u.escape&&(f=t[++a]),n&&(i+=f),s===f&&o++,a++)}for(var c="";a<t.length&&n;){var f;if(r[f=t[a]]){c="";break}c+=f,a++}return i+c}},function(e,t,n){var r=n(8)(n(4),n(9),null,null);e.exports=r.exports},function(e,t){e.exports=function(e,t,n,r){var a,o=e=e||{},i=typeof e.default;"object"!==i&&"function"!==i||(a=e,o=e.default);var u="function"==typeof o?o.options:o;if(t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns),n&&(u._scopeId=n),r){var s=u.computed||(u.computed={});Object.keys(r).forEach((function(e){var t=r[e];s[e]=function(){return t}}))}return{esModule:a,exports:o,options:u}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("input",{directives:[{name:"mask",rawName:"v-mask",value:e.config,expression:"config"}],attrs:{type:"text"},domProps:{value:e.display},on:{input:e.onInput}})},staticRenderFns:[]}},function(e,t,n){e.exports=n(3)}])}));
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
(()=>{"use strict";
|
||||
/*!
|
||||
* Vue.js v2.7.14
|
||||
* (c) 2014-2022 Evan You
|
||||
* Released under the MIT License.
|
||||
*/var e=Object.freeze({}),t=Array.isArray;function n(e){return null==e}function r(e){return null!=e}function o(e){return!0===e}function a(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function i(e){return"function"==typeof e}function s(e){return null!==e&&"object"==typeof e}var c=Object.prototype.toString;function u(e){return c.call(e).slice(8,-1)}function l(e){return"[object Object]"===c.call(e)}function f(e){return"[object RegExp]"===c.call(e)}function d(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function p(e){return r(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function v(e){return null==e?"":Array.isArray(e)||l(e)&&e.toString===c?JSON.stringify(e,null,2):String(e)}function h(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var g=m("slot,component",!0),y=m("key,ref,slot,slot-scope,is");function _(e,t){var n=e.length;if(n){if(t===e[n-1])return void(e.length=n-1);var r=e.indexOf(t);if(r>-1)return e.splice(r,1)}}var b=Object.prototype.hasOwnProperty;function w(e,t){return b.call(e,t)}function $(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var x=/-(\w)/g,k=$((function(e){return e.replace(x,(function(e,t){return t?t.toUpperCase():""}))})),C=$((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),S=/\B([A-Z])/g,O=$((function(e){return e.replace(S,"-$1").toLowerCase()}));var T=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function A(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function M(e,t){for(var n in t)e[n]=t[n];return e}function j(e){for(var t={},n=0;n<e.length;n++)e[n]&&M(t,e[n]);return t}function N(e,t,n){}var I=function(e,t,n){return!1},E=function(e){return e};function P(e,t){if(e===t)return!0;var n=s(e),r=s(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),a=Array.isArray(t);if(o&&a)return e.length===t.length&&e.every((function(e,n){return P(e,t[n])}));if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||a)return!1;var i=Object.keys(e),c=Object.keys(t);return i.length===c.length&&i.every((function(n){return P(e[n],t[n])}))}catch(e){return!1}}function D(e,t){for(var n=0;n<e.length;n++)if(P(e[n],t))return n;return-1}function L(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var F="data-server-rendered",R=["component","directive","filter"],V=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch","renderTracked","renderTriggered"],U={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!0,devtools:!0,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:I,isReservedAttr:I,isUnknownElement:I,getTagNamespace:N,parsePlatformTagName:E,mustUseProp:I,async:!0,_lifecycleHooks:V},H=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function B(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function z(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var q=new RegExp("[^".concat(H.source,".$_\\d]"));var J="__proto__"in{},K="undefined"!=typeof window,W=K&&window.navigator.userAgent.toLowerCase(),Z=W&&/msie|trident/.test(W),G=W&&W.indexOf("msie 9.0")>0,Y=W&&W.indexOf("edge/")>0;W&&W.indexOf("android");var X,Q=W&&/iphone|ipad|ipod|ios/.test(W),ee=W&&W.match(/firefox\/(\d+)/),te={}.watch,ne=!1;if(K)try{var re={};Object.defineProperty(re,"passive",{get:function(){ne=!0}}),window.addEventListener("test-passive",null,re)}catch(e){}var oe=function(){return void 0===X&&(X=!K&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),X},ae=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ie(e){return"function"==typeof e&&/native code/.test(e.toString())}var se,ce="undefined"!=typeof Symbol&&ie(Symbol)&&"undefined"!=typeof Reflect&&ie(Reflect.ownKeys);se="undefined"!=typeof Set&&ie(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ue=null;function le(e){void 0===e&&(e=null),e||ue&&ue._scope.off(),ue=e,e&&e._scope.on()}var fe,de=function(){function e(e,t,n,r,o,a,i,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=a,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=i,this.componentInstLine truncated
|
||||
@@ -0,0 +1,549 @@
|
||||
/* eslint-disable no-undef */
|
||||
(function($, hooks) {
|
||||
|
||||
/**
|
||||
* Fixes the value of the action for deleting pending sites.
|
||||
*/
|
||||
hooks.addAction('wu_list_table_update', 'nextpress/wp-ultimo', function(results, data, $parent) {
|
||||
|
||||
if (results.type === 'pending' && data.table_id === 'site_list_table') {
|
||||
|
||||
$parent.find('select[name^=action] > option[value=delete]').attr('value', 'delete-pending');
|
||||
|
||||
} else {
|
||||
|
||||
$parent.find('select[name^=action] > option[value=delete-pending]').attr('value', 'delete');
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Select All
|
||||
*/
|
||||
$(document).on('click', '#cb-select-all-grid', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const checkboxes = jQuery(this)
|
||||
.parents('form')
|
||||
.find('#the-list')
|
||||
.find('input[type=checkbox]');
|
||||
|
||||
const checked = checkboxes.prop('checked');
|
||||
|
||||
checkboxes.parents('.wu-grid-item')
|
||||
.toggleClass('wu-grid-item-selected', ! checked);
|
||||
|
||||
checkboxes.prop('checked', ! checked);
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', '.wu-grid-item input[type=checkbox]', function() {
|
||||
|
||||
const checked = $(this).prop('checked');
|
||||
|
||||
$(this).parents('.wu-grid-item')
|
||||
.toggleClass('wu-grid-item-selected', checked);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Function that creates the code to handle the AJAX functionality of the WU List Tables.
|
||||
*
|
||||
* @param id
|
||||
* @param count
|
||||
* @param filters
|
||||
* @param date_filters
|
||||
*/
|
||||
// eslint-disable-next-line no-undef
|
||||
wu_create_list = function(id) {
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Table element ID
|
||||
*/
|
||||
el: '#' + id,
|
||||
|
||||
/**
|
||||
* Filters ID
|
||||
*/
|
||||
filters_el: '#' + id + '-filters',
|
||||
|
||||
/**
|
||||
* Wether or not the table was initialized.
|
||||
*/
|
||||
initialized: false,
|
||||
|
||||
/**
|
||||
* Register our triggers
|
||||
*
|
||||
* We want to capture clicks on specific links, but also value change in
|
||||
* the pagination input field. The links contain all the information we
|
||||
* need concerning the wanted page number or ordering, so we'll just
|
||||
* parse the URL to extract these variables.
|
||||
*
|
||||
* The page number input is trickier: it has no URL so we have to find a
|
||||
* way around. We'll use the hidden inputs added in TT_Example_List_Table::display()
|
||||
* to recover the ordering variables, and the default paged input added
|
||||
* automatically by WordPress.
|
||||
*/
|
||||
init() {
|
||||
|
||||
const table = this;
|
||||
|
||||
const $table_parent = $('#wu-' + id);
|
||||
|
||||
// This will have its utility when dealing with the page number input
|
||||
let timer;
|
||||
|
||||
const delay = 500;
|
||||
|
||||
/*
|
||||
* Handles bulk-delete.
|
||||
*/
|
||||
jQuery('body').on('click', '#doaction, #doaction2', function(event) {
|
||||
|
||||
const form = jQuery(event.target).parents('form');
|
||||
|
||||
const form_data = form.serialize();
|
||||
|
||||
const params = new URL('https://example.com?' + form_data);
|
||||
|
||||
const action = params.searchParams.get('action') || params.searchParams.get('action2');
|
||||
|
||||
const ids = params.searchParams.getAll('bulk-delete[]');
|
||||
|
||||
if (action !== '-1' && ids.length) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
} else {
|
||||
|
||||
return;
|
||||
|
||||
}// end if;
|
||||
|
||||
params.searchParams.set('bulk_action', action);
|
||||
|
||||
params.searchParams.forEach((value, key) => {
|
||||
|
||||
if (key !== 'bulk_action' && key !== 'bulk-delete[]') {
|
||||
|
||||
params.searchParams.delete(key);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
params.searchParams.set('model', wu_list_table.model);
|
||||
|
||||
wubox.show(wu_list_table.i18n.confirm, wu_list_table.base_url + '&' + params.searchParams.toString());
|
||||
|
||||
});
|
||||
|
||||
// Pagination links, sortable link
|
||||
$table_parent.on('click', '.tablenav-pages a, .manage-column.sortable a, .manage-column.sorted a', function(e) {
|
||||
|
||||
// We don't want to actually follow these links
|
||||
e.preventDefault();
|
||||
|
||||
// Simple way: use the URL to extract our needed variables
|
||||
const query = this.search.substring(1);
|
||||
|
||||
const data = $.extend({}, table.__get_query(query), {
|
||||
order: table.__query(query, 'order') || 'DESC',
|
||||
paged: table.__query(query, 'paged') || '1',
|
||||
s: table.__query(query, 's') || '',
|
||||
});
|
||||
|
||||
table.update(data);
|
||||
|
||||
});
|
||||
|
||||
// Page number input
|
||||
$table_parent.on('keyup', 'input[name=paged]', function(e) {
|
||||
|
||||
// If user hit enter, we don't want to submit the form
|
||||
// We don't preventDefault() for all keys because it would
|
||||
// also prevent to get the page number!
|
||||
if (13 === e.which) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
} // end if;
|
||||
|
||||
// This time we fetch the variables in inputs
|
||||
const data = {
|
||||
paged: parseInt($('input[name=paged]').val()) || '1',
|
||||
s: $('input[name=s]').val() || '',
|
||||
};
|
||||
|
||||
// Now the timer comes to use: we wait half a second after
|
||||
// the user stopped typing to actually send the call. If
|
||||
// we don't, the keyup event will trigger instantly and
|
||||
// thus may cause duplicate calls before sending the intended
|
||||
// value
|
||||
window.clearTimeout(timer);
|
||||
|
||||
timer = window.setTimeout(function() {
|
||||
|
||||
table.update(data);
|
||||
|
||||
}, delay);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Initializes filters
|
||||
*/
|
||||
if (table.initialized === false && $(table.filters_el).get(0)) {
|
||||
|
||||
table.filters = table.init_filters();
|
||||
|
||||
} // end if;
|
||||
|
||||
table.initialized = true;
|
||||
|
||||
return table;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy a object
|
||||
*
|
||||
* @param {Object} obj
|
||||
*/
|
||||
copy: function copy(obj) {
|
||||
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Setup up the filters
|
||||
*/
|
||||
init_filters() {
|
||||
|
||||
if (typeof window.Vue === 'undefined') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
const table = this;
|
||||
|
||||
const available_filters = table.copy(window[id + '_config'].filters);
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
return new Vue({
|
||||
el: table.filters_el,
|
||||
data() {
|
||||
|
||||
return {
|
||||
open: true,
|
||||
view: false,
|
||||
// relation: 'and',
|
||||
available_filters: [], // table.copy(available_filters),
|
||||
filters: [], //[_.first(table.copy(available_filters))],
|
||||
};
|
||||
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
|
||||
let timer;
|
||||
|
||||
const delay = 500;
|
||||
|
||||
wu_on_load();
|
||||
|
||||
$(table.filters_el + ' form.search-form').on('submit', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
});
|
||||
|
||||
// Page number input
|
||||
$(table.filters_el + ' input[name=s]').on('input keyup', function(e) {
|
||||
|
||||
// If user hit enter, we don't want to submit the form
|
||||
// We don't preventDefault() for all keys because it would
|
||||
// also prevent to get the page number!
|
||||
if (13 === e.which) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
} // end if;
|
||||
|
||||
// This time we fetch the variables in inputs
|
||||
const data = {
|
||||
paged: parseInt($('input[name=paged]').val()) || '1',
|
||||
s: $('input[name=s]').val() || '',
|
||||
};
|
||||
|
||||
// Fix paged
|
||||
if ($('input[name=s]').val() !== '') {
|
||||
|
||||
data.paged = '1';
|
||||
|
||||
} // end if;
|
||||
|
||||
// Now the timer comes to use: we wait half a second after
|
||||
// the user stopped typing to actually send the call. If
|
||||
// we don't, the keyup event will trigger instantly and
|
||||
// thus may cause duplicate calls before sending the intended
|
||||
// value
|
||||
window.clearTimeout(timer);
|
||||
|
||||
timer = window.setTimeout(function() {
|
||||
|
||||
table.update(data);
|
||||
|
||||
}, delay);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
set_view(type, value) {
|
||||
|
||||
const query = window.location.href.split('?')[1];
|
||||
|
||||
const data = $.extend({}, table.__get_query(query), {
|
||||
paged: table.__query(query, 'paged') || '1',
|
||||
s: table.__query(query, 's') || '',
|
||||
});
|
||||
|
||||
this.view = value;
|
||||
|
||||
data[type] = value;
|
||||
|
||||
jQuery('.wu-filter .current').removeClass('current');
|
||||
|
||||
table.update(data);
|
||||
|
||||
},
|
||||
get_filter_type(field) {
|
||||
|
||||
const available_filter = _.findWhere(available_filters, {
|
||||
field,
|
||||
});
|
||||
|
||||
return available_filter.type;
|
||||
|
||||
},
|
||||
get_filter_rule(field) {
|
||||
|
||||
const available_filter = _.findWhere(available_filters, {
|
||||
field,
|
||||
});
|
||||
|
||||
return available_filter.rule;
|
||||
|
||||
},
|
||||
remove_filter(index) {
|
||||
|
||||
this.filters.splice(index, 1);
|
||||
|
||||
},
|
||||
add_new_filter() {
|
||||
|
||||
this.filters.push(_.first(table.copy(this.available_filters)));
|
||||
|
||||
},
|
||||
open_filters() {
|
||||
|
||||
this.open = true;
|
||||
|
||||
},
|
||||
close_filters() {
|
||||
|
||||
this.open = false;
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
set_history(data) {
|
||||
|
||||
if (window[id + '_config'].context !== 'page') {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/** Update History */
|
||||
try {
|
||||
|
||||
const history_vars = _.omit(data, function(value, key) {
|
||||
|
||||
return key === 'action' ||
|
||||
key === 'table_id' ||
|
||||
! value ||
|
||||
key.indexOf('_') === 0;
|
||||
|
||||
});
|
||||
|
||||
history.pushState({}, null, '?' + $.param(history_vars));
|
||||
|
||||
} catch (err) {
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Browser does not support pushState.', err);
|
||||
|
||||
} // end try;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* AJAX call
|
||||
*
|
||||
* Send the call and replace table parts with updated version!
|
||||
*
|
||||
* @param {Object} data The data to pass through AJAX
|
||||
*/
|
||||
update(data) {
|
||||
|
||||
const table = this;
|
||||
|
||||
const $table_parent = $('#wu-' + id);
|
||||
|
||||
const default_data = {
|
||||
action: 'wu_list_table_fetch_ajax_results',
|
||||
table_id: id,
|
||||
id: $('input#id').val(),
|
||||
};
|
||||
|
||||
default_data['_ajax_' + id + '_nonce'] = $('#_ajax_' + id + '_nonce').val();
|
||||
|
||||
const form_data = $.extend(
|
||||
{},
|
||||
default_data,
|
||||
// $($table_parent).find('input').serializeObject(),
|
||||
// $(table.filters_el).find('input').serializeObject(),
|
||||
data,
|
||||
);
|
||||
|
||||
const $content = $table_parent.find('tbody, .wu-grid-content');
|
||||
|
||||
$content.animate({ opacity: 0.4 }, 300);
|
||||
|
||||
$.ajax({
|
||||
// eslint-disable-next-line no-undef
|
||||
url: ajaxurl,
|
||||
// Add action and nonce to our collected data
|
||||
data: form_data,
|
||||
// Handle the successful result
|
||||
statusCode: {
|
||||
403() {
|
||||
|
||||
$content.animate({ opacity: 1 }, 300);
|
||||
|
||||
},
|
||||
},
|
||||
success(response) {
|
||||
|
||||
table.set_history(form_data, default_data);
|
||||
|
||||
$content.animate({ opacity: 1 }, 300);
|
||||
|
||||
// Add the requested rows
|
||||
if (typeof response.rows !== 'undefined') {
|
||||
|
||||
$content.html(response.rows);
|
||||
|
||||
} // end if;
|
||||
|
||||
// Add the requested rows
|
||||
if (typeof response.count !== 'undefined') {
|
||||
|
||||
// table.filters.count = response.count;
|
||||
|
||||
} // end if;
|
||||
|
||||
// Update column headers for sorting
|
||||
if (response.column_headers.length) {
|
||||
|
||||
$table_parent.find('thead tr, tfoot tr').html(response.column_headers);
|
||||
|
||||
} // end if;
|
||||
|
||||
// Update pagination for navigation
|
||||
if (response.pagination.top.length) {
|
||||
|
||||
$table_parent.find('.tablenav.top .tablenav-pages').html($(response.pagination.top).html());
|
||||
|
||||
} // end if;
|
||||
|
||||
if (response.pagination.bottom.length) {
|
||||
|
||||
$table_parent.find('.tablenav.bottom .tablenav-pages').html($(response.pagination.bottom).html());
|
||||
|
||||
} // end if;
|
||||
|
||||
hooks.doAction('wu_list_table_update', response, form_data, $table_parent);
|
||||
|
||||
// Init back our event handlers
|
||||
// table.init();
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter the URL Query to extract variables
|
||||
*
|
||||
* @see http://css-tricks.com/snippets/javascript/get-url-variables/
|
||||
* @param {string} query The URL query part containing the variables
|
||||
* @param {string} variable The URL query part containing the variables
|
||||
* @return {string|boolean} The variable value if available, false else.
|
||||
*/
|
||||
__query(query, variable) {
|
||||
|
||||
const vars = query.split('&');
|
||||
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
|
||||
const pair = vars[i].split('=');
|
||||
|
||||
if (pair[0] === variable) {
|
||||
|
||||
return pair[1];
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end for;
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
__get_query(query) {
|
||||
|
||||
const vars = query.split('&');
|
||||
|
||||
const _query = {};
|
||||
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
|
||||
const pair = vars[i].split('=');
|
||||
|
||||
_query[pair[0]] = pair[1];
|
||||
|
||||
} // end for;
|
||||
|
||||
return _query;
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
}; // end wu_create_list;
|
||||
|
||||
}(jQuery, wp.hooks));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){t.addAction("wu_list_table_update","nextpress/wp-ultimo",(function(e,t,n){"pending"===e.type&&"site_list_table"===t.table_id?n.find("select[name^=action] > option[value=delete]").attr("value","delete-pending"):n.find("select[name^=action] > option[value=delete-pending]").attr("value","delete")})),e(document).on("click","#cb-select-all-grid",(function(e){e.preventDefault();const t=jQuery(this).parents("form").find("#the-list").find("input[type=checkbox]"),n=t.prop("checked");t.parents(".wu-grid-item").toggleClass("wu-grid-item-selected",!n),t.prop("checked",!n)})),e(document).on("change",".wu-grid-item input[type=checkbox]",(function(){const t=e(this).prop("checked");e(this).parents(".wu-grid-item").toggleClass("wu-grid-item-selected",t)})),wu_create_list=function(n){return{el:"#"+n,filters_el:"#"+n+"-filters",initialized:!1,init(){const t=this,i=e("#wu-"+n);let a;return jQuery("body").on("click","#doaction, #doaction2",(function(e){const t=jQuery(e.target).parents("form").serialize(),n=new URL("https://example.com?"+t),i=n.searchParams.get("action")||n.searchParams.get("action2"),a=n.searchParams.getAll("bulk-delete[]");"-1"!==i&&a.length&&(e.preventDefault(),n.searchParams.set("bulk_action",i),n.searchParams.forEach(((e,t)=>{"bulk_action"!==t&&"bulk-delete[]"!==t&&n.searchParams.delete(t)})),n.searchParams.set("model",wu_list_table.model),wubox.show(wu_list_table.i18n.confirm,wu_list_table.base_url+"&"+n.searchParams.toString()))})),i.on("click",".tablenav-pages a, .manage-column.sortable a, .manage-column.sorted a",(function(n){n.preventDefault();const i=this.search.substring(1),a=e.extend({},t.__get_query(i),{order:t.__query(i,"order")||"DESC",paged:t.__query(i,"paged")||"1",s:t.__query(i,"s")||""});t.update(a)})),i.on("keyup","input[name=paged]",(function(n){13===n.which&&n.preventDefault();const i={paged:parseInt(e("input[name=paged]").val())||"1",s:e("input[name=s]").val()||""};window.clearTimeout(a),a=window.setTimeout((function(){t.update(i)}),500)})),!1===t.initialized&&e(t.filters_el).get(0)&&(t.filters=t.init_filters()),t.initialized=!0,t},copy:function(e){return JSON.parse(JSON.stringify(e))},init_filters(){if(void 0===window.Vue)return;const t=this,i=t.copy(window[n+"_config"].filters);return new Vue({el:t.filters_el,data:()=>({open:!0,view:!1,available_filters:[],filters:[]}),computed:{},mounted(){let n;wu_on_load(),e(t.filters_el+" form.search-form").on("submit",(function(e){e.preventDefault()})),e(t.filters_el+" input[name=s]").on("input keyup",(function(i){13===i.which&&i.preventDefault();const a={paged:parseInt(e("input[name=paged]").val())||"1",s:e("input[name=s]").val()||""};""!==e("input[name=s]").val()&&(a.paged="1"),window.clearTimeout(n),n=window.setTimeout((function(){t.update(a)}),500)}))},methods:{set_view(n,i){const a=window.location.href.split("?")[1],o=e.extend({},t.__get_query(a),{paged:t.__query(a,"paged")||"1",s:t.__query(a,"s")||""});this.view=i,o[n]=i,jQuery(".wu-filter .current").removeClass("current"),t.update(o)},get_filter_type:e=>_.findWhere(i,{field:e}).type,get_filter_rule:e=>_.findWhere(i,{field:e}).rule,remove_filter(e){this.filters.splice(e,1)},add_new_filter(){this.filters.push(_.first(t.copy(this.available_filters)))},open_filters(){this.open=!0},close_filters(){this.open=!1}}})},set_history(t){if("page"===window[n+"_config"].context)try{const n=_.omit(t,(function(e,t){return"action"===t||"table_id"===t||!e||0===t.indexOf("_")}));history.pushState({},null,"?"+e.param(n))}catch(e){console.warn("Browser does not support pushState.",e)}},update(i){const a=this,o=e("#wu-"+n),s={action:"wu_list_table_fetch_ajax_results",table_id:n,id:e("input#id").val()};s["_ajax_"+n+"_nonce"]=e("#_ajax_"+n+"_nonce").val();const l=e.extend({},s,i),r=o.find("tbody, .wu-grid-content");r.animate({opacity:.4},300),e.ajax({url:ajaxurl,data:l,statusCode:{403(){r.animate({opacity:1},300)}},success(n){a.set_history(l,s),r.animate({opacity:1},300),void 0!==n.rows&&r.html(n.rows),n.count,n.column_headers.length&&o.find("thead tr, tfoot tr").html(n.column_headers),n.pagination.top.length&&o.find(".tablenav.top .tablenav-pages").html(e(n.pagination.top).html()),n.pagination.bottom.length&&o.find(".tablenav.bottom .tablenav-pages").html(e(n.pagination.bottom).html()),t.doAction("wu_list_table_update",n,l,o)}})},__query(e,t){const n=e.split("&");for(let e=0;e<n.length;e++){const i=n[e].split("=");if(i[0]===t)return i[1]}return!1},__get_query(e){const t=e.split("&"),n={};for(let e=0;e<t.length;e++){const i=t[e].split("=");n[i[0]]=i[1]}return n}}}}(jQuery,wp.hooks);
|
||||
@@ -0,0 +1,54 @@
|
||||
/* global wu_block_ui */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#scraper').on('click', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const block = wu_block_ui('#wp-ultimo-image-widget');
|
||||
|
||||
$('.wu-scraper-note, .wu-scraper-error').hide();
|
||||
|
||||
jQuery.ajax({
|
||||
// eslint-disable-next-line no-undef
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wu_get_screenshot',
|
||||
site_id: $('#id').val(),
|
||||
},
|
||||
error() {
|
||||
|
||||
block.unblock();
|
||||
|
||||
},
|
||||
success(res) {
|
||||
|
||||
block.unblock();
|
||||
|
||||
if (res.success) {
|
||||
|
||||
$('#wp-ultimo-image-widget img').attr('src', res.data.attachment_url);
|
||||
|
||||
$('#wp-ultimo-image-widget input').val(res.data.attachment_id);
|
||||
|
||||
$('.wu-scraper-note').show();
|
||||
|
||||
} else {
|
||||
|
||||
$('.wu-scraper-error').show();
|
||||
|
||||
$('.wu-scraper-error-message').text(res.data.pop().message);
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){e("#scraper").on("click",(function(t){t.preventDefault();const r=wu_block_ui("#wp-ultimo-image-widget");e(".wu-scraper-note, .wu-scraper-error").hide(),jQuery.ajax({url:ajaxurl,type:"POST",data:{action:"wu_get_screenshot",site_id:e("#id").val()},error(){r.unblock()},success(t){r.unblock(),t.success?(e("#wp-ultimo-image-widget img").attr("src",t.data.attachment_url),e("#wp-ultimo-image-widget input").val(t.data.attachment_id),e(".wu-scraper-note").show()):(e(".wu-scraper-error").show(),e(".wu-scraper-error-message").text(t.data.pop().message))}})}))}))}(jQuery);
|
||||
@@ -0,0 +1,202 @@
|
||||
/* global _, wu_initialize_selectizer, wu_selector */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
window.wu_initialize_selectizer = function() {
|
||||
|
||||
jQuery('[data-selectize]').selectize();
|
||||
|
||||
$.each($('[data-selectize-categories]'), function(index, item) {
|
||||
|
||||
jQuery($(item)).selectize({
|
||||
maxItems: $(item).data('max-items') || 10,
|
||||
create(input) {
|
||||
|
||||
return {
|
||||
value: input,
|
||||
text: input,
|
||||
};
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$.each($('[data-model]'), function(index, item) {
|
||||
|
||||
wu_selector({
|
||||
el: item,
|
||||
valueField: $(item).data('value-field'),
|
||||
labelField: $(item).data('label-field'),
|
||||
searchField: $(item).data('search-field'),
|
||||
maxItems: $(item).data('max-items'),
|
||||
selected: $(item).data('selected'),
|
||||
options: [],
|
||||
data: {
|
||||
action: 'wu_search',
|
||||
model: $(item).data('model'),
|
||||
number: 10,
|
||||
exclude: $(item).data('exclude'),
|
||||
include: $(item).data('include'),
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
wu_initialize_selectizer();
|
||||
|
||||
jQuery('body').on('wubox:load', function() {
|
||||
|
||||
wu_initialize_selectizer();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
window.wu_selector = function wu_selector(options) {
|
||||
|
||||
options = _.defaults(options, {
|
||||
options: [],
|
||||
maxItems: 1,
|
||||
templateName: false,
|
||||
create: false,
|
||||
});
|
||||
|
||||
if (jQuery(options.el).data('init')) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
jQuery(options.el).data('__options', options);
|
||||
|
||||
const select = jQuery(options.el).selectize({
|
||||
valueField: options.valueField,
|
||||
labelField: options.labelField,
|
||||
searchField: ['text', 'name', 'display_name', 'domain', 'path', 'title', 'desc', 'code', 'post_title', 'reference_code'],
|
||||
options: options.options,
|
||||
maxItems: options.maxItems,
|
||||
create: options.create,
|
||||
render: {
|
||||
option(option) {
|
||||
|
||||
const templateName = options.templateName ? options.templateName : options.data.model;
|
||||
|
||||
const template_html = jQuery('#wu-template-' + templateName).length
|
||||
? jQuery('#wu-template-' + templateName).html()
|
||||
: jQuery('#wu-template-default').html();
|
||||
|
||||
const template = _.template(template_html, {
|
||||
interpolate: /\{\{(.+?)\}\}/g,
|
||||
});
|
||||
|
||||
const render = template(option);
|
||||
|
||||
return render;
|
||||
|
||||
},
|
||||
},
|
||||
load(query, callback) {
|
||||
|
||||
if (! query.length) {
|
||||
|
||||
return callback();
|
||||
|
||||
} // end if;
|
||||
|
||||
const __options = jQuery(options.el).data('__options');
|
||||
|
||||
jQuery.ajax({
|
||||
// eslint-disable-next-line no-undef
|
||||
url: wu_selectizer.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
...__options.data,
|
||||
query: {
|
||||
search: '*' + query + '*',
|
||||
},
|
||||
},
|
||||
error() {
|
||||
|
||||
callback();
|
||||
|
||||
},
|
||||
success(res) {
|
||||
|
||||
selectize.savedItems = res;
|
||||
|
||||
callback(res);
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
jQuery(options.el).attr('data-init', 1);
|
||||
|
||||
const selectize = select[0].selectize;
|
||||
|
||||
/*
|
||||
* Makes sure this is reactive for vue
|
||||
*/
|
||||
selectize.on('change', function(value) {
|
||||
|
||||
const input = jQuery(select[0]);
|
||||
|
||||
const vue_app = input.parents('[data-wu-app]').data('wu-app');
|
||||
|
||||
if (vue_app && typeof window['wu_' + vue_app] !== 'undefined') {
|
||||
|
||||
window['wu_' + vue_app][input.attr('name')] = value;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
selectize.on('item_add', function(value) {
|
||||
|
||||
let active_item = {
|
||||
url: null,
|
||||
};
|
||||
|
||||
jQuery.each(selectize.savedItems, function(index, item) {
|
||||
|
||||
if (item.setting_id === value) {
|
||||
|
||||
active_item = item;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
if (active_item.url) {
|
||||
|
||||
window.location.href = active_item.url;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
if (options.selected) {
|
||||
|
||||
selectize.options = [];
|
||||
|
||||
selectize.clearOptions();
|
||||
|
||||
const selected_values = _.isArray(options.selected) ? options.selected : [options.selected];
|
||||
|
||||
selectize.addOption(selected_values);
|
||||
|
||||
const selected = _.isArray(options.selected) ? _.pluck(options.selected, options.valueField) : options.selected[options.valueField];
|
||||
|
||||
selectize.setValue(selected, false);
|
||||
|
||||
} // end if;
|
||||
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){window.wu_initialize_selectizer=function(){jQuery("[data-selectize]").selectize(),e.each(e("[data-selectize-categories]"),(function(t,a){jQuery(e(a)).selectize({maxItems:e(a).data("max-items")||10,create:e=>({value:e,text:e})})})),e.each(e("[data-model]"),(function(t,a){wu_selector({el:a,valueField:e(a).data("value-field"),labelField:e(a).data("label-field"),searchField:e(a).data("search-field"),maxItems:e(a).data("max-items"),selected:e(a).data("selected"),options:[],data:{action:"wu_search",model:e(a).data("model"),number:10,exclude:e(a).data("exclude"),include:e(a).data("include")}})}))},wu_initialize_selectizer(),jQuery("body").on("wubox:load",(function(){wu_initialize_selectizer()}))})),window.wu_selector=function(e){if(e=_.defaults(e,{options:[],maxItems:1,templateName:!1,create:!1}),jQuery(e.el).data("init"))return;jQuery(e.el).data("__options",e);const t=jQuery(e.el).selectize({valueField:e.valueField,labelField:e.labelField,searchField:["text","name","display_name","domain","path","title","desc","code","post_title","reference_code"],options:e.options,maxItems:e.maxItems,create:e.create,render:{option(t){const a=e.templateName?e.templateName:e.data.model,l=jQuery("#wu-template-"+a).length?jQuery("#wu-template-"+a).html():jQuery("#wu-template-default").html();return _.template(l,{interpolate:/\{\{(.+?)\}\}/g})(t)}},load(t,l){if(!t.length)return l();const i=jQuery(e.el).data("__options");jQuery.ajax({url:wu_selectizer.ajaxurl,type:"POST",data:{...i.data,query:{search:"*"+t+"*"}},error(){l()},success(e){a.savedItems=e,l(e)}})}});jQuery(e.el).attr("data-init",1);const a=t[0].selectize;if(a.on("change",(function(e){const a=jQuery(t[0]),l=a.parents("[data-wu-app]").data("wu-app");l&&void 0!==window["wu_"+l]&&(window["wu_"+l][a.attr("name")]=e)})),a.on("item_add",(function(e){let t={url:null};jQuery.each(a.savedItems,(function(a,l){l.setting_id===e&&(t=l)})),t.url&&(window.location.href=t.url)})),e.selected){a.options=[],a.clearOptions();const t=_.isArray(e.selected)?e.selected:[e.selected];a.addOption(t);const l=_.isArray(e.selected)?_.pluck(e.selected,e.valueField):e.selected[e.valueField];a.setValue(l,!1)}}}(jQuery);
|
||||
@@ -0,0 +1,50 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
// eslint-disable-next-line prefer-const
|
||||
let wu_block_ui_polyfill = function(el) {
|
||||
|
||||
jQuery(el).wu_block({
|
||||
message: '<span style="float: none;" class="spinner is-active wu-float-none"></span>',
|
||||
overlayCSS: {
|
||||
backgroundColor: '#FFF',
|
||||
opacity: 0.6,
|
||||
},
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '50%',
|
||||
fontSize: '14px !important',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: 'none',
|
||||
backgroundColor: 'none',
|
||||
cursor: 'wait',
|
||||
},
|
||||
});
|
||||
|
||||
const el_instance = jQuery(el);
|
||||
|
||||
el_instance.unblock = jQuery(el).wu_unblock;
|
||||
|
||||
return el_instance;
|
||||
|
||||
};
|
||||
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
jQuery('[role="tooltip"]').tipTip({
|
||||
attribute: 'aria-label',
|
||||
});
|
||||
|
||||
$('#poststuff').on('submit', 'form', function() {
|
||||
|
||||
wu_block_ui_polyfill($(this));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
+1
@@ -0,0 +1 @@
|
||||
let wu_block_ui_polyfill=function(o){jQuery(o).wu_block({message:'<span style="float: none;" class="spinner is-active wu-float-none"></span>',overlayCSS:{backgroundColor:"#FFF",opacity:.6},css:{padding:0,margin:0,width:"50%",fontSize:"14px !important",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"none",backgroundColor:"none",cursor:"wait"}});const n=jQuery(o);return n.unblock=jQuery(o).wu_unblock,n};!function(o){o(document).ready((function(){jQuery('[role="tooltip"]').tipTip({attribute:"aria-label"}),o("#poststuff").on("submit","form",(function(){wu_block_ui_polyfill(o(this))}))}))}(jQuery);
|
||||
@@ -0,0 +1,210 @@
|
||||
/* global wu_setup, wu_setup_settings, ajaxurl, wu_block_ui_polyfill, _wu_block_ui_polyfill */
|
||||
(function($) {
|
||||
|
||||
window._wu_block_ui_polyfill = wu_block_ui_polyfill;
|
||||
|
||||
wu_block_ui_polyfill = function() { };
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// Click button
|
||||
// Generates queue
|
||||
// Start to process queue items one by one
|
||||
// Changes the status
|
||||
// Move to the next item
|
||||
// When all is done, redirect to the next page via a form submission
|
||||
$('#poststuff').on('submit', 'form', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const $form = $(this);
|
||||
|
||||
const install_id = $form.find('table[data-id]').data('id');
|
||||
|
||||
$form.find('[name=next]').attr('disabled', 'disabled');
|
||||
|
||||
let queue = $form.find('tr[data-content]');
|
||||
|
||||
/*
|
||||
* Only keep items selected on the queue.
|
||||
*/
|
||||
queue = queue.filter(function() {
|
||||
|
||||
const checkbox = $(this).find('input[type=checkbox]');
|
||||
|
||||
if (checkbox.length) {
|
||||
|
||||
return checkbox.is(':checked');
|
||||
|
||||
} // end if;
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
let successes = 0;
|
||||
|
||||
let index = 0;
|
||||
|
||||
process_queue_item(queue.eq(index));
|
||||
|
||||
/**
|
||||
* Process the queue items one by one recursively.
|
||||
*
|
||||
* @param {string} item The item to process.
|
||||
*/
|
||||
function process_queue_item(item) {
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
|
||||
if (item.length === 0) {
|
||||
|
||||
if (queue.length === successes || install_id === 'migration') {
|
||||
|
||||
window.onbeforeunload = null;
|
||||
|
||||
_wu_block_ui_polyfill($('#poststuff .inside'));
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
$form.get(0).submit();
|
||||
|
||||
}, 100);
|
||||
|
||||
} // end if;
|
||||
|
||||
$form.find('[name=next]').removeAttr('disabled');
|
||||
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
|
||||
const $item = $(item);
|
||||
|
||||
const content = $item.data('content');
|
||||
|
||||
$item.get(0).scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
|
||||
|
||||
$item.find('td.status')
|
||||
.attr('class', '')
|
||||
.addClass('status')
|
||||
.find('> span').html(wu_setup[content].installing).end()
|
||||
.find('.spinner').addClass('is-active').end()
|
||||
.find('a.help').slideUp();
|
||||
|
||||
// Ajax request
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
method: 'post',
|
||||
data: {
|
||||
action: 'wu_setup_install',
|
||||
installer: content,
|
||||
'dry-run': wu_setup_settings.dry_run,
|
||||
},
|
||||
success(data) {
|
||||
|
||||
if (data.success === true) {
|
||||
|
||||
$item.find('td.status')
|
||||
.attr('class', '')
|
||||
.addClass('status wu-text-green-600')
|
||||
.find('> span').html(wu_setup[content].success).end()
|
||||
.find('.spinner').removeClass('is-active');
|
||||
|
||||
$item.removeAttr('data-content');
|
||||
|
||||
successes++;
|
||||
|
||||
} else {
|
||||
|
||||
$item.find('td.status')
|
||||
.attr('class', '')
|
||||
.addClass('status wu-text-red-400')
|
||||
.find('> span').html(data.data[0].message).end()
|
||||
.find('.spinner').removeClass('is-active').end()
|
||||
.find('a.help').slideDown();
|
||||
|
||||
} // end if;
|
||||
|
||||
index++;
|
||||
|
||||
process_queue_item(queue.eq(index));
|
||||
|
||||
},
|
||||
error() {
|
||||
|
||||
$item.find('td.status')
|
||||
.attr('class', '')
|
||||
.addClass('status wu-text-red-400')
|
||||
.find('span').html('').end()
|
||||
.find('.spinner').removeClass('is-active').end()
|
||||
.find('a.help').slideDown();
|
||||
|
||||
index++;
|
||||
|
||||
process_queue_item(queue.eq(index));
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
} // end process_queue_item;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
if (typeof wu_initialize_tooltip !== 'function') {
|
||||
|
||||
const wu_initialize_tooltip = function() {
|
||||
|
||||
jQuery('[role="tooltip"]').tipTip({
|
||||
attribute: 'aria-label',
|
||||
});
|
||||
|
||||
}; // end wu_initialize_tooltip;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const wu_block_ui = function(el) {
|
||||
|
||||
jQuery(el).wu_block({
|
||||
message: '<span>Please wait...</span>',
|
||||
overlayCSS: {
|
||||
backgroundColor: '#FFF',
|
||||
opacity: 0.6,
|
||||
},
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '50%',
|
||||
fontSize: '14px !important',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: 'none',
|
||||
backgroundColor: 'none',
|
||||
cursor: 'wait',
|
||||
},
|
||||
});
|
||||
|
||||
return jQuery(el);
|
||||
|
||||
};
|
||||
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
wu_initialize_tooltip();
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
} // end if;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
if(function(t){window._wu_block_ui_polyfill=wu_block_ui_polyfill,wu_block_ui_polyfill=function(){},t(document).ready((function(){t("#poststuff").on("submit","form",(function(n){n.preventDefault();const e=t(this),s=e.find("table[data-id]").data("id");e.find("[name=next]").attr("disabled","disabled");let i=e.find("tr[data-content]");i=i.filter((function(){const n=t(this).find("input[type=checkbox]");return!n.length||n.is(":checked")}));let a=0,d=0;!function n(l){if(window.onbeforeunload=function(){return""},0===l.length)return i.length!==a&&"migration"!==s||(window.onbeforeunload=null,_wu_block_ui_polyfill(t("#poststuff .inside")),setTimeout(()=>{e.get(0).submit()},100)),e.find("[name=next]").removeAttr("disabled"),!1;const o=t(l),u=o.data("content");o.get(0).scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),o.find("td.status").attr("class","").addClass("status").find("> span").html(wu_setup[u].installing).end().find(".spinner").addClass("is-active").end().find("a.help").slideUp(),t.ajax({url:ajaxurl,method:"post",data:{action:"wu_setup_install",installer:u,"dry-run":wu_setup_settings.dry_run},success(t){!0===t.success?(o.find("td.status").attr("class","").addClass("status wu-text-green-600").find("> span").html(wu_setup[u].success).end().find(".spinner").removeClass("is-active"),o.removeAttr("data-content"),a++):o.find("td.status").attr("class","").addClass("status wu-text-red-400").find("> span").html(t.data[0].message).end().find(".spinner").removeClass("is-active").end().find("a.help").slideDown(),d++,n(i.eq(d))},error(){o.find("td.status").attr("class","").addClass("status wu-text-red-400").find("span").html("").end().find(".spinner").removeClass("is-active").end().find("a.help").slideDown(),d++,n(i.eq(d))}})}(i.eq(d))}))}))}(jQuery),"function"!=typeof wu_initialize_tooltip){const t=function(){jQuery('[role="tooltip"]').tipTip({attribute:"aria-label"})};jQuery(document).ready((function(){t()}))}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* global wu_site_maintenance, wu_block_ui */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#wu-tg-maintenance_mode').change(function() {
|
||||
|
||||
const blocked = wu_block_ui('#wp-ultimo-site-maintenance-element .inside');
|
||||
|
||||
jQuery.ajax({
|
||||
url: wu_site_maintenance.ajaxurl,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'toggle_maintenance_mode',
|
||||
maintenance_status: $('#wu-tg-maintenance_mode').is(':checked'),
|
||||
site_hash: $('[name=site_hash]').val(),
|
||||
_wpnonce: wu_site_maintenance.nonce,
|
||||
},
|
||||
success(response) {
|
||||
|
||||
blocked.unblock();
|
||||
|
||||
if (response.success) {
|
||||
|
||||
if (response.data.value) {
|
||||
|
||||
$('#wp-admin-bar-wu-maintenance-mode').show();
|
||||
|
||||
} else {
|
||||
|
||||
$('#wp-admin-bar-wu-maintenance-mode').hide();
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
|
||||
}, // end success;
|
||||
|
||||
error(error) {
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
|
||||
}, // end error;
|
||||
|
||||
}); // end ajax;
|
||||
|
||||
}); //end checked
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e){e(document).ready((function(){e("#wu-tg-maintenance_mode").change((function(){const n=wu_block_ui("#wp-ultimo-site-maintenance-element .inside");jQuery.ajax({url:wu_site_maintenance.ajaxurl,type:"post",data:{action:"toggle_maintenance_mode",maintenance_status:e("#wu-tg-maintenance_mode").is(":checked"),site_hash:e("[name=site_hash]").val(),_wpnonce:wu_site_maintenance.nonce},success(a){n.unblock(),a.success&&(a.data.value?e("#wp-admin-bar-wu-maintenance-mode").show():e("#wp-admin-bar-wu-maintenance-mode").hide())},error(e){console.error(e)}})}))}))}(jQuery);
|
||||
@@ -0,0 +1,155 @@
|
||||
/* global wu_create_cookie, wu_sso_config, wu_read_cookie, detectIncognito */
|
||||
(function(o) {
|
||||
|
||||
window.wu = window.wu || {};
|
||||
|
||||
window.is_incognito = false;
|
||||
|
||||
window.wu.sso_denied = function() {
|
||||
|
||||
wu_create_cookie('wu_sso_denied', 1, o.expiration_in_minutes);
|
||||
|
||||
}; // end if;
|
||||
|
||||
window.wu.check_for_incognito_window = function() {
|
||||
|
||||
detectIncognito(results => window.is_incognito = results.isPrivate);
|
||||
|
||||
} // end is_incognito_window;
|
||||
|
||||
window.wu.check_for_incognito_window();
|
||||
|
||||
window.addEventListener('error', wu.sso_denied, true);
|
||||
|
||||
const w = document.createElement('script');
|
||||
|
||||
w.type = 'text/javascript';
|
||||
|
||||
w.async = true;
|
||||
|
||||
w.defer = true;
|
||||
|
||||
w.src = o.server_url + '?_jsonp=1';
|
||||
|
||||
const denied = wu_read_cookie('wu_sso_denied');
|
||||
|
||||
document.head.insertAdjacentHTML('beforeend', `
|
||||
<style>
|
||||
@keyframes fade_in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
body.sso-loading {
|
||||
overflow: hidden;
|
||||
}
|
||||
body.sso-loading .sso-overlay {
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
-webkit-animation: fade_in 300ms;
|
||||
-moz-animation: fade_in 300ms;
|
||||
-ms-animation: fade_in 300ms;
|
||||
-o-animation: fade_in 300ms;
|
||||
animation: fade_in 300ms;
|
||||
}
|
||||
body.sso-loading .sso-overlay::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -10px 0 0 -10px;
|
||||
transform: translateZ(0);
|
||||
background: transparent url(${ o.img_folder }/spinner.gif) no-repeat center center;
|
||||
background-image: url(${ o.img_folder }/loader.svg);
|
||||
background-size: 20px 20px;
|
||||
}
|
||||
</style>
|
||||
`);
|
||||
|
||||
if (! o.is_user_logged_in && ! denied) {
|
||||
|
||||
const s = document.getElementsByTagName('script')[0];
|
||||
|
||||
s.parentNode.insertBefore(w, s);
|
||||
|
||||
document.body.insertAdjacentHTML('beforeend', '<div class="sso-overlay"> </div>');
|
||||
|
||||
} // end if;
|
||||
|
||||
window.wu.sso = function(payload) {
|
||||
|
||||
const encodedLocation = encodeURIComponent(window.location.href);
|
||||
|
||||
if (payload.code === 200) {
|
||||
|
||||
if (o.use_overlay) {
|
||||
|
||||
document.body.classList.add('sso-loading');
|
||||
|
||||
} // end if;
|
||||
|
||||
/**
|
||||
* In case we're dealing with http (without ssl),
|
||||
* we force a redirect to bypass browser cookie
|
||||
* limitations.
|
||||
*
|
||||
* Otherwise, on the else block,
|
||||
* we redirect with the verification code attached,
|
||||
* to perform a regular SSO flow.
|
||||
*/
|
||||
if (payload.verify === 'must-redirect') {
|
||||
|
||||
window.location.replace(`${ o.server_url }?return_url=${ encodedLocation }`);
|
||||
|
||||
} else {
|
||||
|
||||
window.location.replace(`${ o.server_url }?sso_verify=${ payload.verify }&return_url=${ encodedLocation }`);
|
||||
|
||||
} // end if;
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* If we are in a incognito window,
|
||||
* we give it another try with a full redirect,
|
||||
* as chrome settings might be blocking
|
||||
* cookies from being sent anyways.
|
||||
*/
|
||||
if (window.is_incognito) {
|
||||
|
||||
if (o.use_overlay) {
|
||||
|
||||
document.body.classList.add('sso-loading');
|
||||
|
||||
} // end if;
|
||||
|
||||
window.location.replace(`${o.server_url}?return_url=${ encodedLocation }`);
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
window.wu.sso_denied();
|
||||
|
||||
document.body.classList.remove('sso-loading');
|
||||
|
||||
} // end if;
|
||||
|
||||
}; // end sso;
|
||||
|
||||
(function clean_up_query_args() {
|
||||
|
||||
if (window.history.replaceState) {
|
||||
|
||||
window.history.replaceState(null, null, o.filtered_url + window.location.hash);
|
||||
|
||||
} // end if;
|
||||
|
||||
}());
|
||||
|
||||
}(wu_sso_config));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(n){window.wu=window.wu||{},window.is_incognito=!1,window.wu.sso_denied=function(){wu_create_cookie("wu_sso_denied",1,n.expiration_in_minutes)},window.wu.check_for_incognito_window=function(){detectIncognito(n=>window.is_incognito=n.isPrivate)},window.wu.check_for_incognito_window(),window.addEventListener("error",wu.sso_denied,!0);const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.defer=!0,o.src=n.server_url+"?_jsonp=1";const e=wu_read_cookie("wu_sso_denied");if(document.head.insertAdjacentHTML("beforeend",`\n <style>\n @keyframes fade_in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n body.sso-loading {\n overflow: hidden;\n }\n body.sso-loading .sso-overlay {\n background: rgba(0, 0, 0, 0.7);\n width: 100vw;\n height: 100vh;\n position: absolute;\n top: 0;\n -webkit-animation: fade_in 300ms;\n -moz-animation: fade_in 300ms;\n -ms-animation: fade_in 300ms;\n -o-animation: fade_in 300ms;\n animation: fade_in 300ms;\n }\n body.sso-loading .sso-overlay::before {\n content: "";\n display: block;\n width: 20px;\n height: 20px;\n position: absolute;\n left: 50%;\n top: 50%;\n margin: -10px 0 0 -10px;\n transform: translateZ(0);\n background: transparent url(${n.img_folder}/spinner.gif) no-repeat center center;\n background-image: url(${n.img_folder}/loader.svg);\n background-size: 20px 20px;\n }\n </style>\n `),!n.is_user_logged_in&&!e){const n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(o,n),document.body.insertAdjacentHTML("beforeend",'<div class="sso-overlay"> </div>')}window.wu.sso=function(o){const e=encodeURIComponent(window.location.href);if(200===o.code)n.use_overlay&&document.body.classList.add("sso-loading"),"must-redirect"===o.verify?window.location.replace(`${n.server_url}?return_url=${e}`):window.location.replace(`${n.server_url}?sso_verify=${o.verify}&return_url=${e}`);else{if(window.is_incognito)return n.use_overlay&&document.body.classList.add("sso-loading"),void window.location.replace(`${n.server_url}?return_url=${e}`);window.wu.sso_denied(),document.body.classList.remove("sso-loading")}},window.history.replaceState&&window.history.replaceState(null,null,n.filtered_url+window.location.hash)}(wu_sso_config);
|
||||
@@ -0,0 +1,71 @@
|
||||
/* global wu_support_vars, Beacon, wu_block_ui, _wu_block_ui_polyfill */
|
||||
|
||||
let wu_install_support_widget_done = false;
|
||||
|
||||
const wu_install_support_widget = function() {
|
||||
|
||||
if (wu_install_support_widget_done === true) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
/* eslint-disable */
|
||||
!function (e, t, n) { function a() { var e = t.getElementsByTagName("script")[0], n = t.createElement("script"); n.type = "text/javascript", n.async = !0, n.src = "https://beacon-v2.helpscout.net", e.parentNode.insertBefore(n, e) } if (e.Beacon = n = function (t, n, a) { e.Beacon.readyQueue.push({ method: t, options: n, data: a }) }, n.readyQueue = [], "complete" === t.readyState) return a(); e.attachEvent ? e.attachEvent("onload", a) : e.addEventListener("load", a, !1) }(window, document, window.Beacon || function () { });
|
||||
|
||||
window.Beacon('init', '687a385f-df79-4b37-b6a9-7114a7d3d586');
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
wu_install_support_widget_done = true;
|
||||
|
||||
};
|
||||
|
||||
const hs_beacon = document.getElementsByClassName('wu-trigger-support');
|
||||
|
||||
if (hs_beacon.length) {
|
||||
|
||||
hs_beacon[0].addEventListener('click', function(a) {
|
||||
|
||||
wu_install_support_widget();
|
||||
|
||||
const blocked_ui = wu_support_vars.should_use_polyfills ? _wu_block_ui_polyfill('#wpcontent') : wu_block_ui('#wpcontent');
|
||||
|
||||
a.preventDefault();
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
Beacon('identify', {
|
||||
avatar: wu_support_vars.avatar, // Avatar
|
||||
name: wu_support_vars.display_name, // Full name
|
||||
email: wu_support_vars.email, // Email address
|
||||
licenseKey: wu_support_vars.license_key, // License key
|
||||
signature: wu_support_vars.signature,
|
||||
});
|
||||
|
||||
if (wu_support_vars.subject || wu_support_vars.message) {
|
||||
|
||||
Beacon('prefill', {
|
||||
subject: wu_support_vars.subject,
|
||||
text: wu_support_vars.message,
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
Beacon('on', 'open', function() {
|
||||
|
||||
if (blocked_ui) {
|
||||
|
||||
blocked_ui.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
Beacon('open');
|
||||
|
||||
}, 5E3);
|
||||
|
||||
}, false);
|
||||
|
||||
} // end if;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
let wu_install_support_widget_done=!1;const wu_install_support_widget=function(){!0!==wu_install_support_widget_done&&(!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){}),window.Beacon("init","687a385f-df79-4b37-b6a9-7114a7d3d586"),wu_install_support_widget_done=!0)},hs_beacon=document.getElementsByClassName("wu-trigger-support");hs_beacon.length&&hs_beacon[0].addEventListener("click",(function(e){!0!==wu_install_support_widget_done&&(function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){}),window.Beacon("init","687a385f-df79-4b37-b6a9-7114a7d3d586"),wu_install_support_widget_done=!0);const t=wu_support_vars.should_use_polyfills?_wu_block_ui_polyfill("#wpcontent"):wu_block_ui("#wpcontent");e.preventDefault(),setTimeout((function(){Beacon("identify",{avatar:wu_support_vars.avatar,name:wu_support_vars.display_name,email:wu_support_vars.email,licenseKey:wu_support_vars.license_key,signature:wu_support_vars.signature}),(wu_support_vars.subject||wu_support_vars.message)&&Beacon("prefill",{subject:wu_support_vars.subject,text:wu_support_vars.message}),Beacon("on","open",(function(){t&&t.unblock()})),Beacon("open")}),5e3)}),!1);
|
||||
@@ -0,0 +1,385 @@
|
||||
/* eslint-disable no-lonely-if */
|
||||
/* global _, vuedraggable, Vue, wu_block_ui, ajaxurl, wu_tax_ratesl10n */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Vue
|
||||
*/
|
||||
if ($('#wu-tax-rates').length) {
|
||||
|
||||
Vue.component('selectizer', {
|
||||
props: [
|
||||
'value',
|
||||
'id',
|
||||
'name',
|
||||
'model',
|
||||
'country',
|
||||
'state',
|
||||
'selected',
|
||||
'options',
|
||||
'placeholder',
|
||||
],
|
||||
template: '<input v-bind="$props">',
|
||||
updated() {
|
||||
|
||||
this.$nextTick(function() {
|
||||
|
||||
const options = jQuery(this.$el).data('__options');
|
||||
|
||||
if (options.data.country !== this.country) {
|
||||
|
||||
options.data.country = this.country;
|
||||
|
||||
jQuery(this.$el).data('__options', options);
|
||||
|
||||
this.$el.selectize.clear();
|
||||
|
||||
this.$el.selectize.clearOptions();
|
||||
|
||||
} // end if;
|
||||
|
||||
if (options.data.state !== this.state) {
|
||||
|
||||
options.data.state = this.state;
|
||||
|
||||
jQuery(this.$el).data('__options', options);
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
const that = this;
|
||||
|
||||
const item = this.$el;
|
||||
|
||||
window.wu_selector({
|
||||
el: item,
|
||||
maxItems: 1000,
|
||||
options: this.options,
|
||||
valueField: 'slug',
|
||||
labelField: 'name',
|
||||
searchField: ['slug', 'name'],
|
||||
create: true,
|
||||
templateName: 'checkout_form',
|
||||
data: {
|
||||
action: 'wu_search',
|
||||
model: this.model,
|
||||
country: this.country,
|
||||
state: this.state,
|
||||
number: 10,
|
||||
},
|
||||
});
|
||||
|
||||
this.$el.selectize.on('change', function(value) {
|
||||
|
||||
that.$emit('input', value);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
window.wu_tax_rates = new Vue({
|
||||
el: '#wu-tax-rates',
|
||||
components: {
|
||||
vuedraggable,
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
dragging: false,
|
||||
tax_category: 'default',
|
||||
switching: false,
|
||||
creating: false,
|
||||
create_name: '',
|
||||
toggle: false,
|
||||
loading: true,
|
||||
saving: false,
|
||||
initialLoading: true,
|
||||
error: false,
|
||||
changed: false,
|
||||
data: {
|
||||
default: {
|
||||
name: 'Default',
|
||||
rates: [],
|
||||
},
|
||||
},
|
||||
delete: [],
|
||||
saveMessage: '',
|
||||
errorMessage: '',
|
||||
rate_type: 'standard_rate',
|
||||
editing: 0,
|
||||
item: {
|
||||
title: wu_tax_ratesl10n.name,
|
||||
country: '',
|
||||
state: '',
|
||||
tax_rate: '',
|
||||
type: 'regular',
|
||||
compound: false,
|
||||
},
|
||||
};
|
||||
|
||||
},
|
||||
watch: {
|
||||
loading(new_value) {
|
||||
|
||||
if (new_value === true) {
|
||||
|
||||
window.wu_blocked_table = wu_block_ui('table.wp-list-table');
|
||||
|
||||
} else {
|
||||
|
||||
if (typeof window.wu_blocked_table !== 'undefined') {
|
||||
|
||||
window.wu_blocked_table.unblock();
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.loading = true;
|
||||
|
||||
this.pull_data(true);
|
||||
|
||||
$('.wu-tooltip-vue').tipTip();
|
||||
|
||||
const vm = this;
|
||||
|
||||
this.$watch('data', function() {
|
||||
|
||||
if (vm.initialLoading) {
|
||||
|
||||
vm.initialLoading = false;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
vm.changed = true;
|
||||
|
||||
}, {
|
||||
deep: true,
|
||||
});
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
// Create the event.
|
||||
const event = document.createEvent('Event');
|
||||
|
||||
// Define that the event name is 'build'.
|
||||
event.initEvent('vue_loaded', true, true);
|
||||
|
||||
event.vue = this;
|
||||
|
||||
// target can be any Element or other EventTarget.
|
||||
window.dispatchEvent(event);
|
||||
|
||||
},
|
||||
computed: {
|
||||
selected() {
|
||||
|
||||
return $(this.data[this.tax_category].rates).filter(function(index, item) {
|
||||
|
||||
return item.selected;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
refresh(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
this.loading = true;
|
||||
|
||||
this.pull_data();
|
||||
|
||||
},
|
||||
select_all(event) {
|
||||
|
||||
const toggle = $(event.target).is(':checked');
|
||||
|
||||
this.data[this.tax_category].rates = $.map(this.data[this.tax_category].rates, function(item) {
|
||||
|
||||
item.selected = toggle;
|
||||
|
||||
return item;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
pull_data() {
|
||||
|
||||
const that = this;
|
||||
|
||||
jQuery.getJSON(ajaxurl + '?action=wu_get_tax_rates').done(function(response) {
|
||||
|
||||
that.loading = false;
|
||||
|
||||
that.data = response.data;
|
||||
|
||||
})
|
||||
.fail(function(error) {
|
||||
|
||||
that.loading = false;
|
||||
|
||||
that.error = true;
|
||||
|
||||
that.errorMessage = error.statusText;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
add_tax_category() {
|
||||
|
||||
this.data[this.create_name] = {
|
||||
name: this.create_name,
|
||||
rates: [],
|
||||
};
|
||||
|
||||
this.creating = false;
|
||||
|
||||
this.tax_category = this.create_name;
|
||||
|
||||
},
|
||||
add_row() {
|
||||
|
||||
Vue.set(this.data[this.tax_category], 'rates', this.data[this.tax_category].rates.concat([
|
||||
{
|
||||
title: wu_tax_ratesl10n.name,
|
||||
country: '',
|
||||
state: '',
|
||||
tax_rate: '',
|
||||
type: 'regular',
|
||||
compound: false,
|
||||
},
|
||||
]));
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
},
|
||||
delete_tax_category() {
|
||||
|
||||
// eslint-disable-next-line no-alert
|
||||
const are_you_sure = confirm(wu_tax_ratesl10n.confirm_delete_tax_category_message);
|
||||
|
||||
const that = this;
|
||||
|
||||
if (are_you_sure) {
|
||||
|
||||
const cleaned_list = _.filter(this.data, function(item, index) {
|
||||
|
||||
return index !== that.tax_category;
|
||||
|
||||
});
|
||||
|
||||
that.data = cleaned_list.length ? cleaned_list : {
|
||||
default: {
|
||||
name: 'Default',
|
||||
rates: [],
|
||||
},
|
||||
};
|
||||
|
||||
that.tax_category = Object.keys(that.data).shift();
|
||||
|
||||
} // end if
|
||||
|
||||
},
|
||||
delete_rows() {
|
||||
|
||||
this.delete = this.delete.concat(this.selected.get());
|
||||
|
||||
// eslint-disable-next-line no-alert
|
||||
const are_you_sure = confirm(wu_tax_ratesl10n.confirm_message);
|
||||
|
||||
if (are_you_sure) {
|
||||
|
||||
const cleaned_list = $(this.data[this.tax_category].rates).filter(function(index, item) {
|
||||
|
||||
return ! item.selected;
|
||||
|
||||
});
|
||||
|
||||
Vue.set(this.data[this.tax_category], 'rates', cleaned_list.get());
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
} // end if
|
||||
|
||||
},
|
||||
save() {
|
||||
|
||||
const that = this;
|
||||
|
||||
that.saving = true;
|
||||
|
||||
if (typeof that.data[that.tax_category].rates !== 'undefined') {
|
||||
|
||||
_.map(that.data[that.tax_category].rates, (item, index) => {
|
||||
|
||||
item.priority = index * 10;
|
||||
|
||||
return item;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$.post({
|
||||
url: ajaxurl + '?action=wu_save_tax_rates&' + $('#nonce_form').serialize(),
|
||||
data: JSON.stringify({
|
||||
tax_rates: that.data,
|
||||
tax_category: that.tax_category,
|
||||
}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
}).success(function(data) {
|
||||
|
||||
that.saving = false;
|
||||
|
||||
that.changed = false;
|
||||
|
||||
that.delete = [];
|
||||
|
||||
that.saveMessage = data.message;
|
||||
|
||||
if (data.code === 'success') {
|
||||
|
||||
that.loading = true;
|
||||
|
||||
that.initialLoading = true;
|
||||
|
||||
that.pull_data();
|
||||
|
||||
that.tax_category = data.tax_category;
|
||||
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
|
||||
that.saveMessage = '';
|
||||
|
||||
}, 6000);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t){t(document).ready((function(){t("#wu-tax-rates").length&&(Vue.component("selectizer",{props:["value","id","name","model","country","state","selected","options","placeholder"],template:'<input v-bind="$props">',updated(){this.$nextTick((function(){const t=jQuery(this.$el).data("__options");t.data.country!==this.country&&(t.data.country=this.country,jQuery(this.$el).data("__options",t),this.$el.selectize.clear(),this.$el.selectize.clearOptions()),t.data.state!==this.state&&(t.data.state=this.state,jQuery(this.$el).data("__options",t))}))},mounted(){const t=this,e=this.$el;window.wu_selector({el:e,maxItems:1e3,options:this.options,valueField:"slug",labelField:"name",searchField:["slug","name"],create:!0,templateName:"checkout_form",data:{action:"wu_search",model:this.model,country:this.country,state:this.state,number:10}}),this.$el.selectize.on("change",(function(e){t.$emit("input",e)}))}}),window.wu_tax_rates=new Vue({el:"#wu-tax-rates",components:{vuedraggable:vuedraggable},data:()=>({dragging:!1,tax_category:"default",switching:!1,creating:!1,create_name:"",toggle:!1,loading:!0,saving:!1,initialLoading:!0,error:!1,changed:!1,data:{default:{name:"Default",rates:[]}},delete:[],saveMessage:"",errorMessage:"",rate_type:"standard_rate",editing:0,item:{title:wu_tax_ratesl10n.name,country:"",state:"",tax_rate:"",type:"regular",compound:!1}}),watch:{loading(t){!0===t?window.wu_blocked_table=wu_block_ui("table.wp-list-table"):void 0!==window.wu_blocked_table&&window.wu_blocked_table.unblock()}},mounted(){this.loading=!0,this.pull_data(!0),t(".wu-tooltip-vue").tipTip();const e=this;this.$watch("data",(function(){e.initialLoading?e.initialLoading=!1:e.changed=!0}),{deep:!0})},created(){const t=document.createEvent("Event");t.initEvent("vue_loaded",!0,!0),t.vue=this,window.dispatchEvent(t)},computed:{selected(){return t(this.data[this.tax_category].rates).filter((function(t,e){return e.selected}))}},methods:{refresh(t){t.preventDefault(),this.loading=!0,this.pull_data()},select_all(e){const a=t(e.target).is(":checked");this.data[this.tax_category].rates=t.map(this.data[this.tax_category].rates,(function(t){return t.selected=a,t}))},pull_data(){const t=this;jQuery.getJSON(ajaxurl+"?action=wu_get_tax_rates").done((function(e){t.loading=!1,t.data=e.data})).fail((function(e){t.loading=!1,t.error=!0,t.errorMessage=e.statusText}))},add_tax_category(){this.data[this.create_name]={name:this.create_name,rates:[]},this.creating=!1,this.tax_category=this.create_name},add_row(){Vue.set(this.data[this.tax_category],"rates",this.data[this.tax_category].rates.concat([{title:wu_tax_ratesl10n.name,country:"",state:"",tax_rate:"",type:"regular",compound:!1}])),this.$forceUpdate()},delete_tax_category(){const t=confirm(wu_tax_ratesl10n.confirm_delete_tax_category_message),e=this;if(t){const t=_.filter(this.data,(function(t,a){return a!==e.tax_category}));e.data=t.length?t:{default:{name:"Default",rates:[]}},e.tax_category=Object.keys(e.data).shift()}},delete_rows(){this.delete=this.delete.concat(this.selected.get());if(confirm(wu_tax_ratesl10n.confirm_message)){const e=t(this.data[this.tax_category].rates).filter((function(t,e){return!e.selected}));Vue.set(this.data[this.tax_category],"rates",e.get()),this.$forceUpdate()}},save(){const e=this;e.saving=!0,void 0!==e.data[e.tax_category].rates&&_.map(e.data[e.tax_category].rates,(t,e)=>(t.priority=10*e,t)),t.post({url:ajaxurl+"?action=wu_save_tax_rates&"+t("#nonce_form").serialize(),data:JSON.stringify({tax_rates:e.data,tax_category:e.tax_category}),dataType:"json",contentType:"application/json; charset=utf-8"}).success((function(t){e.saving=!1,e.changed=!1,e.delete=[],e.saveMessage=t.message,"success"===t.code&&(e.loading=!0,e.initialLoading=!0,e.pull_data(),e.tax_category=t.tax_category),setInterval((function(){e.saveMessage=""}),6e3)}))}}}))}))}(jQuery);
|
||||
@@ -0,0 +1,136 @@
|
||||
/* eslint-disable */
|
||||
(function() {
|
||||
|
||||
let graph = document.getElementById('wp-ultimo-taxes');
|
||||
|
||||
if (!graph) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
const tax_graph = new Vue({
|
||||
el: '#wp-ultimo-taxes',
|
||||
components: {
|
||||
apexchart: window.VueApexCharts,
|
||||
},
|
||||
data: {
|
||||
chart_options: {
|
||||
mrr_growth: {
|
||||
series: [
|
||||
{
|
||||
name: wu_tax_statistics_vars.i18n.net_profit_label,
|
||||
data: [
|
||||
wu_tax_statistics_vars.data.january.net_profit,
|
||||
wu_tax_statistics_vars.data.february.net_profit,
|
||||
wu_tax_statistics_vars.data.march.net_profit,
|
||||
wu_tax_statistics_vars.data.april.net_profit,
|
||||
wu_tax_statistics_vars.data.may.net_profit,
|
||||
wu_tax_statistics_vars.data.june.net_profit,
|
||||
wu_tax_statistics_vars.data.july.net_profit,
|
||||
wu_tax_statistics_vars.data.august.net_profit,
|
||||
wu_tax_statistics_vars.data.september.net_profit,
|
||||
wu_tax_statistics_vars.data.october.net_profit,
|
||||
wu_tax_statistics_vars.data.november.net_profit,
|
||||
wu_tax_statistics_vars.data.december.net_profit
|
||||
]
|
||||
},
|
||||
{
|
||||
name: wu_tax_statistics_vars.i18n.taxes_label,
|
||||
data: [
|
||||
wu_tax_statistics_vars.data.january.tax_total,
|
||||
wu_tax_statistics_vars.data.february.tax_total,
|
||||
wu_tax_statistics_vars.data.march.tax_total,
|
||||
wu_tax_statistics_vars.data.april.tax_total,
|
||||
wu_tax_statistics_vars.data.may.tax_total,
|
||||
wu_tax_statistics_vars.data.june.tax_total,
|
||||
wu_tax_statistics_vars.data.july.tax_total,
|
||||
wu_tax_statistics_vars.data.august.tax_total,
|
||||
wu_tax_statistics_vars.data.september.tax_total,
|
||||
wu_tax_statistics_vars.data.october.tax_total,
|
||||
wu_tax_statistics_vars.data.november.tax_total,
|
||||
wu_tax_statistics_vars.data.december.tax_total
|
||||
]
|
||||
},
|
||||
],
|
||||
chartOptions: {
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 300,
|
||||
stacked: true,
|
||||
toolbar: {
|
||||
show: false
|
||||
},
|
||||
zoom: {
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
maxItems: 0,
|
||||
},
|
||||
responsive: [{
|
||||
breakpoint: 480,
|
||||
options: {
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
offsetX: -10,
|
||||
offsetY: 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
colors: ['#2c3e50', '#95a5a6'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: false,
|
||||
columnWidth: '40%',
|
||||
endingShape: 'rounded',
|
||||
startingShape: 'rounded',
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
categories: wu_tax_statistics_vars.month_list,
|
||||
position: 'bottom',
|
||||
axisBorder: {
|
||||
show: true
|
||||
},
|
||||
axisTicks: {
|
||||
show: true
|
||||
},
|
||||
crosshairs: {
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
colorFrom: '#D8E3F0',
|
||||
colorTo: '#BED1E6',
|
||||
stops: [0, 100],
|
||||
opacityFrom: 0.4,
|
||||
opacityTo: 0.5,
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
enabled: true,
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
formatter: function (y) {
|
||||
return y >= 0 ? wu_format_money(y) : '-' + wu_format_money(y);
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
offsetY: 0
|
||||
},
|
||||
fill: {
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}());
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){if(!document.getElementById("wp-ultimo-taxes"))return;new Vue({el:"#wp-ultimo-taxes",components:{apexchart:window.VueApexCharts},data:{chart_options:{mrr_growth:{series:[{name:wu_tax_statistics_vars.i18n.net_profit_label,data:[wu_tax_statistics_vars.data.january.net_profit,wu_tax_statistics_vars.data.february.net_profit,wu_tax_statistics_vars.data.march.net_profit,wu_tax_statistics_vars.data.april.net_profit,wu_tax_statistics_vars.data.may.net_profit,wu_tax_statistics_vars.data.june.net_profit,wu_tax_statistics_vars.data.july.net_profit,wu_tax_statistics_vars.data.august.net_profit,wu_tax_statistics_vars.data.september.net_profit,wu_tax_statistics_vars.data.october.net_profit,wu_tax_statistics_vars.data.november.net_profit,wu_tax_statistics_vars.data.december.net_profit]},{name:wu_tax_statistics_vars.i18n.taxes_label,data:[wu_tax_statistics_vars.data.january.tax_total,wu_tax_statistics_vars.data.february.tax_total,wu_tax_statistics_vars.data.march.tax_total,wu_tax_statistics_vars.data.april.tax_total,wu_tax_statistics_vars.data.may.tax_total,wu_tax_statistics_vars.data.june.tax_total,wu_tax_statistics_vars.data.july.tax_total,wu_tax_statistics_vars.data.august.tax_total,wu_tax_statistics_vars.data.september.tax_total,wu_tax_statistics_vars.data.october.tax_total,wu_tax_statistics_vars.data.november.tax_total,wu_tax_statistics_vars.data.december.tax_total]}],chartOptions:{chart:{type:"bar",height:300,stacked:!0,toolbar:{show:!1},zoom:{enabled:!0}},dataLabels:{enabled:!1,maxItems:0},responsive:[{breakpoint:480,options:{legend:{position:"bottom",offsetX:-10,offsetY:0}}}],colors:["#2c3e50","#95a5a6"],plotOptions:{bar:{horizontal:!1,columnWidth:"40%",endingShape:"rounded",startingShape:"rounded"}},xaxis:{categories:wu_tax_statistics_vars.month_list,position:"bottom",axisBorder:{show:!0},axisTicks:{show:!0},crosshairs:{fill:{type:"gradient",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}}},tooltip:{enabled:!0}},yaxis:{labels:{formatter:function(t){return t>=0?wu_format_money(t):"-"+wu_format_money(t)}}},legend:{position:"top",offsetY:0},fill:{opacity:1}}}}}})}();
|
||||
@@ -0,0 +1,143 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
const CreateCookie = (name, value, days) => {
|
||||
let expires;
|
||||
if (days) {
|
||||
const date = /* @__PURE__ */ new Date();
|
||||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
} else {
|
||||
expires = "";
|
||||
}
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
};
|
||||
const ReadCookie = (name) => {
|
||||
const nameEQ = name + "=";
|
||||
const ca = document.cookie.split(";");
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let 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;
|
||||
};
|
||||
const ListenToCookieChange = (name, callback) => {
|
||||
let cookie_value = ReadCookie(name);
|
||||
setInterval(function() {
|
||||
const new_cookie_value = ReadCookie(name);
|
||||
if (new_cookie_value !== cookie_value) {
|
||||
cookie_value = new_cookie_value;
|
||||
callback(cookie_value);
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
window.addEventListener("beforeunload", () => {
|
||||
var _a;
|
||||
return (_a = window.top) == null ? void 0 : _a.postMessage("wu_preview_changed", "*");
|
||||
});
|
||||
CreateCookie("wu_template", "");
|
||||
const isIOS = () => {
|
||||
var _a;
|
||||
window.addEventListener("touchstart", () => {
|
||||
});
|
||||
const iDevices = [
|
||||
"iPad Simulator",
|
||||
"iPhone Simulator",
|
||||
"iPod Simulator",
|
||||
"iPad",
|
||||
"iPhone",
|
||||
"iPod"
|
||||
];
|
||||
const platform = ((_a = navigator == null ? void 0 : navigator.userAgentData) == null ? void 0 : _a.platform) || (navigator == null ? void 0 : navigator.platform) || "";
|
||||
return iDevices.includes(platform);
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
var _a;
|
||||
ListenToCookieChange("wu_selected_products", () => document.location.reload());
|
||||
const iframe = document.getElementById("iframe");
|
||||
const wn = iframe == null ? void 0 : iframe.contentWindow;
|
||||
wn == null ? void 0 : wn.postMessage("Hello to iframe from parent!", "https://" + location.hostname);
|
||||
const elements = document.querySelectorAll("#action-select, #action-select2");
|
||||
elements.forEach((element) => element.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
const value = document.getElementById("template-selector").value;
|
||||
CreateCookie("wu_template", value);
|
||||
window.close();
|
||||
}));
|
||||
iframe == null ? void 0 : iframe.addEventListener("load", () => {
|
||||
var _a2;
|
||||
if (isIOS()) {
|
||||
const body = (_a2 = document.getElementById("iframe")) == null ? void 0 : _a2.getElementsByTagName("body")[0];
|
||||
body == null ? void 0 : body.classList.add("wu-fix-safari-preview");
|
||||
(body == null ? void 0 : body.style) && Object.assign(body.style, {
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
"overflow-y": "scroll",
|
||||
"-webkit-overflow-scrolling": "touch"
|
||||
});
|
||||
}
|
||||
});
|
||||
const adjustIframeHeight = () => {
|
||||
var _a2;
|
||||
const ee = ((_a2 = document.getElementById("switcher")) == null ? void 0 : _a2.offsetHeight) || 0;
|
||||
iframe.style.height = document.body.offsetHeight - ee + "px";
|
||||
};
|
||||
window.addEventListener("resize", adjustIframeHeight);
|
||||
adjustIframeHeight();
|
||||
const toggleList = () => {
|
||||
const list = document.querySelectorAll("#theme_list ul");
|
||||
list.forEach((element) => element.style.display = element.style.display === "none" ? "block" : "none");
|
||||
};
|
||||
toggleList();
|
||||
(_a = document.getElementById("template_selector")) == null ? void 0 : _a.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
toggleList();
|
||||
});
|
||||
document.querySelectorAll("#theme_list ul li a").forEach((element) => element.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
toggleList();
|
||||
const target = event.currentTarget;
|
||||
const href = target.getAttribute("href") || "";
|
||||
iframe.src = target.getAttribute("data-frame") || "";
|
||||
const selector = document.getElementById("template_selector");
|
||||
const selectorText = selector.firstChild;
|
||||
selectorText.nodeValue = target.getAttribute("data-title") || "";
|
||||
window.history.pushState({}, "", href);
|
||||
}));
|
||||
const headerBar = document.getElementById("header-bar");
|
||||
if (headerBar) {
|
||||
headerBar.style.display = "none";
|
||||
}
|
||||
const screenSizes = {
|
||||
desktop: "100%",
|
||||
tabletlandscape: "1040px",
|
||||
tabletportrait: "788px",
|
||||
mobilelandscape: "500px",
|
||||
mobileportrait: "340px",
|
||||
placebo: "0px"
|
||||
};
|
||||
document.querySelectorAll(".responsive a").forEach((element) => element.addEventListener("click", (event) => {
|
||||
const target = event.currentTarget;
|
||||
const width = Array.from(target.classList).reduce((acc, cur) => {
|
||||
if (screenSizes[cur]) {
|
||||
acc = screenSizes[cur];
|
||||
}
|
||||
return acc;
|
||||
}, "");
|
||||
iframe.style.width = width;
|
||||
iframe.style.transition = "200ms";
|
||||
document.querySelectorAll(".responsive a").forEach((element2) => element2.classList.remove("active"));
|
||||
target.classList.add("active");
|
||||
}));
|
||||
if (navigator.userAgent.match(/iPad/i) !== null) {
|
||||
iframe.style.height = "100%";
|
||||
}
|
||||
});
|
||||
})()
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";const e=(e,t,n)=>{let o;if(n){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),o="; expires="+e.toUTCString()}else o="";document.cookie=e+"="+t+o+"; path=/"},t=e=>{const t=e+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null};window.addEventListener("beforeunload",(()=>{var e;return null==(e=window.top)?void 0:e.postMessage("wu_preview_changed","*")})),e("wu_template","");document.addEventListener("DOMContentLoaded",(()=>{var n;((e,n)=>{let o=t(e);setInterval((function(){const l=t(e);l!==o&&(o=l,n(o))}),100)})("wu_selected_products",(()=>document.location.reload()));const o=document.getElementById("iframe"),l=null==o?void 0:o.contentWindow;null==l||l.postMessage("Hello to iframe from parent!","https://"+location.hostname);document.querySelectorAll("#action-select, #action-select2").forEach((t=>t.addEventListener("click",(t=>{t.preventDefault();const n=document.getElementById("template-selector").value;e("wu_template",n),window.close()})))),null==o||o.addEventListener("load",(()=>{var e;if((()=>{var e;window.addEventListener("touchstart",(()=>{}));const t=(null==(e=null==navigator?void 0:navigator.userAgentData)?void 0:e.platform)||(null==navigator?void 0:navigator.platform)||"";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(t)})()){const t=null==(e=document.getElementById("iframe"))?void 0:e.getElementsByTagName("body")[0];null==t||t.classList.add("wu-fix-safari-preview"),(null==t?void 0:t.style)&&Object.assign(t.style,{position:"fixed",top:0,right:0,bottom:0,left:0,"overflow-y":"scroll","-webkit-overflow-scrolling":"touch"})}}));const i=()=>{var e;const t=(null==(e=document.getElementById("switcher"))?void 0:e.offsetHeight)||0;o.style.height=document.body.offsetHeight-t+"px"};window.addEventListener("resize",i),i();const a=()=>{document.querySelectorAll("#theme_list ul").forEach((e=>e.style.display="none"===e.style.display?"block":"none"))};a(),null==(n=document.getElementById("template_selector"))||n.addEventListener("click",(e=>{e.preventDefault(),a()})),document.querySelectorAll("#theme_list ul li a").forEach((e=>e.addEventListener("click",(e=>{e.preventDefault(),a();const t=e.currentTarget,n=t.getAttribute("href")||"";o.src=t.getAttribute("data-frame")||"";document.getElementById("template_selector").firstChild.nodeValue=t.getAttribute("data-title")||"",window.history.pushState({},"",n)}))));const r=document.getElementById("header-bar");r&&(r.style.display="none");const s={desktop:"100%",tabletlandscape:"1040px",tabletportrait:"788px",mobilelandscape:"500px",mobileportrait:"340px",placebo:"0px"};document.querySelectorAll(".responsive a").forEach((e=>e.addEventListener("click",(e=>{const t=e.currentTarget,n=Array.from(t.classList).reduce(((e,t)=>(s[t]&&(e=s[t]),e)),"");o.style.width=n,o.style.transition="200ms",document.querySelectorAll(".responsive a").forEach((e=>e.classList.remove("active"))),t.classList.add("active")})))),null!==navigator.userAgent.match(/iPad/i)&&(o.style.height="100%")}))})();
|
||||
@@ -0,0 +1,219 @@
|
||||
/* global wu_template_switching_params, Vue, wu_create_cookie, wu_listen_to_cookie_change */
|
||||
(function($, hooks) {
|
||||
|
||||
/*
|
||||
* Sets up the cookie listener for template selection.
|
||||
*/
|
||||
hooks.addAction('wu_checkout_loaded', 'nextpress/wp-ultimo', function() {
|
||||
|
||||
/*
|
||||
* Resets the template selection cookie.
|
||||
*/
|
||||
wu_create_cookie('wu_template', false);
|
||||
|
||||
/*
|
||||
* Listens for changes and set the template if one is detected.
|
||||
*/
|
||||
wu_listen_to_cookie_change('wu_template', function(value) {
|
||||
|
||||
window.wu_template_switching.template_id = value;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
const dynamic = {
|
||||
functional: true,
|
||||
template: '#dynamic',
|
||||
props: ['template'],
|
||||
render(h, context) {
|
||||
|
||||
const template = context.props.template;
|
||||
|
||||
const component = template ? { template } : '<div>nbsp;</div>';
|
||||
|
||||
return h(component);
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
hooks.doAction('wu_checkout_loaded');
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
window.wu_template_switching = new Vue({
|
||||
el: '#wp-ultimo-form-wu-template-switching-form',
|
||||
data() {
|
||||
|
||||
return {
|
||||
template_id: 0,
|
||||
original_template_id: -1,
|
||||
template_category: '',
|
||||
stored_templates: {},
|
||||
confirm_switch: 0,
|
||||
ready: false,
|
||||
};
|
||||
|
||||
},
|
||||
directives: {
|
||||
init: {
|
||||
bind(el, binding, vnode) {
|
||||
|
||||
vnode.context[binding.arg] = binding.value;
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
dynamic,
|
||||
},
|
||||
watch: {
|
||||
ready() {
|
||||
|
||||
const that = this;
|
||||
|
||||
if (that.ready !== false) {
|
||||
|
||||
that.switch_template();
|
||||
|
||||
} // end if;
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
get_template(template, data) {
|
||||
|
||||
if (typeof data.id === 'undefined') {
|
||||
|
||||
data.id = 'default';
|
||||
|
||||
} // end if;
|
||||
|
||||
const template_name = template + '/' + data.id;
|
||||
|
||||
if (typeof this.stored_templates[template_name] !== 'undefined') {
|
||||
|
||||
return this.stored_templates[template_name];
|
||||
|
||||
} // end if;
|
||||
|
||||
const template_data = {
|
||||
duration: this.duration,
|
||||
duration_unit: this.duration_unit,
|
||||
products: this.products,
|
||||
...data,
|
||||
};
|
||||
|
||||
this.fetch_template(template, template_data);
|
||||
|
||||
return '<div class="wu-p-4 wu-bg-gray-100 wu-text-center wu-rounded">Loading</div>';
|
||||
|
||||
},
|
||||
fetch_template(template, data) {
|
||||
|
||||
const that = this;
|
||||
|
||||
if (typeof data.id === 'undefined') {
|
||||
|
||||
data.id = 'default';
|
||||
|
||||
} // end if;
|
||||
|
||||
this.request('wu_render_field_template', {
|
||||
template,
|
||||
attributes: data,
|
||||
}, function(results) {
|
||||
|
||||
const template_name = template + '/' + data.id;
|
||||
|
||||
if (results.success) {
|
||||
|
||||
Vue.set(that.stored_templates, template_name, results.data.html);
|
||||
|
||||
} else {
|
||||
|
||||
Vue.set(that.stored_templates, template_name, '<div>' + results.data[0].message + '</div>');
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
switch_template() {
|
||||
|
||||
const that = this;
|
||||
|
||||
that.block();
|
||||
|
||||
this.request('wu_switch_template', {
|
||||
template_id: that.template_id,
|
||||
}, function(results) {
|
||||
|
||||
/*
|
||||
* Redirect of we get a redirect URL back.
|
||||
*/
|
||||
if (typeof results.data.redirect_url === 'string') {
|
||||
|
||||
window.location.href = results.data.redirect_url;
|
||||
|
||||
} // end if;
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
block() {
|
||||
|
||||
/*
|
||||
* Get the first bg color from a parent.
|
||||
*/
|
||||
const bg_color = jQuery(this.$el).parents().filter(function() {
|
||||
|
||||
return $(this).css('backgroundColor') !== 'rgba(0, 0, 0, 0)';
|
||||
|
||||
}).first().css('backgroundColor');
|
||||
|
||||
jQuery(this.$el).wu_block({
|
||||
message: '<div class="spinner is-active wu-float-none" style="float: none !important;"></div>',
|
||||
overlayCSS: {
|
||||
backgroundColor: bg_color ? bg_color : '#ffffff',
|
||||
opacity: 0.6,
|
||||
},
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '50%',
|
||||
fontSize: '14px !important',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: 'none',
|
||||
backgroundColor: 'none',
|
||||
cursor: 'wait',
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
unblock() {
|
||||
|
||||
jQuery(this.$el).wu_unblock();
|
||||
|
||||
},
|
||||
request(action, data, success_handler, error_handler) {
|
||||
|
||||
jQuery.ajax({
|
||||
method: 'POST',
|
||||
url: wu_template_switching_params.ajaxurl + '&action=' + action,
|
||||
data,
|
||||
success: success_handler,
|
||||
error: error_handler,
|
||||
});
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery, wp.hooks));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(t,e){e.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(){wu_create_cookie("wu_template",!1),wu_listen_to_cookie_change("wu_template",(function(t){window.wu_template_switching.template_id=t}))})),t(document).ready((function(){const i={functional:!0,template:"#dynamic",props:["template"],render(t,e){const i=e.props.template;return t(i?{template:i}:"<div>nbsp;</div>")}};e.doAction("wu_checkout_loaded"),window.wu_template_switching=new Vue({el:"#wp-ultimo-form-wu-template-switching-form",data:()=>({template_id:0,original_template_id:-1,template_category:"",stored_templates:{},confirm_switch:0,ready:!1}),directives:{init:{bind(t,e,i){i.context[e.arg]=e.value}}},components:{dynamic:i},watch:{ready(){const t=this;!1!==t.ready&&t.switch_template()}},methods:{get_template(t,e){void 0===e.id&&(e.id="default");const i=t+"/"+e.id;if(void 0!==this.stored_templates[i])return this.stored_templates[i];const o={duration:this.duration,duration_unit:this.duration_unit,products:this.products,...e};return this.fetch_template(t,o),'<div class="wu-p-4 wu-bg-gray-100 wu-text-center wu-rounded">Loading</div>'},fetch_template(t,e){const i=this;void 0===e.id&&(e.id="default"),this.request("wu_render_field_template",{template:t,attributes:e},(function(o){const a=t+"/"+e.id;o.success?Vue.set(i.stored_templates,a,o.data.html):Vue.set(i.stored_templates,a,"<div>"+o.data[0].message+"</div>")}))},switch_template(){this.block(),this.request("wu_switch_template",{template_id:this.template_id},(function(t){"string"==typeof t.data.redirect_url&&(window.location.href=t.data.redirect_url)}))},block(){const e=jQuery(this.$el).parents().filter((function(){return"rgba(0, 0, 0, 0)"!==t(this).css("backgroundColor")})).first().css("backgroundColor");jQuery(this.$el).wu_block({message:'<div class="spinner is-active wu-float-none" style="float: none !important;"></div>',overlayCSS:{backgroundColor:e||"#ffffff",opacity:.6},css:{padding:0,margin:0,width:"50%",fontSize:"14px !important",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"none",backgroundColor:"none",cursor:"wait"}})},unblock(){jQuery(this.$el).wu_unblock()},request(t,e,i,o){jQuery.ajax({method:"POST",url:wu_template_switching_params.ajaxurl+"&action="+t,data:e,success:i,error:o})}}})}))}(jQuery,wp.hooks);
|
||||
@@ -0,0 +1,139 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
const TransitionText = (element, has_icon = false) => {
|
||||
return {
|
||||
classes: [],
|
||||
has_icon: false,
|
||||
original_value: element.innerHTML,
|
||||
get_icon() {
|
||||
return this.has_icon ? '<span class="wu-spin wu-inline-block wu-mr-2"><span class="dashicons-wu-loader"></span></span>' : "";
|
||||
},
|
||||
clear_classes() {
|
||||
element.classList.remove(...this.classes);
|
||||
},
|
||||
add_classes(classes) {
|
||||
this.classes = classes;
|
||||
element.classList.add(...classes);
|
||||
},
|
||||
text(text, classes, toggle_icon = false) {
|
||||
this.clear_classes();
|
||||
if (toggle_icon) {
|
||||
this.has_icon = !this.has_icon;
|
||||
}
|
||||
element.animate([
|
||||
{
|
||||
opacity: "1"
|
||||
},
|
||||
{
|
||||
opacity: "0.75"
|
||||
}
|
||||
], {
|
||||
duration: 300,
|
||||
iterations: 1
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.add_classes(classes ?? []);
|
||||
element.innerHTML = this.get_icon() + text;
|
||||
element.style.opacity = "0.75";
|
||||
}, 300);
|
||||
return this;
|
||||
},
|
||||
done(timeout = 5e3) {
|
||||
setTimeout(() => {
|
||||
element.animate([
|
||||
{
|
||||
opacity: "0.75"
|
||||
},
|
||||
{
|
||||
opacity: "1"
|
||||
}
|
||||
], {
|
||||
duration: 300,
|
||||
iterations: 1
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.clear_classes();
|
||||
element.innerHTML = this.original_value;
|
||||
element.style.opacity = "1";
|
||||
}, 300);
|
||||
}, timeout);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll(".wu-resend-verification-email").forEach((element) => element.addEventListener("click", async (event) => {
|
||||
event.preventDefault();
|
||||
const transitional_text = TransitionText(element, true).text(wu_thank_you.i18n.resending_verification_email, ["wu-text-gray-400"]);
|
||||
const request = await fetch(
|
||||
wu_thank_you.ajaxurl,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
action: "wu_resend_verification_email",
|
||||
_ajax_nonce: wu_thank_you.resend_verification_email_nonce
|
||||
})
|
||||
}
|
||||
);
|
||||
const response = await request.json();
|
||||
if (response.success) {
|
||||
transitional_text.text(wu_thank_you.i18n.email_sent, ["wu-text-green-700"], true).done();
|
||||
} else {
|
||||
transitional_text.text(response.data[0].message, ["wu-text-red-600"], true).done();
|
||||
}
|
||||
}));
|
||||
if (!document.getElementById("wu-sites")) {
|
||||
return;
|
||||
}
|
||||
const { Vue, defineComponent } = window.wu_vue;
|
||||
window.wu_sites = new Vue(defineComponent({
|
||||
el: "#wu-sites",
|
||||
data() {
|
||||
return {
|
||||
creating: wu_thank_you.creating,
|
||||
next_queue: parseInt(wu_thank_you.next_queue, 10) + 5,
|
||||
random: 0,
|
||||
progress_in_seconds: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
progress() {
|
||||
return Math.round(this.progress_in_seconds / this.next_queue * 100);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (wu_thank_you.has_pending_site) {
|
||||
this.check_site_created();
|
||||
return;
|
||||
}
|
||||
if (this.next_queue <= 0 || wu_thank_you.creating) {
|
||||
return;
|
||||
}
|
||||
const interval_seconds = setInterval(() => {
|
||||
this.progress_in_seconds++;
|
||||
if (this.progress_in_seconds >= this.next_queue) {
|
||||
clearInterval(interval_seconds);
|
||||
window.location.reload();
|
||||
}
|
||||
if (this.progress_in_seconds % 5 === 0) {
|
||||
fetch("/wp-cron.php?doing_wp_cron");
|
||||
}
|
||||
}, 1e3);
|
||||
},
|
||||
methods: {
|
||||
async check_site_created() {
|
||||
const url = new URL(wu_thank_you.ajaxurl);
|
||||
url.searchParams.set("action", "wu_check_pending_site_created");
|
||||
url.searchParams.set("membership_hash", wu_thank_you.membership_hash);
|
||||
const response = await fetch(url).then((request) => request.json());
|
||||
if (response.publish_status === "completed") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
this.creating = response.publish_status === "running";
|
||||
setTimeout(this.check_site_created, 3e3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
})()
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";const e=(e,t=!1)=>({classes:[],has_icon:!1,original_value:e.innerHTML,get_icon(){return this.has_icon?'<span class="wu-spin wu-inline-block wu-mr-2"><span class="dashicons-wu-loader"></span></span>':""},clear_classes(){e.classList.remove(...this.classes)},add_classes(t){this.classes=t,e.classList.add(...t)},text(t,s,n=!1){return this.clear_classes(),n&&(this.has_icon=!this.has_icon),e.animate([{opacity:"1"},{opacity:"0.75"}],{duration:300,iterations:1}),setTimeout((()=>{this.add_classes(s??[]),e.innerHTML=this.get_icon()+t,e.style.opacity="0.75"}),300),this},done(t=5e3){return setTimeout((()=>{e.animate([{opacity:"0.75"},{opacity:"1"}],{duration:300,iterations:1}),setTimeout((()=>{this.clear_classes(),e.innerHTML=this.original_value,e.style.opacity="1"}),300)}),t),this}});document.addEventListener("DOMContentLoaded",(()=>{if(document.querySelectorAll(".wu-resend-verification-email").forEach((t=>t.addEventListener("click",(async s=>{s.preventDefault();const n=e(t,!0).text(wu_thank_you.i18n.resending_verification_email,["wu-text-gray-400"]),i=await fetch(wu_thank_you.ajaxurl,{method:"POST",body:JSON.stringify({action:"wu_resend_verification_email",_ajax_nonce:wu_thank_you.resend_verification_email_nonce})}),a=await i.json();a.success?n.text(wu_thank_you.i18n.email_sent,["wu-text-green-700"],!0).done():n.text(a.data[0].message,["wu-text-red-600"],!0).done()})))),!document.getElementById("wu-sites"))return;const{Vue:t,defineComponent:s}=window.wu_vue;window.wu_sites=new t(s({el:"#wu-sites",data:()=>({creating:wu_thank_you.creating,next_queue:parseInt(wu_thank_you.next_queue,10)+5,random:0,progress_in_seconds:0}),computed:{progress(){return Math.round(this.progress_in_seconds/this.next_queue*100)}},mounted(){if(wu_thank_you.has_pending_site)return void this.check_site_created();if(this.next_queue<=0||wu_thank_you.creating)return;const e=setInterval((()=>{this.progress_in_seconds++,this.progress_in_seconds>=this.next_queue&&(clearInterval(e),window.location.reload()),this.progress_in_seconds%5==0&&fetch("/wp-cron.php?doing_wp_cron")}),1e3)},methods:{async check_site_created(){const e=new URL(wu_thank_you.ajaxurl);e.searchParams.set("action","wu_check_pending_site_created"),e.searchParams.set("membership_hash",wu_thank_you.membership_hash);const t=await fetch(e).then((e=>e.json()));"completed"===t.publish_status?window.location.reload():(this.creating="running"===t.publish_status,setTimeout(this.check_site_created,3e3))}}}))}))})();
|
||||
@@ -0,0 +1,100 @@
|
||||
/* global Shepherd, _, wu_tours, ajaxurl, wu_tours_vars */
|
||||
(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
_.each(wu_tours, function(tour, tour_id) {
|
||||
|
||||
window[tour_id] = new Shepherd.Tour({
|
||||
useModalOverlay: true,
|
||||
includeStyles: false,
|
||||
styleVariables: {
|
||||
arrowSize: 1.1,
|
||||
},
|
||||
defaultStepOptions: {
|
||||
classes: 'wu-p-2 wu-bg-white wu-shadow-sm wu-rounded wu-text-left wu-text-gray-700',
|
||||
scrollTo: {
|
||||
block: 'center',
|
||||
behavior: 'smooth',
|
||||
},
|
||||
tippyOptions: {
|
||||
zIndex: 999999,
|
||||
onCreate(instance) {
|
||||
|
||||
instance.popper.classList.add('wu-styling');
|
||||
|
||||
const elements = instance.popperChildren.content.children[0].children[0].children;
|
||||
|
||||
if (elements[0].children[0]) {
|
||||
|
||||
elements[0].children[0].classList.add('wu-p-2', 'wu-pb-0', 'wu-m-0', 'wu--mb-1', 'wu-text-gray-800');
|
||||
|
||||
} // end if;
|
||||
|
||||
elements[1].classList.add('wu-p-2');
|
||||
|
||||
elements[2].classList.add('wu--mt-1', 'wu-p-2', 'wu-bg-gray-200', 'wu-rounded', 'wu-text-right');
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
window[tour_id].on('complete', function() {
|
||||
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'wu_mark_tour_as_finished',
|
||||
tour_id,
|
||||
nonce: wu_tours_vars.nonce,
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
_.each(tour, function(step, step_index) {
|
||||
|
||||
const last_step = (step_index + 1) === tour.length;
|
||||
|
||||
const action_url = function(url, target = '_blank') {
|
||||
|
||||
return () => {
|
||||
|
||||
window.open(url, target);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
step.buttons = _.isArray(step.buttons) ? step.buttons : [];
|
||||
|
||||
step.buttons = _.map(step.buttons, function(item) {
|
||||
|
||||
item.action = action_url(item.url, item.target);
|
||||
|
||||
return item;
|
||||
|
||||
});
|
||||
|
||||
window[tour_id].addStep({
|
||||
...step,
|
||||
buttons: [
|
||||
...step.buttons,
|
||||
{
|
||||
classes: 'button button-primary wu-text-xs sm:wu-normal-case',
|
||||
text: last_step ? wu_tours_vars.i18n.finish : wu_tours_vars.i18n.next,
|
||||
action: window[tour_id].next,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
window[tour_id].start();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
Loaded 100 of 5432 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user