Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,84 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
( function( $ ) {
|
||||
|
||||
var media = wp.media,
|
||||
curAttachmentsBrowser = media.view.AttachmentsBrowser;
|
||||
|
||||
media.view.AttachmentFilters.Taxonomy = media.view.AttachmentFilters.extend( {
|
||||
tagName: 'select',
|
||||
createFilters: function() {
|
||||
var filters = {},
|
||||
that = this;
|
||||
|
||||
_.each( that.options.termList || {}, function( term, key ) {
|
||||
var term_id = term[ 'term_id' ],
|
||||
term_name = $( '<div/>' ).html( term[ 'term_name' ] ).text();
|
||||
|
||||
filters[ term_id ] = {
|
||||
text: term_name,
|
||||
priority: key + 2
|
||||
};
|
||||
|
||||
filters[ term_id ][ 'props' ] = {};
|
||||
filters[ term_id ][ 'props' ][ that.options.taxonomy ] = term_id;
|
||||
} );
|
||||
|
||||
filters.all = {
|
||||
text: that.options.termListTitle,
|
||||
priority: 1
|
||||
};
|
||||
|
||||
filters[ 'all' ][ 'props' ] = {};
|
||||
filters[ 'all' ][ 'props' ][ that.options.taxonomy ] = null;
|
||||
|
||||
this.filters = filters;
|
||||
}
|
||||
} );
|
||||
|
||||
media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend( {
|
||||
createToolbar: function() {
|
||||
var that = this,
|
||||
i = 1,
|
||||
filters = that.options.filters;
|
||||
|
||||
curAttachmentsBrowser.prototype.createToolbar.apply( this, arguments );
|
||||
|
||||
$.each( us_media_categories_taxonomies, function( taxonomy, values ) {
|
||||
if ( values.term_list && filters ) {
|
||||
that.toolbar.set( taxonomy + '-filter', new media.view.AttachmentFilters.Taxonomy( {
|
||||
controller: that.controller,
|
||||
model: that.collection.props,
|
||||
priority: - 80 + 10 * i ++,
|
||||
taxonomy: taxonomy,
|
||||
termList: values.term_list,
|
||||
termListTitle: values.list_title,
|
||||
className: 'attachment-taxonomy-filters'
|
||||
} ).render() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
// Relocate the new dropdown
|
||||
// $( document ).ready( function() {
|
||||
// $( '.media-toolbar.wp-filter .delete-selected-button' ).before( $('.media-toolbar.wp-filter
|
||||
// .select-mode-toggle-button' ) ); } );
|
||||
|
||||
|
||||
$.extend( wp.Uploader.prototype, {
|
||||
success: function( file_attachment ) {
|
||||
var category = $( ".attachment-taxonomy-filters" ).val();
|
||||
var data = {
|
||||
action: 'us_ajax_set_category_on_upload',
|
||||
post_id: file_attachment.attributes.id,
|
||||
category: category,
|
||||
};
|
||||
|
||||
jQuery.post( ajaxurl, data, function( response ) {
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1,78 @@
|
||||
// TODO adjust to match code standards
|
||||
( function( $ ) {
|
||||
var USSidebar = function() {
|
||||
|
||||
this.widget = $( '.widget-liquid-right' );
|
||||
this.widgetsRight = $( '#widgets-right' );
|
||||
this.addWidgetAreaForm = $( '#us_add_widget_area' );
|
||||
|
||||
this.initForm();
|
||||
this.initCustomWidgets();
|
||||
this.bindEvents();
|
||||
|
||||
};
|
||||
|
||||
USSidebar.prototype = {
|
||||
|
||||
initForm: function() {
|
||||
this.widget.append( this.addWidgetAreaForm.html() );
|
||||
this.nonce = this.widget.find( 'input[name="us_delete_widget_area_nonce"]' ).val();
|
||||
this.confirmMessage = this.widget.find( '#us_confirm_widget_area_deletion' ).html();
|
||||
},
|
||||
|
||||
initCustomWidgets: function() {
|
||||
this.widgetsRight.find( '.sidebar-us-custom-area' ).append( '<span class="us-custom-area-delete"></span>' );
|
||||
},
|
||||
|
||||
bindEvents: function() {
|
||||
this.widget.on( 'click', '.us-custom-area-delete', $.proxy( this.deleteWidgetArea, this ) );
|
||||
},
|
||||
|
||||
|
||||
//delete the sidebar area with all widgets within, then re calculate the other sidebar ids and re save the order
|
||||
deleteWidgetArea: function( e ) {
|
||||
var deleteIt = confirm( this.confirmMessage );
|
||||
|
||||
if ( deleteIt == false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var widget = $( e.currentTarget ).parents( '.widgets-holder-wrap:eq(0)' ),
|
||||
title = widget.find( '.sidebar-name h3 , .sidebar-name h2' ),
|
||||
spinner = title.find( '.spinner' ),
|
||||
widgetName = $.trim( title.text() ),
|
||||
obj = this;
|
||||
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: window.ajaxurl,
|
||||
data: {
|
||||
action: 'us_delete_custom_widget_area',
|
||||
name: widgetName,
|
||||
_wpnonce: obj.nonce
|
||||
},
|
||||
|
||||
beforeSend: function() {
|
||||
spinner.addClass( 'activate_spinner' );
|
||||
},
|
||||
success: function( response ) {
|
||||
if ( response == 'success' ) {
|
||||
widget.slideUp( 200, function() {
|
||||
|
||||
$( '.widget-control-remove', widget ).trigger( 'click' ); //delete all widgets inside
|
||||
widget.remove();
|
||||
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$( function() {
|
||||
new USSidebar();
|
||||
} );
|
||||
|
||||
|
||||
} )( jQuery );
|
||||
Reference in new issue
Block a user