Skip to content

Instantly share code, notes, and snippets.

@nigelheap
Created July 7, 2011 23:52
Show Gist options
  • Save nigelheap/1070816 to your computer and use it in GitHub Desktop.
Save nigelheap/1070816 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name projects.itomic.com.hide.old.tasks
// @namespace projects.itomic.com.hide.old.tasks
// @description projects.itomic.com.hide.old.tasks
// @include http://projects.itomic.com/cms/?module=timesheet&action=add
// ==/UserScript==
(function() {
var ie = !!(window.attachEvent && !window.opera);
var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
var fn = [];
var run = function () { for (var i = 0; i < fn.length; i++) fn[i](); };
var d = document;
d.ready = function (f) {
if (!ie && !wk && d.addEventListener)
return d.addEventListener('DOMContentLoaded', f, false);
if (fn.push(f) > 1) return;
if (ie)
(function () {
try { d.documentElement.doScroll('left'); run(); }
catch (err) { setTimeout(arguments.callee, 0); }
})();
else if (wk)
var t = setInterval(function () {
if (/^(loaded|complete)$/.test(d.readyState))
clearInterval(t), run();
}, 0);
};
//document.forms['form_timesheet'].TimeProjectID.options.closed.style.display = "none";
function init(){
//var opts = document.forms['form_timesheet'].TimeProjectID.options;
//var sel = document.getElementById("TimeProjectID");
//var opts = document.getElementById("TimeProjectID").options;
//var optionz = document.getElementById("TimeProjectID").options;
//var len = optionz.length;
sel = document.getElementById("TimeProjectID");
len = sel.options.length;
for (x in sel.options){
//console.log(typeof sel.options[x]);
if(sel.options[x].className != "active" && sel.options[x].className != ""){
//console.log(typeof sel.options[x]);
if(typeof sel.options[x] == "object"){
//sel.options[x] = null;
sel.options[x].style.display = "none";
}
}
}
act = document.getElementById("TimeWorktypeID");
for (x in act.options){
if(act.options[x].value == 28){
act.options[x].selected = "selected";
}
}
/*
for(i = 0; i < len; i++){
if(sel.options[i].className != "active" && sel.options[i].className != ""){
sel.options[i] = null;
//sel.options[i].style.display = "none";
}
}
*/
//console.log(document.getElementById("TimeProjectID").options[20].class);
/*
//optionz[i].removeNode(true)
//console.log(sel.remove(i));
//sel[i] = null;
//console.log(optionz[i].value);
//optionz[i].style.display = "none";
//sel.options[i].style.display = "none";
//sel.remove(i);
for (x in opts)
{
//document.write(opts[x] + " ");
//console.log(opts[x].className);
if(opts[x].className != "active" && opts[x].className != ""){
//opts[x].style.display = "none";
opts.removeChild(childNodes[x]);
}
}
*/
}
document.ready(function () {
init();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment