mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-18 12:57:24 +03:00
Clean up JS in the default page style
This commit is contained in:
parent
a72a602120
commit
506425a9e1
@ -16,14 +16,20 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.attachEvent('onload', mkwidth);
|
(function(window, document) {
|
||||||
window.attachEvent('onresize', mkwidth);
|
var mkwidth = function(){
|
||||||
|
|
||||||
function mkwidth(){
|
|
||||||
if(document.getElementById("wrap700")) {
|
if(document.getElementById("wrap700")) {
|
||||||
document.getElementById("wrap700").style.width = document.documentElement.clientWidth < 750 ? "750px" : "100%";
|
document.getElementById("wrap700").style.width = (document.documentElement.clientWidth < 750)
|
||||||
|
? "750px"
|
||||||
|
: "100%";
|
||||||
}
|
}
|
||||||
if(document.getElementById("wrap400")) {
|
if(document.getElementById("wrap400")) {
|
||||||
document.getElementById("wrap400").style.width = document.documentElement.clientWidth < 450 ? "450px" : "100%";
|
document.getElementById("wrap400").style.width = (document.documentElement.clientWidth < 450)
|
||||||
|
? "450px"
|
||||||
|
: "100%";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.attachEvent('onload', mkwidth);
|
||||||
|
window.attachEvent('onresize', mkwidth);
|
||||||
|
})(window, document);
|
||||||
|
@ -16,42 +16,44 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var popupStatus = 0;
|
(function($, document) {
|
||||||
|
var isPopupOpened = false;
|
||||||
|
|
||||||
function loadPopup(){
|
var loadPopup = function(){
|
||||||
if(popupStatus==0){
|
if(!isPopupOpened){
|
||||||
$("#background-popup").css({
|
$("#background-popup").css({
|
||||||
"opacity": "0.7"
|
"opacity": "0.7"
|
||||||
});
|
});
|
||||||
$("#background-popup").fadeIn("slow");
|
$("#background-popup").fadeIn("slow");
|
||||||
$("#dashboard-locales-popup").fadeIn("slow");
|
$("#dashboard-locales-popup").fadeIn("slow");
|
||||||
popupStatus = 1;
|
isPopupOpened = true;
|
||||||
}
|
|
||||||
}
|
|
||||||
function disablePopup(){
|
|
||||||
if(popupStatus==1){
|
|
||||||
$("#background-popup").fadeOut("slow");
|
|
||||||
$("#dashboard-locales-popup").fadeOut("slow");
|
|
||||||
popupStatus = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function normpos(a) {
|
var disablePopup = function(){
|
||||||
|
if(isPopupOpened){
|
||||||
|
$("#background-popup").fadeOut("slow");
|
||||||
|
$("#dashboard-locales-popup").fadeOut("slow");
|
||||||
|
isPopupOpened = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var normalizePosition = function(a) {
|
||||||
if(a < 10) {
|
if(a < 10) {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerPopup(){
|
var centerPopup = function(){
|
||||||
var windowWidth = document.documentElement.clientWidth;
|
var windowWidth = document.documentElement.clientWidth;
|
||||||
var windowHeight = document.documentElement.clientHeight;
|
var windowHeight = document.documentElement.clientHeight;
|
||||||
var popupHeight = $("#dashboard-locales-popup").height();
|
var popupHeight = $("#dashboard-locales-popup").height();
|
||||||
var popupWidth = $("#dashboard-locales-popup").width();
|
var popupWidth = $("#dashboard-locales-popup").width();
|
||||||
$("#dashboard-locales-popup").css({
|
$("#dashboard-locales-popup").css({
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"top": normpos((windowHeight-popupHeight) * 0.2),
|
"top": normalizePosition((windowHeight-popupHeight) * 0.2),
|
||||||
"left": normpos(windowWidth/2-popupWidth/2)
|
"left": normalizePosition(windowWidth/2-popupWidth/2)
|
||||||
});
|
});
|
||||||
$("#background-popup").css({
|
$("#background-popup").css({
|
||||||
"height": windowHeight
|
"height": windowHeight
|
||||||
@ -72,8 +74,9 @@ $(function(){
|
|||||||
disablePopup();
|
disablePopup();
|
||||||
});
|
});
|
||||||
$(document).keypress(function(e){
|
$(document).keypress(function(e){
|
||||||
if(e.keyCode==27 && popupStatus==1){
|
if(e.keyCode == 27 && isPopupOpened){
|
||||||
disablePopup();
|
disablePopup();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
})(jQuery, document);
|
||||||
|
Loading…
Reference in New Issue
Block a user