Skip to content

Instantly share code, notes, and snippets.

Avatar

Franz Enzenhofer franzenzenhofer

View GitHub Profile
View GTM-NS5CTZH_workspace1.json
{
"exportFormatVersion": 2,
"exportTime": "2020-10-06 15:31:33",
"containerVersion": {
"path": "accounts/6000775609/containers/32949204/versions/0",
"accountId": "6000775609",
"containerId": "32949204",
"containerVersionId": "0",
"container": {
"path": "accounts/6000775609/containers/32949204",
@franzenzenhofer
franzenzenhofer / minimal-user-interaction.js
Last active Mar 31, 2021
minimal-user-interaction Google Tag Manager Tag
View minimal-user-interaction.js
<script>
var mui = function()
{
var fired = false;
var kickTrigger = function()
{
if(fired === true){return false;}
//console.log("miniumal-user-interaction");
dataLayer.push({'minimal-user-interaction': true});
@franzenzenhofer
franzenzenhofer / hl-en-bookmarklet
Created Mar 14, 2019
change any google page to english language
View hl-en-bookmarklet
let l = window.location;
const p = new URLSearchParams(l.search);
p.set('hl','en');
window.location.search="?"+p.toString();
//minified bookmarklet code
//javascript:let l=window.location,p=new URLSearchParams(l.search);p.set("hl","en");window.location.search="?"+p.toString();
View gist:03b1b8ed2e0dea25bbc9979c961a3054
var nonCriLoad = function nonCriLoad() {
var rps = document.getElementById('non-critical-css');
if (!(rps.relList && rps.relList.supports && rps.relList.supports("preload"))) {
rps.onload = "";
//rps.rel="stylesheet";
var ncs = document.createElement("link");
ncs.rel = "stylesheet";
ncs.href = rps.href;
rps.appendChild(ncs);
View changeShopLinksBasedOnGeoIp.js
;
window.shop_links_changed = false;
let doTheChange = (cc) =>
{
let o = 'https://shop.veganblatt.com';
let ccs =['AT','DE','CH'];
if(ccs.includes(cc))
View internal-prefetch-hints
var allreadyPrefetched = {};
var preFetcher = function(elem) {
if(elem && elem.href && !allreadyPrefetched[elem.href])
{
var hint;
hint = document.createElement("link");
hint.rel = "prefetch";
hint.href = elem.href;
document.head.appendChild(hint);
allreadyPrefetched[elem.href]=true;
@franzenzenhofer
franzenzenhofer / internal-prefetch-hints
Created Mar 25, 2015
injecting internal prefetch hints
View internal-prefetch-hints
var allreadyPrefetched = {};
var preFetcher = function(elem) {
if(elem && elem.href && !allreadyPrefetched[elem.href])
{
var hint;
hint = document.createElement("link");
hint.rel = "prefetch";
hint.href = elem.href;
document.head.appendChild(hint);
allreadyPrefetched[elem.href]=true;
View socialproof.jquery.coffee
_DEBUG_ = false
dlog = (m) -> console.log(m) if _DEBUG_
getFacebook = (u, cb) ->
jQuery.getJSON(
'http://api.facebook.com/restserver.php',
{
format:'json'
method:'links.getStats'
urls: u
View gac-scrapper.js
d = function(msg) { console.log(msg); }
var _css_path_to_autocomplete_ = '#gsr > div.gstl_0.sbdd_a > div:nth-child(2) > div.sbdd_b > div > ul';
var _css_path_to_recommendations_ = '._e4b'; _css_path_to_autocomplete_;//'#brs > div > div:nth-child(1) > p:nth-child(1) > a';//'#brs';//'._e4b';
A = []
var arrayUnique = function(a) {
return a.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
@franzenzenhofer
franzenzenhofer / jquery.bodysnatch.js
Created Nov 10, 2012
jquery plugin that replaces elements with absolute positioned clones of themselves, while hiding & silencing the originals
View jquery.bodysnatch.js
(function($){
isString = function (obj) {
return toString.call(obj) == '[object String]';
};
$.fn.bodysnatch = function() {
var collection = this;
return collection.each(function(a,b) {
var element = $(this);
var clone = element.clone();