Created
May 16, 2012 08:17
-
-
Save awendt/2708643 to your computer and use it in GitHub Desktop.
Greasemonkey/Tampermonkey script for Scalarium: Filter cloud list by name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Find Cloud | |
// @namespace Scalarium | |
// @include https://manage.scalarium.com/clouds | |
// @include https://manage.scalarium.com/ | |
// @include https://manage.scalarium.com | |
// @version 2 | |
// ==/UserScript== | |
( | |
function() { | |
unsafeWindow.jQuery(".snd-nav h2"). | |
append('<input type="search" autofocus="autofocus" id="find_cloud" style="margin-left:10px; display:inline; width:auto;" />'); | |
unsafeWindow.jQuery("#find_cloud").keyup(function() { | |
if (unsafeWindow.jQuery("#find_cloud").val() === "") { | |
unsafeWindow.jQuery(".underline-fix").closest(".table_dashboard").show(); | |
return; | |
} | |
matching_clouds = unsafeWindow.jQuery(".underline-fix:contains("+unsafeWindow.jQuery("#find_cloud").val()+")"); | |
matching_clouds.each(function() { | |
unsafeWindow.jQuery(this).closest(".table_dashboard").show(); | |
}); | |
unsafeWindow.jQuery(".underline-fix").not(matching_clouds).each(function() { | |
unsafeWindow.jQuery(this).closest(".table_dashboard").hide(); | |
}); | |
}); | |
unsafeWindow.jQuery("#find_cloud").keypress(function(e) { | |
if (e.keyCode === 13 && unsafeWindow.jQuery(".table_dashboard:visible").length === 1) { | |
unsafeWindow.location.href = unsafeWindow.jQuery(".table_dashboard:visible a:first").attr("href"); | |
} | |
}); | |
} | |
)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment