Skip to content

Instantly share code, notes, and snippets.

@vancura
Created August 14, 2015 14:37
Show Gist options
  • Save vancura/3fb86fdc5cd6eb47aa3f to your computer and use it in GitHub Desktop.
Save vancura/3fb86fdc5cd6eb47aa3f to your computer and use it in GitHub Desktop.
Dribbble @2x replacer: change @1x to @2x.
// ==UserScript==
// @name Dribbble 2x
// @namespace http://vancura.org
// @description Use 2x images
// @homepage http://vancura.org
// @version 0.0.1
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @include *://dribbble.com/*
// ==/UserScript==
var f;
var src, fn, ext;
var loop = setInterval(dribbbleLoop, 1000);
function dribbbleLoop() {
$(".dribbble-img img").each(function() {
t = $(this);
src = t.attr("src");
if(src.indexOf('_1x.') > 0) {
fn = src.substr(0, src.length - 7);
ext = src.substr(src.length - 3, 3);
src = fn + "." + ext;
t.after("<img src='" + src + "' />");
t.hide();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment