Retry calculate add size if is not working

This commit is contained in:
Jorit Tijsen
2024-04-19 15:46:16 +02:00
parent 8fcd34759f
commit 239bff06ce
3 changed files with 21 additions and 7 deletions

View File

@@ -1,7 +1,14 @@
function calculateSize(targetId) {
function calculateSize(targetId, tries) {
if (tries == undefined) {
tries = 0;
}
setTimeout(function(){
$('#' + targetId).height($('#' + targetId).children(":first").height());
$('#' + targetId).width($('#' + targetId).children(":first").width());
if (($('#' + targetId).children(":first").height() == 0 || $('#' + targetId).children(":first").width() == 0) && tries < 4) {
calculateSize(targetId, tries + 1);
} else {
$('#' + targetId).height($('#' + targetId).children(":first").height());
$('#' + targetId).width($('#' + targetId).children(":first").width());
}
}, 500);
$('#' + targetId).css({backgroundColor: 'transparent'});
}

View File

@@ -1,2 +1,2 @@
/*! 2024-04-19 */
function calculateSize(e){setTimeout(function(){$("#"+e).height($("#"+e).children(":first").height()),$("#"+e).width($("#"+e).children(":first").width())},500),$("#"+e).css({backgroundColor:"transparent"})}$(document).ready(function(){$("#changePreferences, .cc_b_cp").click(function(){$("#title_targeting").parent("li").hide(),$("#content_targeting").hide()})}),function(a){a.fn.loadMoreNews=function(e){var t=!1,o={loadingElementId:"#loading",container:"",url:document.location.pathname,nextPage:2},s=(a.extend(o,e),a(o.loadingElementId,this));s.hide(),this.click(function(e){var n,i;e.preventDefault(),t||(t=1,s.show(),n=a(this).attr("disabled","disabled"),i=a(o.container),a.ajax({url:o.url+(0<=o.url.indexOf("?")?"&":"?")+"pagina="+o.nextPage}).always(function(){t=0,s.hide(),n.removeAttr("disabled")}).done(function(t){t?(i.each(function(){var e=this.toString();a(e).append(a("<div>"+t+"</div>").find(e).length?a("<div>"+t+"</div>").find(e).children():a(t))}),++o.nextPage):n.attr("disabled","disabled").text("Geen nieuws meer.")}))})}}(jQuery),$(function(){$("[data-loadmorenews]").each(function(){$(this).loadMoreNews($(this).data("loadmorenews"))})}),function(o){o.fn.menu=function(e){var t={menuSubmenuClass:"has_submenu"},e=(o.extend(t,e),o(this).children("."+t.menuSubmenuClass)),i=o(this);e.on("mouseenter",function(){var e=o(this),t=(o(".menu-submenu > ul.submenu").slideUp(400,function(){o(this).closest(".menu-submenu").remove()}),o(".hover",i).removeClass("hover"),e.addClass("hover"),o('<div style="width: '+e.outerWidth()+'px"><a href="'+e.find("a").attr("href")+'" style="width: '+e.outerWidth()+'px"></a></div>').append(e.children("ul.submenu").clone())),n=e.offset();t.addClass("menu-submenu").css({top:n.top,left:n.left}),t.on("mouseleave",function(){o(".menu-submenu > ul.submenu").slideUp(400,function(){o(this).closest(".menu-submenu").remove()}),e.removeClass("hover")}),o("body").append(t),t.children("ul.submenu").slideDown(),t.find("ul.submenu").subMenu({}),openPlayerInNewScreen()})},o.fn.subMenu=function(e){var t={menuSubmenuClass:"has_submenu"};o.extend(t,e),o(this).find("li."+t.menuSubmenuClass+" > a").click(function(e){e.preventDefault();e=o(this).closest("li");e.children("ul.submenu").slideToggle(),e.toggleClass("opened")})}}(jQuery),$(function(){$(".menu").menu({}),$(".mobile-menu").subMenu({}),$(".mobile_menu_button a").click(function(){$(".mobile_menu_container").show()}),$(".mobile_close_menu_button a").click(function(){$(".mobile_menu_container").hide()}),$(".mobile_menu_container").click(function(e){!$(e.target).closest("#mobile_menu_nav").length&&$(".mobile_menu_container").is(":visible")&&$(".mobile_menu_container").hide()})}),$(function(){$(".prettyPhoto[rel^='prettyPhoto']").prettyPhoto({show_title:!1,slideshow:3e3,overlay_gallery:!0,social_tools:""})}),$(function(){$(".scroll_top").click(function(e){e.preventDefault(),$("html, body").stop().animate({scrollTop:0},500,"swing")})}),function(o){o.fn.share=function(e){var i={type:"",types:{facebook:{url:"https://www.facebook.com/sharer/sharer.php?u=",textOption:!1},twitter_x:{url:"https://twitter.com/share?url=",textOption:"text="}},excerptClass:"excerpt"};o.extend(i,e),this.click(function(e){e.preventDefault();var t,n,e=i.types[i.type];void 0!==e?(t="",e.textOption&&(278<(n=o("."+i.excerptClass).text().trim()).length+location.href.length&&(n=n.substring(0,278-(location.href.length+3))+"..."),t="&"+e.textOption+encodeURI(n)),window.open(e.url+encodeURI(location.href)+t,"pop","width=600, height=400, scrollbars=no")):console.error(i.type+" is unknown")})}}(jQuery),$(function(){$("[data-share]").each(function(){$(this).share({type:$(this).data("share")})})}),function(u){u.fn.snapTo=function(e){var t={elementClass:"post"},n=(u.extend(t,e),u(this)),i=n.find("."+t.elementClass+":visible"),o=!1,s=null,a=function(){var t;o||(o=!0,t=n.scrollLeft(),i.each(function(){var e=u(this).offset();if(e.left>-window.screen.width/2&&e.left<window.screen.width/2)return n.animate({scrollLeft:Math.round(t+e.left)+"px"},300),!1}),s&&clearTimeout(s),s=setTimeout(function(){o=!1},500))},l=null;n.on("scroll",function(){l&&clearTimeout(l),l=setTimeout(a,300)})}}(jQuery),$(function(){$("[data-snapto]").each(function(){$(this).snapTo($(this).data("snapto"))})}),function(o){o.fn.tabs=function(e){var t={tabClass:"box_header",activeClass:"active",contentClass:"tab_content"},n=(o.extend(t,e),o(this).find("."+t.tabClass)),i=o(this);n.click(function(e){e.preventDefault(),n.removeClass(t.activeClass),i.find("."+t.contentClass).removeClass(t.activeClass),i.find("#"+o(this).data("tab-content-id")).addClass(t.activeClass),o(this).addClass(t.activeClass)})}}(jQuery),$(function(){$("[data-tabs]").each(function(){$(this).tabs($(this).data("tabs")??{})})});
function calculateSize(e,t){null==t&&(t=0),setTimeout(function(){(0==$("#"+e).children(":first").height()||0==$("#"+e).children(":first").width())&&t<4?calculateSize(e,t+1):($("#"+e).height($("#"+e).children(":first").height()),$("#"+e).width($("#"+e).children(":first").width()))},500),$("#"+e).css({backgroundColor:"transparent"})}$(document).ready(function(){$("#changePreferences, .cc_b_cp").click(function(){$("#title_targeting").parent("li").hide(),$("#content_targeting").hide()})}),function(a){a.fn.loadMoreNews=function(e){var t=!1,o={loadingElementId:"#loading",container:"",url:document.location.pathname,nextPage:2},s=(a.extend(o,e),a(o.loadingElementId,this));s.hide(),this.click(function(e){var n,i;e.preventDefault(),t||(t=1,s.show(),n=a(this).attr("disabled","disabled"),i=a(o.container),a.ajax({url:o.url+(0<=o.url.indexOf("?")?"&":"?")+"pagina="+o.nextPage}).always(function(){t=0,s.hide(),n.removeAttr("disabled")}).done(function(t){t?(i.each(function(){var e=this.toString();a(e).append(a("<div>"+t+"</div>").find(e).length?a("<div>"+t+"</div>").find(e).children():a(t))}),++o.nextPage):n.attr("disabled","disabled").text("Geen nieuws meer.")}))})}}(jQuery),$(function(){$("[data-loadmorenews]").each(function(){$(this).loadMoreNews($(this).data("loadmorenews"))})}),function(o){o.fn.menu=function(e){var t={menuSubmenuClass:"has_submenu"},e=(o.extend(t,e),o(this).children("."+t.menuSubmenuClass)),i=o(this);e.on("mouseenter",function(){var e=o(this),t=(o(".menu-submenu > ul.submenu").slideUp(400,function(){o(this).closest(".menu-submenu").remove()}),o(".hover",i).removeClass("hover"),e.addClass("hover"),o('<div style="width: '+e.outerWidth()+'px"><a href="'+e.find("a").attr("href")+'" style="width: '+e.outerWidth()+'px"></a></div>').append(e.children("ul.submenu").clone())),n=e.offset();t.addClass("menu-submenu").css({top:n.top,left:n.left}),t.on("mouseleave",function(){o(".menu-submenu > ul.submenu").slideUp(400,function(){o(this).closest(".menu-submenu").remove()}),e.removeClass("hover")}),o("body").append(t),t.children("ul.submenu").slideDown(),t.find("ul.submenu").subMenu({}),openPlayerInNewScreen()})},o.fn.subMenu=function(e){var t={menuSubmenuClass:"has_submenu"};o.extend(t,e),o(this).find("li."+t.menuSubmenuClass+" > a").click(function(e){e.preventDefault();e=o(this).closest("li");e.children("ul.submenu").slideToggle(),e.toggleClass("opened")})}}(jQuery),$(function(){$(".menu").menu({}),$(".mobile-menu").subMenu({}),$(".mobile_menu_button a").click(function(){$(".mobile_menu_container").show()}),$(".mobile_close_menu_button a").click(function(){$(".mobile_menu_container").hide()}),$(".mobile_menu_container").click(function(e){!$(e.target).closest("#mobile_menu_nav").length&&$(".mobile_menu_container").is(":visible")&&$(".mobile_menu_container").hide()})}),$(function(){$(".prettyPhoto[rel^='prettyPhoto']").prettyPhoto({show_title:!1,slideshow:3e3,overlay_gallery:!0,social_tools:""})}),$(function(){$(".scroll_top").click(function(e){e.preventDefault(),$("html, body").stop().animate({scrollTop:0},500,"swing")})}),function(o){o.fn.share=function(e){var i={type:"",types:{facebook:{url:"https://www.facebook.com/sharer/sharer.php?u=",textOption:!1},twitter_x:{url:"https://twitter.com/share?url=",textOption:"text="}},excerptClass:"excerpt"};o.extend(i,e),this.click(function(e){e.preventDefault();var t,n,e=i.types[i.type];void 0!==e?(t="",e.textOption&&(278<(n=o("."+i.excerptClass).text().trim()).length+location.href.length&&(n=n.substring(0,278-(location.href.length+3))+"..."),t="&"+e.textOption+encodeURI(n)),window.open(e.url+encodeURI(location.href)+t,"pop","width=600, height=400, scrollbars=no")):console.error(i.type+" is unknown")})}}(jQuery),$(function(){$("[data-share]").each(function(){$(this).share({type:$(this).data("share")})})}),function(u){u.fn.snapTo=function(e){var t={elementClass:"post"},n=(u.extend(t,e),u(this)),i=n.find("."+t.elementClass+":visible"),o=!1,s=null,a=function(){var t;o||(o=!0,t=n.scrollLeft(),i.each(function(){var e=u(this).offset();if(e.left>-window.screen.width/2&&e.left<window.screen.width/2)return n.animate({scrollLeft:Math.round(t+e.left)+"px"},300),!1}),s&&clearTimeout(s),s=setTimeout(function(){o=!1},500))},l=null;n.on("scroll",function(){l&&clearTimeout(l),l=setTimeout(a,300)})}}(jQuery),$(function(){$("[data-snapto]").each(function(){$(this).snapTo($(this).data("snapto"))})}),function(o){o.fn.tabs=function(e){var t={tabClass:"box_header",activeClass:"active",contentClass:"tab_content"},n=(o.extend(t,e),o(this).find("."+t.tabClass)),i=o(this);n.click(function(e){e.preventDefault(),n.removeClass(t.activeClass),i.find("."+t.contentClass).removeClass(t.activeClass),i.find("#"+o(this).data("tab-content-id")).addClass(t.activeClass),o(this).addClass(t.activeClass)})}}(jQuery),$(function(){$("[data-tabs]").each(function(){$(this).tabs($(this).data("tabs")??{})})});