PluginProbe ʕ •ᴥ•ʔ
Nested Pages / 3.0.6
Nested Pages v3.0.6
3.3.1 3.2.15 3.2.14 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.2 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.3.1 1.6.3.2 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.6 1.6.7 1.6.8 1.7.0 1.7.1 2.0.1 2.0.2 2.0.3 2.0.4 3.0.1 3.0.10 3.0.11 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.21 3.1.22 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7
wp-nested-pages / assets / js / lib / nestedpages.clone.js
wp-nested-pages / assets / js / lib Last commit date
jquery.mjs.nestedSortable.js 11 years ago jquery.ui.touch-punch.min.js 11 years ago nestedpages-factory.js 8 years ago nestedpages.bulk-actions.js 8 years ago nestedpages.check-all.js 9 years ago nestedpages.clone.js 8 years ago nestedpages.confirm-delete.js 8 years ago nestedpages.dropdowns.js 8 years ago nestedpages.formatter.js 8 years ago nestedpages.hidden-item-count.js 9 years ago nestedpages.manual-sync.js 9 years ago nestedpages.menu-links.js 8 years ago nestedpages.menu-search.js 11 years ago nestedpages.menu-toggle.js 8 years ago nestedpages.modals.js 8 years ago nestedpages.move-post.js 8 years ago nestedpages.nesting.js 8 years ago nestedpages.new-post.js 8 years ago nestedpages.page-toggle.js 9 years ago nestedpages.post-search.js 9 years ago nestedpages.quickedit-link.js 8 years ago nestedpages.quickedit-post.js 8 years ago nestedpages.settings-reset.js 8 years ago nestedpages.settings.js 8 years ago nestedpages.sync-menu-setting.js 8 years ago nestedpages.tabs.js 11 years ago nestedpages.trash.js 8 years ago nestedpages.wpml.js 8 years ago
nestedpages.clone.js
78 lines
1 var NestedPages = NestedPages || {};
2
3 /**
4 * Post clone functionality
5 * @package Nested Pages
6 * @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
7 */
8 NestedPages.Clone = function()
9 {
10 var plugin = this;
11 var $ = jQuery;
12
13 plugin.parent_id = ''; // The parent/source post ID
14 plugin.parent_title = ''; // The parent title
15 plugin.parentLi = null;
16
17 plugin.formatter = new NestedPages.Formatter;
18
19 plugin.bindEvents = function()
20 {
21 $(document).on('click', NestedPages.selectors.cloneButton, function(e){
22 e.preventDefault();
23 plugin.parent_id = $(this).attr('data-id');
24 plugin.parent_title = $(this).attr('data-parentname');
25 plugin.parentLi = $(this).parent('.row').parent('.page-row').parent('.npList');
26 plugin.openModal();
27 });
28 $(document).on('click', NestedPages.selectors.confirmClone, function(e){
29 e.preventDefault();
30 plugin.clone();
31 });
32 }
33
34 // Open the modal with clone options
35 plugin.openModal = function()
36 {
37 $('#' + NestedPages.selectors.cloneModal).find('[data-clone-parent]').text(plugin.parent_title);
38 $(document).trigger('open-modal-manual', NestedPages.selectors.cloneModal);
39 }
40
41 // Clone the post
42 plugin.clone = function()
43 {
44 plugin.toggleLoading(true);
45 $.ajax({
46 url : NestedPages.jsData.ajaxurl,
47 type : 'post',
48 data : {
49 action : NestedPages.formActions.clonePost,
50 parent_id : plugin.parent_id,
51 quantity : $(NestedPages.selectors.cloneQuantity).val(),
52 status : $(NestedPages.selectors.cloneStatus).val(),
53 author : $(NestedPages.selectors.cloneAuthor).find('select').val(),
54 nonce : NestedPages.jsData.nonce,
55 posttype : NestedPages.jsData.posttype
56 },
57 success : function(data){
58 plugin.toggleLoading(false);
59 $(document).trigger('close-modal-manual');
60 location.reload();
61 }
62 });
63 }
64
65 // Toggle Loading
66 plugin.toggleLoading = function(loading)
67 {
68 if ( loading ){
69 $('#' + NestedPages.selectors.cloneModal).find('[data-clone-loading]').show();
70 $(NestedPages.selectors.confirmClone).attr('disabled', 'disabled');
71 return;
72 }
73 $('#' + NestedPages.selectors.cloneModal).find('[data-clone-loading]').hide();
74 $(NestedPages.selectors.confirmClone).attr('disabled', false);
75 }
76
77 return plugin.bindEvents();
78 }