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> <script>
$(document).ready(function() { $(document).ready(function() {
// Side menu script // Side menu script
;(function ( $, window, document, undefined ) { ;(function ( $, window, document, undefined ) {
var pluginName = "jqueryAccordionMenu"; var pluginName = "jqueryAccordionMenu";
var defaults = { var defaults = {
speed: 300, speed: 300,
showDelay: 0, showDelay: 0,
hideDelay: 0, hideDelay: 0,
singleOpen: true, singleOpen: true,
clickEffect: true clickEffect: true
}; };
function Plugin ( element, options ) { function Plugin ( element, options ) {
this.element = element; this.element = element;
this.settings = $.extend( {}, defaults, options ); this.settings = $.extend( {}, defaults, options );
this._defaults = defaults; this._defaults = defaults;
this._name = pluginName; this._name = pluginName;
this.init(); this.init();
}; };
$.extend(Plugin.prototype, { $.extend(Plugin.prototype, {
init: function () { init: function () {
this.openSubmenu(); this.openSubmenu();
this.submenuIndicators(); this.submenuIndicators();
if(this.settings.clickEffect){ if(this.settings.clickEffect){
this.addClickEffect(); 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') { if($(this).children(".submenu").length > 0) {
$('.side-menus-container').scrollTop(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");
if($(this).children(".submenu").length > 0) { $(this).addClass("activate");
if($(this).children(".submenu").css("display") == "none") { if(opts.singleOpen){
$(this).children(".submenu").delay(opts.showDelay).slideDown(opts.speed); $(this).siblings().children(".submenu").slideUp(opts.speed);
$(this).children(".submenu").siblings("a").addClass("submenu-indicator-minus"); $(this).siblings().children(".submenu").siblings("a").removeClass("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);
$(this).removeClass("activate"); $(this).removeClass("activate");
} }
if($(this).children(".submenu").siblings("a").hasClass("submenu-indicator-minus")){ return false;
$(this).children(".submenu").siblings("a").removeClass("submenu-indicator-minus"); } 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>");
} }
}, window.location.href = $(this).children("a").attr("href");
});
addClickEffect: function () { },
var ink, d, x, y;
$(this.element).find("a").bind("click touchstart", function(e){ submenuIndicators: function () {
$(".ink").remove(); 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>");
if($(this).children(".ink").length === 0){ }
$(this).prepend("<span class='ink'></span>"); },
}
addClickEffect: function () {
ink = $(this).find(".ink"); var ink, d, x, y;
ink.removeClass("animate-ink"); $(this.element).find("a").bind("click touchstart", function(e){
$(".ink").remove();
if(!ink.height() && !ink.width()){
d = Math.max($(this).outerWidth(), $(this).outerHeight()); if($(this).children(".ink").length === 0){
ink.css({height: d, width: d}); $(this).prepend("<span class='ink'></span>");
} }
x = e.pageX - $(this).offset().left - ink.width()/2; ink = $(this).find(".ink");
y = e.pageY - $(this).offset().top - ink.height()/2; ink.removeClass("animate-ink");
ink.css({top: y+'px', left: x+'px'}).addClass("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 ) { var sideNavMenus = $('.side-menus-container');
this.each(function() { sideNavMenus.jqueryAccordionMenu();
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
return this;
};
})( jQuery, window, document );
var sideNavMenus = $('.side-menus-container'); var sideNavMenusMobile = $('.docs-container .side-menus');
sideNavMenus.jqueryAccordionMenu(); $('.guide-menus-activator').click(function() {
if (sideNavMenusMobile.hasClass('show')) {
var sideNavMenusMobile = $('.docs-container .side-menus'); sideNavMenusMobile.removeClass('show');
$('.guide-menus-activator').click(function() { } else {
if (sideNavMenusMobile.hasClass('show')) { sideNavMenusMobile.addClass('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);
}
}
});
}); });
// 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> </script>
{{ end }} {{ end }}