Skip to content

Instantly share code, notes, and snippets.

@ABooooo
ABooooo / new_gist_file.js
Created June 30, 2016 09:38
reset css animation (loop)
<script>
setInterval(function(){
var container = document.getElementById('anim');
var tmp = container.innerHTML;
container.innerHTML= tmp;
}, 9000 // length of the whole show in milliseconds
);
</script>
@ABooooo
ABooooo / new_gist_file.js
Created June 30, 2016 09:40
check if contain text
if($.trim($(".secMenu").text()) == "") {
$(".secMenu").remove();
}
@ABooooo
ABooooo / new_gist_file.js
Created June 30, 2016 09:41
check if contain image with timeout
setTimeout(function(){
if ($(".contentHeader").find("img").length > 0) {
$(".content").css("padding","15px 0");
} else {
$(".contentHeader").css("padding","0");
}
},100);
@ABooooo
ABooooo / new_gist_file.js
Created September 1, 2016 06:27
jQuery find text and replace with custom text
(function($){
$(document).ready(function(){
$("div").each(function () {
// var this is the current element's DOM object
if (this.innerHTML.indexOf("CōV") != -1) {
//$(this).addClass('cov');
$(this).html(
$(this).html().replace(/(\")?(CōV)(?!\")/gi, function ($0, $1) {
return $1 ? $0 : '<span class="cov">CōV</span>';
})
@ABooooo
ABooooo / new_gist_file.sass
Created April 5, 2017 07:55
Bullet points
.mainContent .left ul, .mainContent .right ul.bulletPointsList {
display: table;
margin: 0px;
padding: 0px;
}
.mainContent .left ul > li, .mainContent .right ul.bulletPointsList > li {
display: table-row;
margin: 0px;
padding-left: 0px;
@ABooooo
ABooooo / new_gist_file.js
Created July 6, 2017 09:58
Change CSS on scroll
var scroll_pos = 0;
$(document).scroll(function() {
scroll_pos = $(this).scrollTop();
if(scroll_pos > 210) {
$(".navbar-default").css({"background-color": "black" , "padding-top" : 0});
} else {
$(".navbar-default").css({"background-color" : "transparent" , "padding-top" : "30px"});
}
});
@ABooooo
ABooooo / new_gist_file.php
Created September 7, 2017 00:38
show post or page with ID
$post_id = 23;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo '<p class="jumboTitle">';
echo $title;
echo '</p>';
echo $queried_post->post_content;
//https://www.tipsandtricks-hq.com/query-or-show-a-specific-post-in-wordpress-php-code-example-44
@ABooooo
ABooooo / new_gist_file.ts
Created September 22, 2017 11:38
MASK - get image path
// compare with autogenerated code
<div class="boxContent" style="background-image: url(
<f:if condition="{data_item.tx_mask_bgimage}">
<f:for each="{data_item.tx_mask_bgimage}" as="file">
<f:uri.image src="{file.publicUrl}" />
</f:for>
</f:if>
@ABooooo
ABooooo / new_gist_file_0
Created November 27, 2017 12:04
if then elseif else
Since TYPO3 8LTS
Since version 8 TYPO3 uses the standalone version of fluid, that was heavily developed and got tons of new features like elseif:
<f:if condition="{var} == 'something'">
<f:then>do something</f:then>
<f:else if="{other-var} == 'something else'">do something else</f:else>
<f:else>do the other thing</f:else>
</f:if>
In addition there is support for syntax like this:
@ABooooo
ABooooo / gist:b4b9dd95b71ed0ec89f51e4274105dbb
Created February 15, 2018 15:10
read input name variable
$("input[name*='marker_04']").change(function(){
var max= 3;
if( $("input[name*='marker_04']:checked").length == max ){
$("input[name*='marker_04']").attr('disabled', 'disabled');
$("input[name*='marker_04']:checked").removeAttr('disabled');
}else{
$("input[name*='marker_04']").removeAttr('disabled');
}
});