This commit is contained in:
rulingcom 2022-10-20 10:45:23 +08:00
parent be17e78244
commit 6fa6085c3e
10 changed files with 201 additions and 217 deletions

View File

@ -25,8 +25,7 @@
if ( $('.header-banner').length != 0) { if ( $('.header-banner').length != 0) {
$('.layout-header').css('height', ''); $('.layout-header').css('height', '');
var scrollTop = $(window).scrollTop(); var scrollTop = $(window).scrollTop();
var scrollBottom = $('html').height() - $(window).height() - $('.kenjohn').height(); if (scrollTop>5) { /* 要滑動到選單的距離 */
if (scrollTop>5 && scrollBottom>0) { /* 要滑動到選單的距離 */
if (parseInt($('.layout-content').css('margin-top'))==0 && $('.layout-content.topcontent').length != 0 && $('.layout-content.topcontent').offset().top<400){ if (parseInt($('.layout-content').css('margin-top'))==0 && $('.layout-content.topcontent').length != 0 && $('.layout-content.topcontent').offset().top<400){
$('.layout-content').css('margin-top',$('.kenjohn').height()-$('#orbit-bar').height()); $('.layout-content').css('margin-top',$('.kenjohn').height()-$('#orbit-bar').height());
} }

View File

@ -70,9 +70,8 @@
.w-ba-banner .button-mid{ .w-ba-banner .button-mid{
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 0;
top: 0; top: 50%;
left: 0;
} }
.next-button,.prev-button{ .next-button,.prev-button{
cursor: pointer; cursor: pointer;

View File

@ -171,193 +171,198 @@
$("*[data-yt-binded=0]").each(function(){ $("*[data-yt-binded=0]").each(function(){
init_yt_banner(this); init_yt_banner(this);
}) })
if (typeof onYouTubeIframeAPIReady !== 'function'){ if (typeof onYouTubeIframeAPIReady !== 'function'){
$(document).ready(function() { $(document).ready(function() {
$(document).on('touchstart click mousedown',".jarallax-video-audio",function(){ $(document).on('touchstart click mousedown',".jarallax-video-audio",function(){
$(this).trigger('click'); $(this).trigger('click');
});
}); });
}); if(window.yt_players == undefined)
if(window.yt_players == undefined) window.yt_players = {};
window.yt_players = {}; function find_out_yt_event_list_key(yt_player){
function find_out_yt_event_list_key(yt_player){ var defalt_key = 'o';
var defalt_key = 'o'; var all_keys = Object.keys(yt_player).filter(function(s){return s.length == 1});
var all_keys = Object.keys(yt_player).filter(function(s){return s.length == 1}); var prop_nums_thresh = 6;
var prop_nums_thresh = 6; if(all_keys.indexOf(defalt_key) != -1){
if(all_keys.indexOf(defalt_key) != -1){ if((yt_player[defalt_key] instanceof Object) && Object.keys(yt_player[defalt_key]).length > prop_nums_thresh){
if((yt_player[defalt_key] instanceof Object) && Object.keys(yt_player[defalt_key]).length > prop_nums_thresh){
return defalt_key;
}
}
var event_key;
all_keys.forEach(function(k){
if((yt_player[k] instanceof Object) && Object.keys(yt_player[k]).length > prop_nums_thresh){
event_key = k;
return false;
}
})
return event_key;
}
function find_out_yt_event_list_count_key(yt_player, event_list_key){
var defalt_key = 'v';
var all_keys = Object.keys(yt_player).filter(function(s){return s.length == 1});
var equal_count = yt_player[event_list_key].length;
if(all_keys.indexOf(defalt_key) != -1){
if(yt_player[defalt_key] == equal_count){
return defalt_key;
}
}
var count_key;
all_keys.forEach(function(k){
if(yt_player[k] == equal_count){
count_key = k;
return false;
}
})
return count_key;
}
function find_out_yt_event_list_array_key(event_dict){
var defalt_key = 'i';
var all_keys = Object.keys(event_dict);
if(all_keys.indexOf(defalt_key) != -1){
var tmp = event_dict[defalt_key];
if(Array.isArray(tmp) && tmp.indexOf('onStateChange') != -1){
return defalt_key;
}
}
var array_key;
all_keys.forEach(function(k){
var tmp = event_dict[k];
if(Array.isArray(tmp) && tmp.indexOf('onStateChange') != -1){
array_key = k;
return false;
}
})
return array_key;
}
function find_out_yt_event_relation_key(event_dict, is_obj){ // is_obj = true => store event idx array. false => store whether event init(true or false)
var defalt_key = 'j';
var all_keys = Object.keys(event_dict);
if(all_keys.indexOf(defalt_key) != -1){
var tmp = event_dict[defalt_key];
if((tmp instanceof Object) && tmp['onStateChange']){
if(!is_obj || (tmp['onStateChange'] instanceof Object)){
return defalt_key; return defalt_key;
} }
} }
} var event_key;
var relation_key; all_keys.forEach(function(k){
all_keys.forEach(function(k){ if((yt_player[k] instanceof Object) && Object.keys(yt_player[k]).length > prop_nums_thresh){
var tmp = event_dict[k]; event_key = k;
if((tmp instanceof Object) && tmp['onStateChange']){
if(!is_obj || (tmp['onStateChange'] instanceof Object)){
relation_key = k;
return false; return false;
} }
}
})
return relation_key;
}
function onYouTubeIframeAPIReady(){
$(".w-ba-banner").on('cycle-post-initialize', function(){
init_banner(this);
});
function init_banner(banner){
var $banner = $(banner);
$banner.find('.w-ad-banner__slide').each(function(j, banner__slide){
init_yt_banner(banner__slide);
}) })
var iframes = $banner.find("iframe"); return event_key;
if(iframes.length > 0){ }
var id = $banner.attr("data-subpart-id"); function find_out_yt_event_list_count_key(yt_player, event_list_key){
if(yt_players[id] == undefined) var defalt_key = 'v';
yt_players[id] = {}; var all_keys = Object.keys(yt_player).filter(function(s){return s.length == 1});
var remove_ids = []; var equal_count = yt_player[event_list_key].length;
Object.keys(yt_players[id]).forEach(function(k){ if(all_keys.indexOf(defalt_key) != -1){
var yt_player = yt_players[id][k]; if(yt_player[defalt_key] == equal_count){
if($(yt_player.getIframe()).length == 0){ return defalt_key;
yt_player.destroy(); }
remove_ids.push(k);
}
})
remove_ids.forEach(function(k){
delete yt_players[id][k];
})
iframes.each(function(i,iframe){
var yt_id = $(iframe).attr("id");
var yt_player = yt_players[id][$(iframe).attr("id")];
if(yt_player){
}else{
yt_player = new YT.Player($(iframe).attr("id"), {
events: {
'onReady': function(event){
var yt_player = event.target;
var height = $(yt_player.getIframe()).height();
var banner_wrap = $(iframe).parents('.w-ba-banner__wrap').eq(0);
var carousel_wrap = banner_wrap.find(".cycle-carousel-wrap");
if(carousel_wrap.length){
carousel_wrap.css("top","3em");
height += parseInt(carousel_wrap.css('font-size')) * 3;
}
banner_wrap.height(height).css({"padding-bottom":"","padding-top":""});
var init_key = find_out_yt_event_relation_key(yt_player, false);
if(init_key){
delete yt_player[init_key].onStateChange;
}
else{
console.log("{onReady: true, onStateChange: true} missing!");
}
var event_list_key = find_out_yt_event_list_key(yt_player);
if(event_list_key){
var event_dict = yt_player[event_list_key];
var array_key = find_out_yt_event_list_array_key(event_dict);
var count_key = find_out_yt_event_list_count_key(event_dict, array_key);
var relation_key = find_out_yt_event_relation_key(event_dict, true);
var onStateChange_idx = event_dict[relation_key].onStateChange;
onStateChange_idx.reverse();
var event_size = 3;
onStateChange_idx.forEach(function(start_idx){
event_dict[array_key].splice(start_idx,event_size);
});
event_dict[relation_key].onStateChange = [];
event_dict[count_key] = event_dict[array_key].length;
yt_player.addEventListener('onStateChange',onPlayerStateChange);
banner_wrap.trigger('resize');
}else{
console.log("YT player changes its variables!")
}
{{extra_ready_script}}
},
'onStateChange': onPlayerStateChange
}
});
yt_players[id][$(iframe).attr("id")] = yt_player;
$(iframe).data("yt_player",yt_player);
}
})
} }
var count_key;
all_keys.forEach(function(k){
if(yt_player[k] == equal_count){
count_key = k;
return false;
}
})
return count_key;
} }
$(".w-ba-banner").each(function(i,banner){ function find_out_yt_event_list_array_key(event_dict){
init_banner(banner); var defalt_key = 'i';
}) var all_keys = Object.keys(event_dict);
} if(all_keys.indexOf(defalt_key) != -1){
function onPlayerStateChange(event){ var tmp = event_dict[defalt_key];
var iframe = $(event.target.getIframe()), if(Array.isArray(tmp) && tmp.indexOf('onStateChange') != -1){
cyclediv = iframe.parents("div.cycle-slideshow"); return defalt_key;
var widget = cyclediv.parents('.ba-banner-widget-youtube'); }
if(event.data == YT.PlayerState.PLAYING || event.data == YT.PlayerState.BUFFERING){ }
cyclediv[0].need_resume = !(cyclediv.hasClass("cycle-paused")); var array_key;
cyclediv.cycle("pause"); all_keys.forEach(function(k){
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay,.banner-overlay').css('visibility','hidden') var tmp = event_dict[k];
ad_audio_button(iframe.parents(".w-ad-banner__slide").eq(0),false); if(Array.isArray(tmp) && tmp.indexOf('onStateChange') != -1){
}else if(event.data == YT.PlayerState.UNSTARTED || event.data == YT.PlayerState.PAUSED || event.data == YT.PlayerState.ENDED){ array_key = k;
if(cyclediv[0].need_resume) return false;
cyclediv.cycle("resume"); }
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay,.banner-overlay').css('visibility','') })
ad_audio_button(iframe.parents(".w-ad-banner__slide").eq(0),true); return array_key;
}
function find_out_yt_event_relation_key(event_dict, is_obj){ // is_obj = true => store event idx array. false => store whether event init(true or false)
var defalt_key = 'j';
var all_keys = Object.keys(event_dict);
if(all_keys.indexOf(defalt_key) != -1){
var tmp = event_dict[defalt_key];
if((tmp instanceof Object) && tmp['onStateChange']){
if(!is_obj || (tmp['onStateChange'] instanceof Object)){
return defalt_key;
}
}
}
var relation_key;
all_keys.forEach(function(k){
var tmp = event_dict[k];
if((tmp instanceof Object) && tmp['onStateChange']){
if(!is_obj || (tmp['onStateChange'] instanceof Object)){
relation_key = k;
return false;
}
}
})
return relation_key;
}
function onYouTubeIframeAPIReady(){
$(".w-ba-banner").on('cycle-post-initialize', function(){
init_banner(this);
});
function init_banner(banner){
var $banner = $(banner);
$banner.find('.w-ad-banner__slide').each(function(j, banner__slide){
init_yt_banner(banner__slide);
})
var iframes = $banner.find("iframe");
if(iframes.length > 0){
var id = $banner.attr("data-subpart-id");
if(yt_players[id] == undefined)
yt_players[id] = {};
var remove_ids = [];
Object.keys(yt_players[id]).forEach(function(k){
var yt_player = yt_players[id][k];
if($(yt_player.getIframe()).length == 0){
yt_player.destroy();
remove_ids.push(k);
}
})
remove_ids.forEach(function(k){
delete yt_players[id][k];
})
iframes.each(function(i,iframe){
var $iframe = $(iframe);
var yt_id = $iframe.attr("id");
var yt_player = yt_players[id][yt_id];
if(yt_player){
}else{
yt_player = new YT.Player(yt_id, {
events: {
'onReady': function(event){
var yt_player = event.target;
var height = $(yt_player.getIframe()).height();
var banner_wrap = $iframe.parents('.w-ba-banner__wrap').eq(0);
var carousel_wrap = banner_wrap.find(".cycle-carousel-wrap");
if(carousel_wrap.length){
carousel_wrap.css("top","3em");
height += parseInt(carousel_wrap.css('font-size')) * 3;
}
var overlay_in_slide = $iframe.parent().siblings('.ad-overlay,.banner-overlay');
if(overlay_in_slide.length != 0){
height += overlay_in_slide.outerHeight(true);
}
banner_wrap.height(height).css({"padding-bottom":"","padding-top":""});
var init_key = find_out_yt_event_relation_key(yt_player, false);
if(init_key){
delete yt_player[init_key].onStateChange;
}
else{
console.log("{onReady: true, onStateChange: true} missing!");
}
var event_list_key = find_out_yt_event_list_key(yt_player);
if(event_list_key){
var event_dict = yt_player[event_list_key];
var array_key = find_out_yt_event_list_array_key(event_dict);
var count_key = find_out_yt_event_list_count_key(event_dict, array_key);
var relation_key = find_out_yt_event_relation_key(event_dict, true);
var onStateChange_idx = event_dict[relation_key].onStateChange;
onStateChange_idx.reverse();
var event_size = 3;
onStateChange_idx.forEach(function(start_idx){
event_dict[array_key].splice(start_idx,event_size);
});
event_dict[relation_key].onStateChange = [];
event_dict[count_key] = event_dict[array_key].length;
yt_player.addEventListener('onStateChange',onPlayerStateChange);
banner_wrap.trigger('resize');
}else{
console.log("YT player changes its variables!")
}
{{extra_ready_script}}
},
'onStateChange': onPlayerStateChange
}
});
yt_players[id][yt_id] = yt_player;
$iframe.data("yt_player",yt_player);
}
})
}
}
$(".w-ba-banner").each(function(i,banner){
init_banner(banner);
})
}
function onPlayerStateChange(event){
var iframe = $(event.target.getIframe()),
cyclediv = iframe.parents("div.cycle-slideshow");
var widget = cyclediv.parents('.ba-banner-widget-youtube');
if(event.data == YT.PlayerState.PLAYING || event.data == YT.PlayerState.BUFFERING){
cyclediv[0].need_resume = !(cyclediv.hasClass("cycle-paused"));
cyclediv.cycle("pause");
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay,.banner-overlay').css('visibility','hidden')
ad_audio_button(iframe.parents(".w-ad-banner__slide").eq(0),false);
}else if(event.data == YT.PlayerState.UNSTARTED || event.data == YT.PlayerState.PAUSED || event.data == YT.PlayerState.ENDED){
if(cyclediv[0].need_resume)
cyclediv.cycle("resume");
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay,.banner-overlay').css('visibility','')
ad_audio_button(iframe.parents(".w-ad-banner__slide").eq(0),true);
}
{{extra_state_chnage_script}}
} }
{{extra_state_chnage_script}}
} }
}
$(document).ready(function(){ $(document).ready(function(){
window.onYouTubePlayerAPIReady = function() { window.onYouTubePlayerAPIReady = function() {
onYouTubeIframeAPIReady.apply(this,arguments); onYouTubeIframeAPIReady.apply(this,arguments);
@ -401,18 +406,6 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){ $('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev"); $(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
}) })
var resize_timeout_id;
$(window).resize(function(){
if(resize_timeout_id){
window.clearTimeout(resize_timeout_id);
}
resize_timeout_id = window.setTimeout(function(){
var banner_wrap = $(".w-ba-banner__wrap[data-overlay=\".w-ad-banner__overlay_{{subpart-id}}\"]");
var opts = banner_wrap.data('cycle.opts');
var height = opts.slides.filter('.active').height() || opts.slides.height();
banner_wrap.height(height).css("padding-bottom","");
},300);
})
}) })
</script> </script>
<style type="text/css"> <style type="text/css">
@ -461,13 +454,6 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
.w-ba-banner .controlplay{ .w-ba-banner .controlplay{
width: auto; width: auto;
} }
.w-ba-banner .button-mid{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.next-button,.prev-button{ .next-button,.prev-button{
cursor: pointer; cursor: pointer;
} }

View File

@ -10,7 +10,7 @@
flex-wrap: wrap; flex-wrap: wrap;
display: flex; display: flex;
width: 100%; width: 100%;
align-items: center; align-items: flex-start;
} }
.ask-question .controls > *{ .ask-question .controls > *{
display: block; display: block;
@ -28,7 +28,7 @@
.ask-question .form-horizontal .control-group .controls{ .ask-question .form-horizontal .control-group .controls{
margin: 0; margin: 0;
display: inline-flex; display: inline-flex;
align-items: center; align-items: flex-start;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
min-width: 10em; min-width: 10em;
@ -36,7 +36,7 @@
padding-left: 0; padding-left: 0;
width: 100%; width: 100%;
padding: 0.5em; padding: 0.5em;
justify-content: center; justify-content: flex-start;
} }
.ask-question .form-horizontal input[type="text"],.ask-question .form-horizontal select{ .ask-question .form-horizontal input[type="text"],.ask-question .form-horizontal select{
width: 97%; width: 97%;
@ -46,6 +46,9 @@
padding: 1em 0 0 0; padding: 1em 0 0 0;
text-align: center; text-align: center;
} }
.ask-question .controls > input[type="radio"]:not(:first-child) {
margin-left: 0.5em;
}
</style> </style>
<link href="/assets/custom_field.css" media="screen" rel="stylesheet"> <link href="/assets/custom_field.css" media="screen" rel="stylesheet">
<script src="/assets/validator"></script> <script src="/assets/validator"></script>

View File

@ -2,7 +2,7 @@
<h3 class="widget-title"> <h3 class="widget-title">
<span>{{widget-title}}</span> <span>{{widget-title}}</span>
</h3> </h3>
<link rel="stylesheet" type="text/css" href="/assets/gallery_card.css"> <% OrbitHelper.render_css_in_head(["gallery_card.css"]) %>
<div class="row widget-content" data-level="0" data-list="images"> <div class="row widget-content" data-level="0" data-list="images">
<div class="card card-flip h-100"> <div class="card card-flip h-100">
<div class="card-front"> <div class="card-front">

View File

@ -41,9 +41,8 @@
.widget-link.widget-4 .button-mid{ .widget-link.widget-4 .button-mid{
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 0;
top: 0; top: 50%;
left: 0;
} }
.widget-link.widget-4 .button-mid .fa{ .widget-link.widget-4 .button-mid .fa{
cursor: pointer; cursor: pointer;

View File

@ -42,9 +42,8 @@
.widget-link.widget-5 .button-mid{ .widget-link.widget-5 .button-mid{
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 0;
top: 0; top: 50%;
left: 0;
} }
.widget-link.widget-5 .button-mid .fa{ .widget-link.widget-5 .button-mid .fa{
cursor: pointer; cursor: pointer;

View File

@ -43,9 +43,8 @@
.widget-link.widget-6 .button-mid{ .widget-link.widget-6 .button-mid{
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 0;
top: 0; top: 50%;
left: 0;
} }
.widget-link.widget-6 .button-mid .fa{ .widget-link.widget-6 .button-mid .fa{
cursor: pointer; cursor: pointer;

View File

@ -5,10 +5,10 @@
<ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0"> <ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0">
<li class="sitemenu-item level-1 {{active_class}}"> <li class="sitemenu-item level-1 {{active_class}}">
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a>
<ul class="sitemenu-list level-2" data-list="children" data-level="1"> <ul class="sitemenu-list level-2 {{dropdown}}" data-list="children" data-level="1">
<li class="sitemenu-item level-2" style="position: relative;"> <li class="sitemenu-item level-2" style="position: relative;">
<a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a>
<ul class="sitemenu-list level-2" data-list="children" data-level="2"> <ul class="sitemenu-list level-2 {{dropdown}}" data-list="children" data-level="2">
<li class="sitemenu-item level-3" style="position: relative;"> <li class="sitemenu-item level-3" style="position: relative;">
<a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a>
</li> </li>

View File

@ -5,10 +5,10 @@
<ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0"> <ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0">
<li class="sitemenu-item level-1 {{active_class}}"> <li class="sitemenu-item level-1 {{active_class}}">
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a>
<ul class="sitemenu-list level-2" data-list="children" data-level="1"> <ul class="sitemenu-list level-2 {{dropdown}}" data-list="children" data-level="1">
<li class="sitemenu-item level-2" style="position: relative;"> <li class="sitemenu-item level-2" style="position: relative;">
<a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a>
<ul class="sitemenu-list level-2" data-list="children" data-level="2"> <ul class="sitemenu-list level-2 {{dropdown}}" data-list="children" data-level="2">
<li class="sitemenu-item level-3" style="position: relative;"> <li class="sitemenu-item level-3" style="position: relative;">
<a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a> <a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a>
</li> </li>