Skip to content

Instantly share code, notes, and snippets.

View ElfhirDev's full-sized avatar

ElfhirDev ElfhirDev

View GitHub Profile
@ElfhirDev
ElfhirDev / Go to top
Created June 29, 2016 09:58
Add a fixed button for go to top on website without it.
// ==UserScript==
// @name go to top
// @namespace gototop
// @description Add a button to go to top
// @include *
// @version 1
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js
// ==/UserScript==
$(document).ready(function () {
@ElfhirDev
ElfhirDev / jt-toolbar.user.js
Last active July 15, 2016 15:23
toolbar for scroll to top, scroll to bottom, other functionalities
// ==UserScript==
// @name jt-toolbar
// @namespace jt-toolbar
// @description toolbar for scroll to top, to bottom, and other functionalities
// @include *
// @version 1.22
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js
// ==/UserScript==
$(document).ready(function () {
@ElfhirDev
ElfhirDev / Modal - Pure CSS (no Javascript).markdown
Last active February 5, 2016 15:52
Modal - Pure CSS (no Javascript)
@ElfhirDev
ElfhirDev / libs.user.js
Created January 13, 2016 09:00
Load useful scripts for easy debugging / hacking in console on all websites
// ==UserScript==
// @name libs
// @namespace useful scripts
// @description load tons of useful scrips as jQuery, Modernizr, etc ... for debugging in console.
// @require http://code.jquery.com/jquery-1.12.0.min.js
// @require http://underscorejs.org/underscore-min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js
// @include *
// @version 1
// @grant none
@ElfhirDev
ElfhirDev / Request.QueryString.html
Last active January 6, 2016 15:55
Request.QueryString
div id="block">
<p class="query">
</p>
</div>
@ElfhirDev
ElfhirDev / iframe_defer.js
Created December 29, 2015 20:27 — forked from bjmiller121/iframe_defer.js
Defer loading of iframes
/**
* Defer iframe loading.
*
* Markup:
* <div class="defer-iframe" data-src="{SOURCE URL}" data-{ATTR}="{VAL}"></div>
*/
$(window).load( function(){
if ($('.defer-iframe').length) {
$('.defer-iframe').each( function() {
var $iframe = $('<iframe frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');
function iframeLazyLoading(iframe_height) {
var iframes = $('iframe');
$(document).on("scroll", function(event) {
iframes.each(function(index) {
var iframe = $(this);
if ($(document).scrollTop() > index*iframe_height) {
@ElfhirDev
ElfhirDev / checker.user.js
Last active November 10, 2015 08:46
NL-Checker Gist
// ==UserScript==
// @name NL-Checker User Script
// @namespace NL-Checker
// @description Script de vérifications Newsletter HTML
// @icon https://github.com/Elfhir/NL-checker/tree/master/GreaseMonkey/skin/logo.png
// @downloadURL https://github.com/Elfhir/NL-checker/blob/master/GreaseMonkey/checker.user.js
// @version 2.3
// @grant none
// @require http://code.jquery.com/jquery-1.11.3.min.js
// @include http://127.0.0.1:8091/nl/*
@ElfhirDev
ElfhirDev / JavaScript setCustomTimer
Last active December 19, 2015 07:29
JavaScript setInterval "interval" parameter cannot be changed during runtime. Maybe there are other solutions using more params (not supported in I.E 7 and below) for setInterval (but we can add a polyfill I have seen). I have adapted and add comment to the solution of Peter Bailey (14/08/09) : http://stackoverflow.com/questions/1280263/changing…
var intervals = [2,3,4,5];
var index = 0;
/**
* Custom "setInterval" with internal function modifying the interval
*
* @param callback The function to call various times
* intervals A duration using seconds
* index
@ElfhirDev
ElfhirDev / Iframe Youtube Autoplay - Rickrolled
Created June 21, 2013 09:37
Iframe Youtube Autoplay - Rickrolled
<iframe width="420" height="345" src="http://www.youtube.com/embed/oHg5SJYRHA0?autoplay=1" frameborder="0" allowfullscreen>
</iframe>