Fix QA v2

This commit is contained in:
Keyser H
2019-05-08 21:38:57 +09:00
parent 37d8445228
commit 7c6573a696
+134 -129
View File
@@ -143,146 +143,151 @@
<script>
$(document).ready(function() {
// Side menu script
;(function ( $, window, document, undefined ) {
var pluginName = "jqueryAccordionMenu";
var defaults = {
speed: 300,
showDelay: 0,
hideDelay: 0,
singleOpen: true,
clickEffect: true
};
$(document).ready(function() {
// Side menu script
;(function ( $, window, document, undefined ) {
var pluginName = "jqueryAccordionMenu";
var defaults = {
speed: 300,
showDelay: 0,
hideDelay: 0,
singleOpen: true,
clickEffect: true
};
function Plugin ( element, options ) {
this.element = element;
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
};
$.extend(Plugin.prototype, {
init: function () {
this.openSubmenu();
this.submenuIndicators();
if(this.settings.clickEffect){
this.addClickEffect();
function Plugin ( element, options ) {
this.element = element;
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
};
$.extend(Plugin.prototype, {
init: function () {
this.openSubmenu();
this.submenuIndicators();
if(this.settings.clickEffect){
this.addClickEffect();
}
},
openSubmenu: function () {
var opts = this.settings; //to differ from local variable "this"
$(this.element).children("ul").find("li").bind("click touchstart", function(e){
e.stopPropagation();
e.preventDefault();
if ($(this).attr('class') === 'back-to-the-top') {
$('.side-menus-container').scrollTop(0);
}
},
openSubmenu: function () {
var opts = this.settings; //to differ from local variable "this"
$(this.element).children("ul").find("li").bind("click touchstart", function(e){
e.stopPropagation();
e.preventDefault();
if ($(this).attr('class') === 'back-to-the-top') {
$('.side-menus-container').scrollTop(0);
}
if($(this).children(".submenu").length > 0) {
if($(this).children(".submenu").css("display") == "none") {
$(this).children(".submenu").delay(opts.showDelay).slideDown(opts.speed);
$(this).children(".submenu").siblings("a").addClass("submenu-indicator-minus");
$(this).addClass("activate");
if(opts.singleOpen){
$(this).siblings().children(".submenu").slideUp(opts.speed);
$(this).siblings().children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
$(this).removeClass("activate");
}
return false;
} else {
$(this).children(".submenu").delay(opts.hideDelay).slideUp(opts.speed);
if($(this).children(".submenu").length > 0) {
if($(this).children(".submenu").css("display") == "none") {
$(this).children(".submenu").delay(opts.showDelay).slideDown(opts.speed);
$(this).children(".submenu").siblings("a").addClass("submenu-indicator-minus");
$(this).addClass("activate");
if(opts.singleOpen){
$(this).siblings().children(".submenu").slideUp(opts.speed);
$(this).siblings().children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
$(this).removeClass("activate");
}
if($(this).children(".submenu").siblings("a").hasClass("submenu-indicator-minus")){
$(this).children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
}
return false;
} else {
$(this).children(".submenu").delay(opts.hideDelay).slideUp(opts.speed);
$(this).removeClass("activate");
}
if($(this).children(".submenu").siblings("a").hasClass("submenu-indicator-minus")){
$(this).children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
}
window.location.href = $(this).children("a").attr("href");
});
},
submenuIndicators: function () {
if($(this.element).find(".submenu").length > 0){
$(this.element).find(".submenu").siblings("a").append("<span class='submenu-indicator'><span class='object1'></span><span class='object2'></span><span class='object3'></span></span>");
}
},
addClickEffect: function () {
var ink, d, x, y;
$(this.element).find("a").bind("click touchstart", function(e){
$(".ink").remove();
if($(this).children(".ink").length === 0){
$(this).prepend("<span class='ink'></span>");
}
ink = $(this).find(".ink");
ink.removeClass("animate-ink");
if(!ink.height() && !ink.width()){
d = Math.max($(this).outerWidth(), $(this).outerHeight());
ink.css({height: d, width: d});
}
x = e.pageX - $(this).offset().left - ink.width()/2;
y = e.pageY - $(this).offset().top - ink.height()/2;
ink.css({top: y+'px', left: x+'px'}).addClass("animate-ink");
});
window.location.href = $(this).children("a").attr("href");
});
},
submenuIndicators: function () {
if($(this.element).find(".submenu").length > 0){
$(this.element).find(".submenu").siblings("a").append("<span class='submenu-indicator'><span class='object1'></span><span class='object2'></span><span class='object3'></span></span>");
}
},
addClickEffect: function () {
var ink, d, x, y;
$(this.element).find("a").bind("click touchstart", function(e){
$(".ink").remove();
if($(this).children(".ink").length === 0){
$(this).prepend("<span class='ink'></span>");
}
ink = $(this).find(".ink");
ink.removeClass("animate-ink");
if(!ink.height() && !ink.width()){
d = Math.max($(this).outerWidth(), $(this).outerHeight());
ink.css({height: d, width: d});
}
x = e.pageX - $(this).offset().left - ink.width()/2;
y = e.pageY - $(this).offset().top - ink.height()/2;
ink.css({top: y+'px', left: x+'px'}).addClass("animate-ink");
});
}
});
$.fn[ pluginName ] = function ( options ) {
this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
return this;
};
})( jQuery, window, document );
$.fn[ pluginName ] = function ( options ) {
this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
return this;
};
})( jQuery, window, document );
var sideNavMenus = $('.side-menus-container');
sideNavMenus.jqueryAccordionMenu();
var sideNavMenus = $('.side-menus-container');
sideNavMenus.jqueryAccordionMenu();
var sideNavMenusMobile = $('.docs-container .side-menus');
$('.guide-menus-activator').click(function() {
if (sideNavMenusMobile.hasClass('show')) {
sideNavMenusMobile.removeClass('show');
} else {
sideNavMenusMobile.addClass('show');
}
});
// anchor click control.
$("a[href*='#']").click(function(e) {
if (!$(this).attr('data-target')) {
var hash = $(this).attr('href').substring(1),
objt = $('#' + hash),
objt_mt = Number(objt.css('margin-top').replace(/[^0-9]/g,"")),
depth = 80,
scrn = $(window).width();
scrn_check = 1025;
if (scrn < scrn_check) {
depth = 120;
}
if (objt_mt > 0) {
depth = depth + objt_mt
}
if ($(this).attr('href').charAt(0) === '#') {
e.preventDefault();
$('html').scrollTop($($(this).attr('href')).offset().top - depth);
}
}
});
var sideNavMenusMobile = $('.docs-container .side-menus');
$('.guide-menus-activator').click(function() {
if (sideNavMenusMobile.hasClass('show')) {
sideNavMenusMobile.removeClass('show');
} else {
sideNavMenusMobile.addClass('show');
}
});
// anchor click control.
$("a[href*='#']").click(function(e) {
// e.preventDefault();
if ($(this).attr('data-target') === undefined && $(this).attr('href').length > 1) {
var hash = $(this).attr('href').substring(1),
objt = $('#' + hash),
objt_mt = Number(objt.css('margin-top').replace(/[^0-9]/g,"")),
depth = 80,
scrn = $(window).width();
scrn_check = 1025;
if (scrn < scrn_check) {
depth = 120;
}
if (objt_mt > 0) {
depth = depth + objt_mt
}
if ($(this).attr('href').charAt(0) === '#') {
var objectTop = $($(this).attr('href')).offset().top;
setTimeout(function() {
$('html').scrollTop(objectTop - depth);
}, 100);
}
}
});
});
</script>
{{ end }}