Version 0.9 ()
------------------------------------------------------------------------
+ * Make category selector be nicer to Opera. Load the handling functions
+ only after the DOM load is completed. Add new "addLoadEvent"
+ functionality for future use to stack onload events. (garvinhicking)
+
* New Plugin API Hook "frontend_calendar" which allows to hook into
sidebar calendar creation. Needs to be enabled in the calendar
plugin configuration and needs a patch to the plugin_calendar.tpl
function showItem(id) {
var selected = 0;
+ if (typeof(id) == 'undefined' || typeof(id) == 'object') {
+ id = 'categoryselector';
+ }
+
if (document.getElementById) {
el = document.getElementById(id);
if (selector_toggle[id] && selector_toggle[id] == 'off') {
/* Hack to make sure that when the single dropdown is shown, don't have multiple selections */
last = 0;
- for (i=0; i< el.options.length; i++) {
+ for (i=0; i < el.options.length; i++) {
if (el.options[i].selected == true) {
selected++;
last = i;
}
}
- el.selectedIndex = 0;
+ el.selectedIndex = null;
if (last > 0) {
el.selectedIndex = last;
}
?>
return true;
}
-
+
selector_toggle['categoryselector'] = '<?php echo ($categoryselector_expanded ? 'on' : 'off'); ?>';
- showItem('categoryselector');
+ addLoadEvent(showItem);
</script>
</td>
</tr>
expire.setTime(today.getTime() + (60*60*24*30));
document.cookie = 'serendipity[' + name + ']='+escape(value) + ';expires=' + expire.toGMTString();
}
+
+ function addLoadEvent(func) {
+ var oldonload = window.onload;
+ if (typeof window.onload != 'function') {
+ window.onload = func;
+ } else {
+ window.onload = function() {
+ oldonload();
+ func();
+ }
+ }
+ }
+
</script>
</head>
<body id="serendipity_admin_page" onload="spawn()">