On Develop branch
Sorry about that
This commit is contained in:
95
themes/material/script0.js
Normal file
95
themes/material/script0.js
Normal file
@ -0,0 +1,95 @@
|
||||
$(function(){
|
||||
$( "#layout-top" ).click(function() {
|
||||
leftAddFullSize("top");
|
||||
});
|
||||
|
||||
$( "#layout-right" ).click(function() {
|
||||
leftAddSideSize("right");
|
||||
});
|
||||
|
||||
$( "#layout-bottom" ).click(function() {
|
||||
leftAddFullSize("bottom");
|
||||
});
|
||||
|
||||
$( "#layout-left" ).click(function() {
|
||||
leftAddSideSize("left");
|
||||
});
|
||||
|
||||
function leftAddSideSize(layout_type){
|
||||
$("#left-block").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--4-col mdl-cell--8-col-tablet mdl-cell--4-col-phone");
|
||||
|
||||
$(".left-blocks").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--12-col mdl-cell--4-col-tablet");
|
||||
|
||||
$("#main-block").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--8-col mdl-cell--8-col-tablet");
|
||||
|
||||
if(layout_type == "right"){
|
||||
$("#left-block").appendTo("#main-grid")
|
||||
} else {
|
||||
$("#left-block").prependTo("#main-grid")
|
||||
}
|
||||
$.cookie("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
zoom("width");
|
||||
}
|
||||
|
||||
function leftAddFullSize(layout_type){
|
||||
$("#left-block").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--12-col");
|
||||
|
||||
$(".left-blocks").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--4-col");
|
||||
|
||||
$("#main-block").removeClass (function (index, css) {
|
||||
return (css.match (/(^|\s)mdl-cell--\S+/g) || []).join(' ');
|
||||
}).addClass("mdl-cell--12-col");
|
||||
|
||||
if(layout_type == "bottom"){
|
||||
$("#left-block").appendTo("#main-grid")
|
||||
} else {
|
||||
$("#left-block").prependTo("#main-grid")
|
||||
}
|
||||
$.cookie("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
zoom("width");
|
||||
}
|
||||
current_layout = $.cookie("layout-type");
|
||||
if (current_layout != null) {
|
||||
if(current_layout =="top" || current_layout == "bottom"){
|
||||
leftAddFullSize(current_layout);
|
||||
} else {
|
||||
leftAddSideSize(current_layout);
|
||||
}
|
||||
}
|
||||
$('#main-block, #left-block').show();
|
||||
});
|
||||
|
||||
|
||||
function zoom(zoom_type) {
|
||||
var img = $('.shm-main-image');
|
||||
if(zoom_type == "full") {
|
||||
img.css('max-width', img.data('width') + 'px');
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom_type == "width") {
|
||||
img.css('max-width', ($( "#main-block" ).width()) + 'px');
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom_type == "height") {
|
||||
img.css('max-width', img.data('width') + 'px');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
if(zoom_type == "both") {
|
||||
img.css('max-width', '95%');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
|
||||
$(".shm-zoomer").val(zoom_type);
|
||||
|
||||
$.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
||||
}
|
Reference in New Issue
Block a user