init blog
This commit is contained in:
1 parent
5acc46db8e
commit
843783ce9a
1820 files changed
+539344
No files matched your search
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
*mpanel JavaScript
|
||||
*https://www.bgbk.org
|
||||
*/
|
||||
(function( $, args ){
|
||||
|
||||
//切换分页
|
||||
$( document ).on( 'click', '.mpanel-menu li', function(){
|
||||
$( '.mpanel-menu li' ).removeClass( 'current' );
|
||||
$( this ).addClass( 'current' );
|
||||
$( '.mpanel-mian-panel .mpanel-page' ).hide();
|
||||
$( '.mpanel-mian-panel .mpanel-page' ).eq( $( this ).index() ).fadeIn();
|
||||
} );
|
||||
|
||||
//控制显示
|
||||
var panel_hide = new Array();
|
||||
|
||||
$.fn.checkbox_show = function( control ){
|
||||
if( !$( this ).attr( 'checked' ) ) panel_hide.push( control );
|
||||
$( this ).click(function(){
|
||||
$( this ).attr( 'checked' ) ? $( control ).slideDown( 200 ) : $( control ).slideUp( 200 );
|
||||
} );
|
||||
}
|
||||
|
||||
$.fn.checkbox_hide = function( control ){
|
||||
if( $( this ).attr( 'checked' ) ) panel_hide.push( control );
|
||||
$( this ).click(function(){
|
||||
$( this ).attr( 'checked' ) ? $( control ).slideUp( 200 ) : $( control ).slideDown( 200 );
|
||||
} );
|
||||
}
|
||||
|
||||
$.fn.radio_show = function( control ){
|
||||
if( !$( this ).attr( 'checked' ) ) panel_hide.push( control );
|
||||
$( this ).data( 'control-show', control );
|
||||
}
|
||||
|
||||
$.fn.radio_hide = function( control ){
|
||||
if( $( this ).attr( 'checked' ) ) panel_hide.push( control );
|
||||
$( this ).data( 'control-hide', control );
|
||||
}
|
||||
|
||||
$( document ).on( 'click', '.mpanel-radio-box input[type=radio]', function(){
|
||||
$( this ).parent( 'label' ).parent( '.mpanel-radio-box' ).find( 'input[type=radio]' ).each(function(){
|
||||
var show = $( this ).data( 'control-show' ),
|
||||
hide = $( this ).data( 'control-hide' );
|
||||
if( $( this ).attr( 'checked' ) ){
|
||||
if( show ) $( show ).slideDown( 200 );
|
||||
if( hide ) $( hide ).slideUp( 200 );
|
||||
}else{
|
||||
if( show ) $( show ).slideUp( 200 );
|
||||
if( hide ) $( hide ).slideDown( 200 );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
//自定义列表
|
||||
$( document ).on( 'click', '.mpanel-list-add', function(){
|
||||
var input = $( this ).prev( 'input' );
|
||||
value = $( '<div/>' ).text( input.val().replace( /(^\s*)|(\s*$)/g, '' ) ).html(),
|
||||
list = $( this ).next( 'ul.mpanel-list' );
|
||||
if( $( this ).data( 'repeat' ) ){
|
||||
var repeat_error = false;
|
||||
list.find( 'li .mpanel-list-li-name' ).each( function(){
|
||||
if( $( this ).text() === value ) repeat_error = true;
|
||||
} );
|
||||
if( repeat_error ){
|
||||
alert( args.list_repeat_error );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( value ){
|
||||
list.append( '<li><span class="mpanel-list-li-name">' + value + '</span><a href="javascript:;" class="mpanel-list-li-delete"></a></li>' );
|
||||
$( '<input type="hidden" name="mpanel[' + $( this ).data( 'list-name' ) + '][]" class="mpanel-list-hidden-content">' ).val( value ).prependTo( list.children( 'li:last' ) );
|
||||
input.val( '' );
|
||||
}
|
||||
} );
|
||||
$( document ).on( 'click', '.mpanel-list .mpanel-list-li-delete', function(){
|
||||
$( this ).parent().slideUp( 200, function(){
|
||||
$( this ).remove();
|
||||
} );
|
||||
} );
|
||||
|
||||
//提示框
|
||||
$( document ).on( 'mouseover', '.mpanel-help', function(){
|
||||
if( !this.title ) return;
|
||||
$( this ).data( 'tptitle', this.title );
|
||||
this.title = '';
|
||||
$( 'body' ).append( '<div id="mpanel-tooltip">' + $( this ).data( 'tptitle' ) + '</div>' );
|
||||
$( '#mpanel-tooltip' ).css({
|
||||
'left': $( this ).offset().left + $( this ).outerWidth( false ) / 2 - $( '#mpanel-tooltip' ).outerWidth( false ) / 2,
|
||||
'top': $( this ).offset().top - 8
|
||||
} );
|
||||
$( '#mpanel-tooltip' ).fadeIn();
|
||||
} );
|
||||
$( document ).on( 'mouseout', '.mpanel-help', function(){
|
||||
if( !$( this ).data( 'tptitle' ) ) return;
|
||||
$( '#mpanel-tooltip' ).remove();
|
||||
this.title = $( this ).data( 'tptitle' );
|
||||
} );
|
||||
|
||||
//Ajax 表单
|
||||
$( document ).on( 'submit', '#mpanel-form', function(){
|
||||
var load = $( '#mpanel-load' ),
|
||||
save = $( '.mpanel-save, .mpanel-save2' );
|
||||
if( $( '#mpanel-item-import' ).val() ) return true;
|
||||
save.attr( 'disabled', true );
|
||||
load.fadeIn( 200 );
|
||||
$.post( args.admin_ajax, $( '#mpanel-form' ).serialize() + '&action=mpanel-save', function( data ){
|
||||
if( data === '1' ){
|
||||
load.addClass( 'mpanel-done' );
|
||||
setTimeout( function(){
|
||||
load.fadeOut( 200 );
|
||||
save.attr( 'disabled', false );
|
||||
}, 1200 );
|
||||
setTimeout( function(){
|
||||
load.removeClass( 'mpanel-done' );
|
||||
}, 1400 );
|
||||
return false;
|
||||
}
|
||||
load.addClass( 'mpanel-error' );
|
||||
setTimeout( function(){
|
||||
load.fadeOut( 200 );
|
||||
save.attr( 'disabled', false );
|
||||
}, 1200 );
|
||||
setTimeout( function(){
|
||||
load.removeClass( 'mpanel-done' );
|
||||
}, 1400 );
|
||||
} );
|
||||
return false;
|
||||
} );
|
||||
|
||||
//文件上传
|
||||
$( document ).on( 'click', '.mpanel-upload-button', function(){
|
||||
var upload_frame,
|
||||
value = $( '#' + $( this ).data( 'value' ) ),
|
||||
top_parent = $( this ).parent( '.input-group-btn' ).parent( '.input-group' );
|
||||
if( upload_frame ){
|
||||
upload_frame.open();
|
||||
return;
|
||||
}
|
||||
upload_frame = wp.media( {
|
||||
title: 'Upload',
|
||||
button: {
|
||||
text: 'Upload',
|
||||
},
|
||||
multiple: false
|
||||
} );
|
||||
upload_frame.on( 'select', function(){
|
||||
attachment = upload_frame.state().get( 'selection' ).first().toJSON();
|
||||
var url = attachment.url,
|
||||
box = top_parent.next( '.upload-img-box' );
|
||||
box.length === 0 ? top_parent.after( '<div class="upload-img-box"><img src="' + url + '" /><span class="delete"></span></div>' ) : box.find( 'img' ).attr( 'src', url );
|
||||
value.val( url ).trigger( 'change' );
|
||||
} );
|
||||
upload_frame.open();
|
||||
} );
|
||||
|
||||
$( document ).on( 'click', '.upload-img-box .delete', function(){
|
||||
var box = $( this ).parent( '.upload-img-box' );
|
||||
$( '#' + box.prev( '.input-group' ).find( '.mpanel-upload-button' ).data( 'value' ) ).val( '' );
|
||||
box.fadeOut( 100, function(){
|
||||
$( this ).remove();
|
||||
} );
|
||||
} );
|
||||
|
||||
//Onload
|
||||
$(function(){
|
||||
|
||||
//复选框
|
||||
$( '.mpanel-checkbox' ).each(function(){
|
||||
new Switchery( this );
|
||||
} );
|
||||
|
||||
//隐藏开关控制的元素
|
||||
for( var i = 0; i < panel_hide.length; i++ ){
|
||||
$( panel_hide[i] ).hide();
|
||||
}
|
||||
|
||||
//设置默认分页
|
||||
$( '.mpanel-menu li:first' ).addClass( 'current' );
|
||||
$( '.mpanel-mian-panel .mpanel-page:not(:first)' ).hide();
|
||||
|
||||
//颜色选择器
|
||||
$( '.colorSelector' ).wpColorPicker();
|
||||
|
||||
//日期选择器
|
||||
$( 'input.mpanel-cxcalendar' ).each( function(){
|
||||
$( this ).cxCalendar();
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
})( jQuery, mpanel_base_args );
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
*cxCalendar
|
||||
*https://www.bgbk.org
|
||||
*/
|
||||
!function(a){a.fn.cxCalendar=function(b,c){var d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z;if(!(this.length<1)){for(d={},e=d.jqobj=this,f=d.fun={},b=a.extend({},a.cxCalendar.defaults,b,{beginyear:e.data("beginyear"),endyear:e.data("endyear"),type:e.data("type"),hyphen:e.data("hyphen"),wday:e.data("wday")}),c=a.extend({},a.cxCalendar.language,c),h=function(a){var b=a;return b=b.replace(/\./g,"/"),b=b.replace(/-/g,"/"),b=b.replace(/\//g,"/"),b=Date.parse(b)},i=function(a){return 0==a%4&&0!=a%100||0==a%400?1:0},e.val().length>0&&(b.date=h(e.val())),b.date=new Date(b.date),isNaN(b.date.getFullYear())&&(b.date=new Date),b.date.setHours(0),b.date.setMinutes(0),b.date.setSeconds(0),j=b.date.getFullYear(),k=b.date.getMonth()+1,b.date.getDate(),m=new Array(31,28+i(j),31,30,31,30,31,31,30,31,30,31),n=c.weekList,o=6-b.wday,p=7-b.wday>=7?0:7-b.wday,q=a("<div></div>",{"class":"cxcalendar"}),r=a("<div></div>",{"class":"date_hd"}).appendTo(q),t=a("<table></table>").appendTo(q),r.html("<a class='date_pre' href='javascript://' rel='pre'><</a><a class='date_next' href='javascript://' rel='next'>></a>"),w=a("<div></div>",{"class":"date_txt"}).appendTo(r),s=a("<div></div>",{"class":"date_set"}).appendTo(r),v="",z=b.beginyear;z<=b.endyear;z++)v+="<option value='"+z+"'>"+z+"</option>";for(x=a("<select></select>",{"class":"year_set"}).html(v).appendTo(s).val(j),s.append(" - "),v="",z=0;12>z;z++)v+="<option value='"+(z+1)+"'>"+c.monthList[z]+"</option>";for(y=a("<select></select>",{"class":"month_set"}).html(v).appendTo(s).val(k),v="<thead><tr>",z=0;7>z;z++)v+="<th class='",z==o?v+=" sat":z==p&&(v+=" sun"),v+="'>",v+=z+b.wday<7?n[z+b.wday]:n[z+b.wday-7],v+="</th>";return v+="</tr></thead>",v+="<tbody></tbody>",t.html(v),q.appendTo("body"),u=a("<div></div>",{"class":"cxcalendar_lock"}).appendTo("body"),f.show=function(){var a=document.body.clientWidth,b=document.body.clientHeight,d=q.outerWidth(),f=q.outerHeight(),g=e.offset().top,h=e.offset().left,i=e.outerWidth(),j=e.outerHeight();return g=g+f+j>b?g-f:g+j,h=h+d>a?h-(d-i):h,w.html("<span class='y'>"+x.val()+"</span>"+c.year+"<span class='m'>"+c.monthList[y.val()-1]+"</span>"+c.month),q.css({top:g,left:h}).show(),u.css({width:a,height:b}).show(),this},f.hide=function(){return q.hide(),u.hide(),s.hide(),w.show(),this},f.change=function(a,d){var f,g,j,k,l,n,q,r,s,u,z,A;for(1>d?(a--,d=12):d>12&&(a++,d=1),f=d,d--,a<b.beginyear?a=b.endyear:a>b.endyear&&(a=b.beginyear),m[1]=28+i(a),v="",g=new Date(a,d,1),j=new Date,j.setHours(0),j.setMinutes(0),j.setSeconds(0),k=new Date,k.setHours(0),k.setMinutes(0),k.setSeconds(0),k=h(e.val()),k=new Date(k),isNaN(k.getFullYear())&&(k=null),l=g.getDay()-b.wday<0?g.getDay()-b.wday+7:g.getDay()-b.wday,n=Math.ceil((m[d]+l)/7),z=0;n>z;z++){for(v+="<tr>",A=0;7>A;A++)q=7*z+A,r=q-l+1,r=0>=r||r>m[d]?"":q-l+1,v+="<td","number"==typeof r&&(s=null,u=null,g=new Date(a,d,r),s=Date.parse(j)-Date.parse(g),u=Date.parse(k)-Date.parse(g),v+=" title='"+a+b.hyphen+f+b.hyphen+r+"' class='num",0==u?v+=" selected":0==s?v+=" now":A==o?v+=" sat":A==p&&(v+=" sun"),v+="'"),v+=" data-day='"+r+"'>"+r+"</td>";v+="</tr>"}return t.find("tbody").html(v),w.html("<span class='y'>"+a+"</span>"+c.year+"<span class='m'>"+c.monthList[d]+"</span>"+c.month),x.val(a),y.val(d+1),this},f.selected=function(a){var c,d;return c=y.val(),d=a,"yyyy-mm-dd"==b.type&&(c="0"+y.val(),d="0"+a,c=c.substr(c.length-2,c.length),d=d.substr(d.length-2,d.length)),e.val(x.val()+b.hyphen+c+b.hyphen+d),e.trigger("change"),f.hide(),this},f.clear=function(){return e.val(""),f.change(j,k),f.hide(),this},f.getdate=function(){return e.val()},f.setdate=function(b,c,d){if("string"==typeof b)return f.setdate({date:b}),void 0;if("number"==typeof b&&"number"==typeof c&&"number"==typeof d)return f.setdate({year:b,month:c,day:d}),void 0;if("object"!=typeof b)return!1;b=a.extend({},{date:null,year:null,month:null,day:null,set:!0},b);var e;return"string"==typeof b.date&&(b.date=h(b.date),e=new Date(b.date),e.setHours(0),e.setMinutes(0),e.setSeconds(0),b.year=e.getFullYear(),b.month=e.getMonth()+1,b.day=e.getDate()),f.change(b.year,b.month),b.set&&f.selected(b.day),this},f.gotodate=function(a,b){return"string"==typeof a?f.setdate({date:a,set:!1}):"number"==typeof a&&"number"==typeof b&&f.setdate({year:a,month:b,day:1,set:!1}),this},q.delegate("a","click",function(){if(this.rel){var a=this.rel;switch(a){case"pre":return f.change(x.val(),parseInt(y.val(),10)-1),!1;case"next":return f.change(x.val(),parseInt(y.val(),10)+1),!1;case"clear":return f.clear(),!1}}}),t.delegate("td","click",function(){var b=a(this);b.hasClass("num")&&(t.find("td").removeClass("selected"),b.addClass("selected"),f.selected(b.data("day")))}),e.bind("click",f.show),u.bind("click",f.hide),w.bind("click",function(){w.hide(),s.show()}),x.bind("change",function(){f.change(x.val(),y.val())}),y.bind("change",function(){f.change(x.val(),y.val())}),f.change(j,k),g={jqobj:d.jqobj,show:f.show,hide:f.hide,getdate:f.getdate,setdate:f.setdate,gotodate:f.gotodate,clearLine truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
*Switchery
|
||||
*https://www.bgbk.org
|
||||
*/
|
||||
(function(){function require(path,parent,orig){var resolved=require.resolve(path);if(null==resolved){orig=orig||path;parent=parent||"root";var err=new Error('Failed to require "'+orig+'" from "'+parent+'"');err.path=orig;err.parent=parent;err.require=true;throw err}var module=require.modules[resolved];if(!module._resolving&&!module.exports){var mod={};mod.exports={};mod.client=mod.component=true;module._resolving=true;module.call(this,mod.exports,require.relative(resolved),mod);delete module._resolving;module.exports=mod.exports}return module.exports}require.modules={};require.aliases={};require.resolve=function(path){if(path.charAt(0)==="/")path=path.slice(1);var paths=[path,path+".js",path+".json",path+"/index.js",path+"/index.json"];for(var i=0;i<paths.length;i++){var path=paths[i];if(require.modules.hasOwnProperty(path))return path;if(require.aliases.hasOwnProperty(path))return require.aliases[path]}};require.normalize=function(curr,path){var segs=[];if("."!=path.charAt(0))return path;curr=curr.split("/");path=path.split("/");for(var i=0;i<path.length;++i){if(".."==path[i]){curr.pop()}else if("."!=path[i]&&""!=path[i]){segs.push(path[i])}}return curr.concat(segs).join("/")};require.register=function(path,definition){require.modules[path]=definition};require.alias=function(from,to){if(!require.modules.hasOwnProperty(from)){throw new Error('Failed to alias "'+from+'", it does not exist')}require.aliases[to]=from};require.relative=function(parent){var p=require.normalize(parent,"..");function lastIndexOf(arr,obj){var i=arr.length;while(i--){if(arr[i]===obj)return i}return-1}function localRequire(path){var resolved=localRequire.resolve(path);return require(resolved,parent,path)}localRequire.resolve=function(path){var c=path.charAt(0);if("/"==c)return path.slice(1);if("."==c)return require.normalize(p,path);var segs=parent.split("/");var i=lastIndexOf(segs,"deps")+1;if(!i)i=0;path=segs.slice(0,i+1).join("/")+"/deps/"+path;return path};localRequire.exists=function(path){return require.modules.hasOwnProperty(localRequire.resolve(path))};return localRequire};require.register("abpetkov-transitionize/transitionize.js",function(exports,require,module){module.exports=Transitionize;function Transitionize(element,props){if(!(this instanceof Transitionize))return new Transitionize(element,props);this.element=element;this.props=props||{};this.init()}Transitionize.prototype.isSafari=function(){return/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)};Transitionize.prototype.init=function(){var transitions=[];for(var key in this.props){transitions.push(key+" "+this.props[key])}this.element.style.transition=transitions.join(", ");if(this.isSafari())this.element.style.webkitTransition=transitions.join(", ")}});require.register("switchery/switchery.js",function(exports,require,module){var transitionize=require("transitionize");module.exports=Switchery;var defaults={color:"#64bd63",secondaryColor:"#dfdfdf",className:"switchery",disabled:false,disabledOpacity:.5,speed:"0.4s"};function Switchery(element,options){if(!(this instanceof Switchery))return new Switchery(element,options);this.element=element;this.options=options||{};for(var i in defaults){if(this.options[i]==null){this.options[i]=defaults[i]}}if(this.element.type=="checkbox")this.init()}Switchery.prototype.hide=function(){this.element.style.display="none"};Switchery.prototype.show=function(){var switcher=this.create();this.insertAfter(this.element,switcher)};Switchery.prototype.create=function(){this.switcher=document.createElement("span");this.jack=document.createElement("small");this.switcher.appendChild(this.jack);this.switcher.className=this.options.className;return this.switcher};Switchery.prototype.insertAfter=function(reference,target){reference.parentNode.insertBefore(target,reference.nextSibling)};Switchery.prototype.isChecked=function(){return this.element.checked};Switchery.prototype.isDisabled=function(){return this.options.disabled||this.element.disabled};Switchery.prototype.setPosition=function(clicked){var checked=this.isChecked(),switcher=this.switcher,jack=this.jack;if(clicked&&checked)checked=false;else if(clicked&&!checked)checked=true;if(checked===true){this.element.checked=true;if(window.getComputedStyle)jack.style.left=parseInt(window.getComputedStyle(switcher).width)-jack.offsetWidth+"px";else jack.style.left=parseInt(switcher.currentStyle["width"])-jack.offsetWidth+"px";if(this.options.color)this.colorize();this.setSpeed()}else{jack.style.left=0;this.element.checked=false;this.switcher.style.boxShadow="inset 0 0 0 0 "+this.options.secondaryColor;this.switcher.style.borderColor=this.options.secondaryColor;this.switcher.style.backgroundColor="";this.setSpeed()}};Switchery.prototype.setSpeed=function(){var switcherProp={},jackProp={left:this.options.speed.replace(/[a-z]/,"")/2+"s"};if(this.isChecked()){switcherProp={border:this.options.speed,"box-shadow":this.options.speed,"background-color":this.options.speed.replace(/[Line truncated
|
||||
Reference in new issue
Block a user