Skip to content

Instantly share code, notes, and snippets.

View lmonilsson's full-sized avatar

Linus Nilsson lmonilsson

View GitHub Profile
@lmonilsson
lmonilsson / jquery.contextMenu.js.patch
Last active December 23, 2017 13:50
Patch proposal for https://github.com/medialize/jQuery-contextMenu/issues/132 It wraps a bunch of layerClick() code inside a "!fakeClick" condition.
Index: jquery.contextMenu.js
===================================================================
--- jquery.contextMenu.js (revision 6957)
+++ jquery.contextMenu.js (working copy)
@@ -351,6 +351,7 @@
button = e.button,
x = e.pageX,
y = e.pageY,
+ fakeClick = x === undefined,
target,
@lmonilsson
lmonilsson / Remove di.se top bar (Greasemonkey)
Created March 13, 2015 22:59
Greasemonkey script for hiding the top frame on di.se
// ==UserScript==
// @name Remove di.se top frame
// @namespace http://www.di.se
// @include http://www.di.se/*
// @noframes
// @version 1
// @grant none
// ==/UserScript==
var frameset = top.document.getElementsByTagName("frameset")[0];
@lmonilsson
lmonilsson / knockout-optionsObjectValues.js
Created November 3, 2015 12:21
Makes it possible to use arbitrary objects as option values for a <select> with Knockout.
(function () {
function extractOptionsValues(options, optionsValueProp) {
var optionsValues = [];
for (var i = 0; i < options.length; i++) {
var opt = ko.unwrap(options[i]);
var optValue = opt[optionsValueProp];
optionsValues.push(optValue);
}