Skip to content

Instantly share code, notes, and snippets.

@ABooooo
ABooooo / new_gist_file.js
Created August 21, 2015 10:25
change style parameter on mouse over / out
$( "a" ).has( "img" ).mouseenter(function(){
$(this).css("color", "#870036");
});
$( "a" ).has( "img" ).mouseleave(function(){
$(this).css("color", "black");
});
@ABooooo
ABooooo / new_gist_file.js
Created September 16, 2015 11:34
get data from json
// check url
var url = window.location.pathname;
var output = url.indexOf('/events')!=-1;
//alert (output[0]);
if (output) {
(function eventsData() {
@ABooooo
ABooooo / new_gist_file.js
Last active November 1, 2018 08:13
check img width and add class
// add img responsive class
$.each($('.news img'), function (index, item) {
if ($(item).width() >= 600) {
$(item).addClass("img-responsive");
}
});
@ABooooo
ABooooo / new_gist_file.ts
Last active November 1, 2018 08:13
Add video with DCE
// cinfiguration = file abstration layer
// field = filed name in configuration
<f:for each="{dce:fal(field:'jpg_data', contentObject:contentObject)}" as="fileReference">
<video poster="{f:uri.image(src:fileReference.uid,treatIdAsReference:1)}" autoplay="autoplay" preload="preload">
</f:for>
<f:for each="{dce:fal(field:'mp4_data', contentObject:contentObject)}" as="fileReference">
<source type="video/mp4" src="{f:uri.image(src:fileReference.uid,treatIdAsReference:1)}" />
</f:for>
<f:for each="{dce:fal(field:'webm_data', contentObject:contentObject)}" as="fileReference">
@ABooooo
ABooooo / new_gist_file_0
Created October 28, 2015 13:44
fullscreen background
body {
background-image: url(../img/bg.jpg);
background-position: top center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% auto;
background-color: $whiteColor;
}
@ABooooo
ABooooo / new_gist_file.css
Created October 29, 2015 09:23
box sizing
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@ABooooo
ABooooo / new_gist_file.html
Last active November 1, 2018 08:12
DCE format
// RTE
<f:format.html>{field.zitatText}</f:format.html>
// Single line text
<p>{field.zitatAutor}</p>
// Image (field:'variableName')
<f:for each="{dce:fal(field:'sliderImage', contentObject:contentObject)}" as="fileReference">
<f:image class="img-responsive" src="{fileReference.uid}" alt="" treatIdAsReference="1" />
</f:for>
@ABooooo
ABooooo / new_gist_file.js
Created December 2, 2015 19:30
change width and height attribut
$("img").attr({
"width": "100%",
"height": "auto"
});
@ABooooo
ABooooo / new_gist_file.php
Created December 4, 2015 09:37
remove FTP at plugin upload or update
/* insert this in wp-config.php */
define('FS_METHOD','direct');
@ABooooo
ABooooo / new_gist_file_0
Last active November 1, 2018 08:11
get image from post
Put this in your functions.php
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];