add files
This commit is contained in:
7
assets/js/admin/app.js
Normal file
7
assets/js/admin/app.js
Normal file
@@ -0,0 +1,7 @@
|
||||
jQuery(document).ready(function(){
|
||||
jQuery(function() {
|
||||
if (jQuery('.color-picker').length !== 0){
|
||||
jQuery('.color-picker').wpColorPicker();
|
||||
}
|
||||
});
|
||||
});
|
||||
28
assets/js/admin/editphp-inline-edit-tax-radio-hack.js
Normal file
28
assets/js/admin/editphp-inline-edit-tax-radio-hack.js
Normal file
@@ -0,0 +1,28 @@
|
||||
jQuery(document).ready(function($) {
|
||||
var taxonomy = 'category',
|
||||
post_id = null,
|
||||
term_id = null,
|
||||
li_ele_id = null;
|
||||
$('.editinline').on('click', function() {
|
||||
post_id = inlineEditPost.getId(this);
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
'action': 'wpse_139269_inline_edit_radio_checked_hack',
|
||||
'ajax-taxonomy': taxonomy,
|
||||
'ajax-post-id': post_id
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
term_id = response;
|
||||
li_ele_id = 'in-' + taxonomy + '-' + term_id;
|
||||
$( 'input[id="'+li_ele_id+'"]' ).attr( 'checked', 'checked' );
|
||||
},
|
||||
error: function (response){
|
||||
//console.log(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
1
assets/js/admin/select2.js
Normal file
1
assets/js/admin/select2.js
Normal file
File diff suppressed because one or more lines are too long
49
assets/js/admin/tinymce.plugin.charcount.js
Normal file
49
assets/js/admin/tinymce.plugin.charcount.js
Normal file
@@ -0,0 +1,49 @@
|
||||
tinymce.PluginManager.add('charactercount', function (editor) {
|
||||
|
||||
var _self = this;
|
||||
|
||||
function update() {
|
||||
editor.theme.panel.find('#charactercount').text('Количество символов: '+ _self.getCount() + '(с пробелами) | ' + _self.getCountWithoutSpaces() + '(без пробелов)' );
|
||||
}
|
||||
|
||||
editor.on('init', function () {
|
||||
var statusbar = editor.theme.panel && editor.theme.panel.find('#statusbar')[0];
|
||||
|
||||
if (statusbar) {
|
||||
window.setTimeout(function () {
|
||||
statusbar.insert({
|
||||
type: 'label',
|
||||
name: 'charactercount',
|
||||
text: 'Количество символов: '+ _self.getCount() + '(с пробелами) | ' + _self.getCountWithoutSpaces() + '(без пробелов)',
|
||||
classes: 'charactercount',
|
||||
disabled: editor.settings.readonly
|
||||
}, 0);
|
||||
|
||||
editor.on('setcontent beforeaddundo keyup', update);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
_self.getCount = function () {
|
||||
var tx = editor.getContent({ format: 'raw' });
|
||||
var decoded = decodeHtml(tx);
|
||||
var decodedStripped = decoded.replace(/(<([^>]+)>)/ig, '');
|
||||
var tc = decodedStripped.length;
|
||||
return tc;
|
||||
};
|
||||
_self.getCountWithoutSpaces = function () {
|
||||
var tx = editor.getContent({ format: 'raw' });
|
||||
var decoded = decodeHtml(tx);
|
||||
var decodedStripped = decoded.replace(/(<([^>]+)>)/ig, '');
|
||||
var tc = decodedStripped.replace(/(?:\r\n|\r|\n)/g, '').replace('/ /g', '').split(' ').join('').replace(/\s\s+/g, '');
|
||||
console.log(tc);
|
||||
return tc.length;
|
||||
};
|
||||
|
||||
|
||||
function decodeHtml(html) {
|
||||
var txt = document.createElement('textarea');
|
||||
txt.innerHTML = html;
|
||||
return txt.value;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user