SnippetVamp

Because spending time searching snippets sucks.



ALV 3 XPath 1 abap 9 ahk 1 autohotkey 6 bash 2 cli 2 clipboard 3 excel 1 file 1 file_path 1 greasemonkey 1 javascript 1 python 4 sap 1 screen 1 sql 1 ssh 1 tool 2 tunnel 1

.

greasemonkey

Gorafi comment order reverser

// ==UserScript==
// @name                Gorafi comment sorter
// @namespace       Plop Corp
// @author               Ginko Aloe
// @licence              CC BY 3.0 - http://creativecommons.org/licenses/by/3.0/
// @description         Sort Gorafi comment chronologically
// @include             http://www.legorafi.fr/*
// @version             1
// @grant               none
// ==/UserScript==

// NB : I think this script should work on many wordpress-powered sites (since legorafi is one of them). Feel free to fork it, this work is under CC By.

function getNode(xpathStmt, node) {
    return document.evaluate( xpathStmt, node, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
}

// Get comment nodes
var ol = getNode("//ol[@class='commentlist']", document);
var li = ol.getElementsByClassName('depth-1');

// Build new comment list
var new_ol = document.createElement('ol');
new_ol.className = 'commentlist';
 
var parent = ol.parentNode;

// Copy list elements beginning from the last to the new list
for(var i=li.length - 1; i >= 0 ; i--)    {
    new_ol.appendChild(li[i]);
 }
 
 // Inject the new list and remove the old one
parent.insertBefore(new_ol, ol);
parent.removeChild(ol)

XPath greasemonkey javascript

<iframe width="100%" height="812" src="http://ginkobox.fr/vamp/index.php?embed=54c67287a1928" type="text/html"></iframe>

Text only - Permalink - Snippet public post date 26/01/2015

This page's Feed


SnippetVamp 1.84 by Bronco - generated in 0.01 s