Site Notice
hello, world
Difference between revisions of "MediaWiki:Js-blog.js"
From Project-EPB Commons
m |
|||
Line 55: | Line 55: | ||
/*! Zoomify - v0.2.4 - https://github.com/indrimuska/zoomify - (c) 2015 Indri Muska - MIT */ | /*! Zoomify - v0.2.4 - https://github.com/indrimuska/zoomify - (c) 2015 Indri Muska - MIT */ | ||
− | !function(a){Zoomify=function(b,c){var d=this;this._zooming=!1,this._zoomed=!1,this._timeout=null,this.$shadow=null,this.$image=a(b).addClass("zoomify"),this.options=a.extend({},Zoomify.DEFAULTS,this.$image.data(),c),this.$image.on("click",function(){d.zoom()}),a(window).on("resize",function(){d.reposition()}),a(document).on("scroll",function(){d.reposition()})},Zoomify.DEFAULTS={duration:200,easing:"linear",scale:.9},Zoomify.prototype.transition=function(a,b){a.css({"-webkit-transition":b,"-moz-transition":b,"-ms-transition":b,"-o-transition":b,transition:b})},Zoomify.prototype.addTransition=function(a){this.transition(a,"all "+this.options.duration+"ms "+this.options.easing)},Zoomify.prototype.removeTransition=function(b,c){var d=this;clearTimeout(this._timeout),this._timeout=setTimeout(function(){d.transition(b,""),a.isFunction(c)&&c.call(d)},this.options.duration)},Zoomify.prototype.transform=function(a){this.$image.css({"-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,"-o-transform":a,transform:a})},Zoomify.prototype.transformScaleAndTranslate=function(a,b,c,d){this.addTransition(this.$image),this.transform("scale("+a+") translate("+b+"px, "+c+"px)"),this.removeTransition(this.$image,d)},Zoomify.prototype.zoom=function(){this._zooming||(this._zoomed?this.zoomOut():this.zoomIn())},Zoomify.prototype.zoomIn=function(){var b=this,c=this.$image.css("transform");this.transition(this.$image,"none"),this.transform("none");var d=this.$image.offset(),e=this.$image.outerWidth(),f=this.$image.outerHeight(),g=this.$image[0].naturalWidth||+(1/0),h=this.$image[0].naturalHeight||+(1/0),i=a(window).width(),j=a(window).height(),k=Math.min(g,i*this.options.scale)/e,l=Math.min(h,j*this.options.scale)/f,m=Math.min(k,l),n=(-d.left+(i-e)/2)/m,o=(-d.top+(j-f)/2+a(document).scrollTop())/m;this.transform(c),this._zooming=!0,this.$image.addClass("zoomed").trigger("zoom-in.zoomify"),setTimeout(function(){b.addShadow(),b.transformScaleAndTranslate(m,n,o,function(){b._zooming=!1,b.$image.trigger("zoom-in-complete.zoomify")}),b._zoomed=!0})},Zoomify.prototype.zoomOut=function(){var a=this;this._zooming=!0,this.$image.trigger("zoom-out.zoomify"),this.transformScaleAndTranslate(1,0,0,function(){a._zooming=!1,a.$image.removeClass("zoomed").trigger("zoom-out-complete.zoomify")}),this.removeShadow(),this._zoomed=!1},Zoomify.prototype.reposition=function(){this._zoomed&&(this.transition(this.$image,"none"),this.zoomIn())},Zoomify.prototype.addShadow=function(){var b=this;this._zoomed||(b.$shadow&&b.$shadow.remove(),this.$shadow=a('<div class="zoomify-shadow"></div>'),a("body").append(this.$shadow),this.addTransition(this.$shadow),this.$shadow.on("click",function(){b.zoomOut()}),setTimeout(function(){b.$shadow.addClass("zoomed")},10))},Zoomify.prototype.removeShadow=function(){var a=this;this.$shadow&&(this.addTransition(this.$shadow),this.$shadow.removeClass("zoomed"),this.$image.one("zoom-out-complete.zoomify",function(){a.$shadow&&a.$shadow.remove(),a.$shadow=null}))},a.fn.zoomify=function(b){return this.each(function(){var c=a(this),d=c.data("zoomify");d||c.data("zoomify",d=new Zoomify(this,"object"==typeof b&&b)),"string"==typeof b&&["zoom","zoomIn","zoomOut","reposition"].indexOf(b)>=0&&d[b]()})}}(jQuery); | + | !function(a) { |
− | $('body:not(.wp-admin) .content-area img').zoomify(); | + | Zoomify = function(b, c) { |
+ | var d = this; | ||
+ | this._zooming = !1, | ||
+ | this._zoomed = !1, | ||
+ | this._timeout = null, | ||
+ | this.$shadow = null, | ||
+ | this.$image = a(b).addClass("zoomify"), | ||
+ | this.options = a.extend({}, | ||
+ | Zoomify.DEFAULTS, this.$image.data(), c), | ||
+ | this.$image.on("click", | ||
+ | function() { | ||
+ | d.zoom() | ||
+ | }), | ||
+ | a(window).on("resize", | ||
+ | function() { | ||
+ | d.reposition() | ||
+ | }), | ||
+ | a(document).on("scroll", | ||
+ | function() { | ||
+ | d.reposition() | ||
+ | }) | ||
+ | }, | ||
+ | Zoomify.DEFAULTS = { | ||
+ | duration: 200, | ||
+ | easing: "linear", | ||
+ | scale: .9 | ||
+ | }, | ||
+ | Zoomify.prototype.transition = function(a, b) { | ||
+ | a.css({ | ||
+ | "-webkit-transition": b, | ||
+ | "-moz-transition": b, | ||
+ | "-ms-transition": b, | ||
+ | "-o-transition": b, | ||
+ | transition: b | ||
+ | }) | ||
+ | }, | ||
+ | Zoomify.prototype.addTransition = function(a) { | ||
+ | this.transition(a, "all " + this.options.duration + "ms " + this.options.easing) | ||
+ | }, | ||
+ | Zoomify.prototype.removeTransition = function(b, c) { | ||
+ | var d = this; | ||
+ | clearTimeout(this._timeout), | ||
+ | this._timeout = setTimeout(function() { | ||
+ | d.transition(b, ""), | ||
+ | a.isFunction(c) && c.call(d) | ||
+ | }, | ||
+ | this.options.duration) | ||
+ | }, | ||
+ | Zoomify.prototype.transform = function(a) { | ||
+ | this.$image.css({ | ||
+ | "-webkit-transform": a, | ||
+ | "-moz-transform": a, | ||
+ | "-ms-transform": a, | ||
+ | "-o-transform": a, | ||
+ | transform: a | ||
+ | }) | ||
+ | }, | ||
+ | Zoomify.prototype.transformScaleAndTranslate = function(a, b, c, d) { | ||
+ | this.addTransition(this.$image), | ||
+ | this.transform("scale(" + a + ") translate(" + b + "px, " + c + "px)"), | ||
+ | this.removeTransition(this.$image, d) | ||
+ | }, | ||
+ | Zoomify.prototype.zoom = function() { | ||
+ | this._zooming || (this._zoomed ? this.zoomOut() : this.zoomIn()) | ||
+ | }, | ||
+ | Zoomify.prototype.zoomIn = function() { | ||
+ | var b = this, | ||
+ | c = this.$image.css("transform"); | ||
+ | this.transition(this.$image, "none"), | ||
+ | this.transform("none"); | ||
+ | var d = this.$image.offset(), | ||
+ | e = this.$image.outerWidth(), | ||
+ | f = this.$image.outerHeight(), | ||
+ | g = this.$image[0].naturalWidth || +(1 / 0), | ||
+ | h = this.$image[0].naturalHeight || +(1 / 0), | ||
+ | i = a(window).width(), | ||
+ | j = a(window).height(), | ||
+ | k = Math.min(g, i * this.options.scale) / e, | ||
+ | l = Math.min(h, j * this.options.scale) / f, | ||
+ | m = Math.min(k, l), | ||
+ | n = ( - d.left + (i - e) / 2) / m, | ||
+ | o = ( - d.top + (j - f) / 2 + a(document).scrollTop()) / m; | ||
+ | this.transform(c), | ||
+ | this._zooming = !0, | ||
+ | this.$image.addClass("zoomed").trigger("zoom-in.zoomify"), | ||
+ | setTimeout(function() { | ||
+ | b.addShadow(), | ||
+ | b.transformScaleAndTranslate(m, n, o, | ||
+ | function() { | ||
+ | b._zooming = !1, | ||
+ | b.$image.trigger("zoom-in-complete.zoomify") | ||
+ | }), | ||
+ | b._zoomed = !0 | ||
+ | }) | ||
+ | }, | ||
+ | Zoomify.prototype.zoomOut = function() { | ||
+ | var a = this; | ||
+ | this._zooming = !0, | ||
+ | this.$image.trigger("zoom-out.zoomify"), | ||
+ | this.transformScaleAndTranslate(1, 0, 0, | ||
+ | function() { | ||
+ | a._zooming = !1, | ||
+ | a.$image.removeClass("zoomed").trigger("zoom-out-complete.zoomify") | ||
+ | }), | ||
+ | this.removeShadow(), | ||
+ | this._zoomed = !1 | ||
+ | }, | ||
+ | Zoomify.prototype.reposition = function() { | ||
+ | this._zoomed && (this.transition(this.$image, "none"), this.zoomIn()) | ||
+ | }, | ||
+ | Zoomify.prototype.addShadow = function() { | ||
+ | var b = this; | ||
+ | this._zoomed || (b.$shadow && b.$shadow.remove(), this.$shadow = a('<div class="zoomify-shadow"></div>'), a("body").append(this.$shadow), this.addTransition(this.$shadow), this.$shadow.on("click", | ||
+ | function() { | ||
+ | b.zoomOut() | ||
+ | }), setTimeout(function() { | ||
+ | b.$shadow.addClass("zoomed") | ||
+ | }, | ||
+ | 10)) | ||
+ | }, | ||
+ | Zoomify.prototype.removeShadow = function() { | ||
+ | var a = this; | ||
+ | this.$shadow && (this.addTransition(this.$shadow), this.$shadow.removeClass("zoomed"), this.$image.one("zoom-out-complete.zoomify", | ||
+ | function() { | ||
+ | a.$shadow && a.$shadow.remove(), | ||
+ | a.$shadow = null | ||
+ | })) | ||
+ | }, | ||
+ | a.fn.zoomify = function(b) { | ||
+ | return this.each(function() { | ||
+ | var c = a(this), | ||
+ | d = c.data("zoomify"); | ||
+ | d || c.data("zoomify", d = new Zoomify(this, "object" == typeof b && b)), | ||
+ | "string" == typeof b && ["zoom", "zoomIn", "zoomOut", "reposition"].indexOf(b) >= 0 && d[b]() | ||
+ | }) | ||
+ | } | ||
+ | } (jQuery); | ||
+ | $('body:not(.wp-admin) .content-area img').zoomify().click(function(){$('.zoom-overlay').appendTo('.content-area')}); |
Revision as of 15:56, 7 September 2019
/**
*『Wjghj Project Static』
* This _JavaScript_ code is from https://common.wjghj.cn
* CC BY-NC-SA
* For Wjghj Wordpress https://blog.wjghj.cn
**/
$(function(){
$('[data-slug="hello-dolly"]').html(function(){
var $this = $(this);
$this.find('.plugin-title strong').text('Wjghj Blog');
$this.find('.plugin-description').html('Wjghj Project为其博客项目魔改的插件,启用此插件可以超越Wordpress的限制调用外部的css以及js资源等');
$this.find('.plugin-version-author-uri').html('版本代号: Noah | <a href="https://wjghj.cn/wiki/Project:关于">Wjghj Project</a> | <a href="https://blog.wjghj.cn/wp-content/plugins/wjghjblog.php">查看详情</a>');
});
});
/** 复制时版权声明 **/
$(window).on('copy',function(){
if ($('#wpadminbar').length == 0) {
toastr['warning']($('#sq-middle-footer .license-description').html(),'您刚刚复制了'+$('.sq-site-title a').text()+'上的内容!');
}
});
/** 自动神隐顶部条 **/
$(function(){
var lastScrollY = 0;
$(window).scroll(function() {
//变化量可自行修改,使其在指定高度内滚动时不隐藏
if (window.scrollY - lastScrollY > 0 && window.scrollY > 500) {
//往下滚动,隐藏导航栏
$('.sq-site-header').addClass('header-hide');
$('#toast-container').addClass('notify-hide');
} else if (window.scrollY - lastScrollY < 0) {
//往上滚动,显示导航栏(Safari会有BUG,尴尬)
$('.sq-site-header').removeClass('header-hide');
$('#toast-container').removeClass('notify-hide');
}
lastScrollY = window.scrollY;
});
$('.sq-site-header').attr({'style':'position:fixed !important'}).mouseover(function(){
$('.sq-site-header, #toast-container').addClass('header-is-hover');
}).mouseout(function(){
$('.sq-site-header, #toast-container').removeClass('header-is-hover');
});
});
/** 变更管理工具条的位置 **/
$(function(){
if ($('body.wp-admin').length == 0) {
$('#wpadminbar').prependTo('body:not(.post-php) [role="main"]').css({
'position':'inherit',
'top':'0px',
'margin':'8px 0'
});
}
});
/*! Zoomify - v0.2.4 - https://github.com/indrimuska/zoomify - (c) 2015 Indri Muska - MIT */
!function(a) {
Zoomify = function(b, c) {
var d = this;
this._zooming = !1,
this._zoomed = !1,
this._timeout = null,
this.$shadow = null,
this.$image = a(b).addClass("zoomify"),
this.options = a.extend({},
Zoomify.DEFAULTS, this.$image.data(), c),
this.$image.on("click",
function() {
d.zoom()
}),
a(window).on("resize",
function() {
d.reposition()
}),
a(document).on("scroll",
function() {
d.reposition()
})
},
Zoomify.DEFAULTS = {
duration: 200,
easing: "linear",
scale: .9
},
Zoomify.prototype.transition = function(a, b) {
a.css({
"-webkit-transition": b,
"-moz-transition": b,
"-ms-transition": b,
"-o-transition": b,
transition: b
})
},
Zoomify.prototype.addTransition = function(a) {
this.transition(a, "all " + this.options.duration + "ms " + this.options.easing)
},
Zoomify.prototype.removeTransition = function(b, c) {
var d = this;
clearTimeout(this._timeout),
this._timeout = setTimeout(function() {
d.transition(b, ""),
a.isFunction(c) && c.call(d)
},
this.options.duration)
},
Zoomify.prototype.transform = function(a) {
this.$image.css({
"-webkit-transform": a,
"-moz-transform": a,
"-ms-transform": a,
"-o-transform": a,
transform: a
})
},
Zoomify.prototype.transformScaleAndTranslate = function(a, b, c, d) {
this.addTransition(this.$image),
this.transform("scale(" + a + ") translate(" + b + "px, " + c + "px)"),
this.removeTransition(this.$image, d)
},
Zoomify.prototype.zoom = function() {
this._zooming || (this._zoomed ? this.zoomOut() : this.zoomIn())
},
Zoomify.prototype.zoomIn = function() {
var b = this,
c = this.$image.css("transform");
this.transition(this.$image, "none"),
this.transform("none");
var d = this.$image.offset(),
e = this.$image.outerWidth(),
f = this.$image.outerHeight(),
g = this.$image[0].naturalWidth || +(1 / 0),
h = this.$image[0].naturalHeight || +(1 / 0),
i = a(window).width(),
j = a(window).height(),
k = Math.min(g, i * this.options.scale) / e,
l = Math.min(h, j * this.options.scale) / f,
m = Math.min(k, l),
n = ( - d.left + (i - e) / 2) / m,
o = ( - d.top + (j - f) / 2 + a(document).scrollTop()) / m;
this.transform(c),
this._zooming = !0,
this.$image.addClass("zoomed").trigger("zoom-in.zoomify"),
setTimeout(function() {
b.addShadow(),
b.transformScaleAndTranslate(m, n, o,
function() {
b._zooming = !1,
b.$image.trigger("zoom-in-complete.zoomify")
}),
b._zoomed = !0
})
},
Zoomify.prototype.zoomOut = function() {
var a = this;
this._zooming = !0,
this.$image.trigger("zoom-out.zoomify"),
this.transformScaleAndTranslate(1, 0, 0,
function() {
a._zooming = !1,
a.$image.removeClass("zoomed").trigger("zoom-out-complete.zoomify")
}),
this.removeShadow(),
this._zoomed = !1
},
Zoomify.prototype.reposition = function() {
this._zoomed && (this.transition(this.$image, "none"), this.zoomIn())
},
Zoomify.prototype.addShadow = function() {
var b = this;
this._zoomed || (b.$shadow && b.$shadow.remove(), this.$shadow = a('<div class="zoomify-shadow"></div>'), a("body").append(this.$shadow), this.addTransition(this.$shadow), this.$shadow.on("click",
function() {
b.zoomOut()
}), setTimeout(function() {
b.$shadow.addClass("zoomed")
},
10))
},
Zoomify.prototype.removeShadow = function() {
var a = this;
this.$shadow && (this.addTransition(this.$shadow), this.$shadow.removeClass("zoomed"), this.$image.one("zoom-out-complete.zoomify",
function() {
a.$shadow && a.$shadow.remove(),
a.$shadow = null
}))
},
a.fn.zoomify = function(b) {
return this.each(function() {
var c = a(this),
d = c.data("zoomify");
d || c.data("zoomify", d = new Zoomify(this, "object" == typeof b && b)),
"string" == typeof b && ["zoom", "zoomIn", "zoomOut", "reposition"].indexOf(b) >= 0 && d[b]()
})
}
} (jQuery);
$('body:not(.wp-admin) .content-area img').zoomify().click(function(){$('.zoom-overlay').appendTo('.content-area')});