Hello again, My second 'pure prototype CLASS project' and my second post.. (apologies for the size - a lot to convey)
If recently had a look at the overlib.js script from http://www.bosrup.com/web/overlib/ and was a bit disappointed by several aspects of the code. Primarily it failed miserably when parsed by JSLINT. I started to do a re-write of the code (as a prototype class) by basically reproducing all of the existing functions and existing flow of code. When the script I was producing reached 50K and it still wasn't finished/working correctly I pulled the pin and decided to start from scratch. I decided just to use the basic concept and configuration layout and started my clone. I first went through and studied how the original code handles the configuration. It became obvious that there was a lot of redundancy there and the whole thing could be a lot more fluid. I have managed to reproduce all of the required (configuration and functionality) of the original code and saved about 20K in size, from 50K+ to 30K+. I'm having a couple of minor issues though and could use some advice/direction. No 1: I'm using setStyle() quite a bit, and for some reason in some cases its not updating the inline style. On line 446 I have a method called 'set_style' and the setStyle() in there works fine. It uses a dynamic name prefix to get the value which is set for a fixed key on a dynamic ID value. $(id).setStyle({ On line 455 there's a 'fill_cont' (fill container) method that populates the popup before the positioning is tested. Within that method there are two cases where the setStyle() fails. I have had to revert to basic HTMLDOM.style to make it work. Here's the code: if(this.olc_divborder) { $(id).style.border=this.olc_divborder+'px solid '+this.olc_bordercol; /* $(id).setStyle({ border: this.olc_divborder+'px' +this.olc_bordercol+ 'solid' }); */ this.diagnostics('div border set to '+this.olc_divborder+'px'); } The commented out code is not working. Any thoughts??? Second Part: if(this.olc_background){ $('textDiv').style.backgroundImage="url("+this.olc_background+")"; /* $('textDiv').setStyle({ backgroundImage: 'url('+this.olc_background+') top left' }); */ this.diagnostics('text area background set!'); } Same again. Using DOM.style works with the values supplied. Its only happening on the border and backgroud-image) I'm also using setStyle() elsewhere within this method: and it work fine in those cases?!?! No2: I created a method to add a <style> tag into the head and add some selector-rules code into it. Firstly its for the (Click to Close Link) and for generating fixed classes for various popup elements including the new (Feature Selector) method... It works OK in firefox, but, apparently IE has some issues adding a 'textnode' into a style element (tag). I had hoped that prototype would have circumvented this problem?? The method called 'add_style" is on line 504.. Here is the code I'm using within the method: var headElement = document.getElementsByTagName("head")[0], styleElement = document.createElement("style"), selector, rule; /* headElement = document.getElementsByTagName("head")[0], headElement = $$('head') */ selector = arguments[0]; rule = arguments[1]; if(!$('overlib-clone')) { /* runs if <style> tag with id NOT created yet */ styleElement.id = "overlib-clone"; styleElement.type = "text/css"; headElement.appendChild(styleElement); Element.insert(styleElement, { 'top': selector + " { " + rule + " }" }); } else { styleElement = "overlib-clone"; Element.insert(styleElement, { 'bottom': selector + " { " + rule + " }" }); } I tried to use $$(head') to create the 'headElemet' but I got an error from (headElement.appendChild(styleElement); ) in firebug?? Perhaps I should have used an index key? Anyhow, the current/main issue is with Internet Explorer (Thanks Bill!). Does anyone have solution or previously tried to do this within prototype?? Here is the page I have set-up using the (diagnostics version) of OverLIB Clone - I have introduced a 'Feature Selector' which can run on the page. (diagnostics are off by default)... http://www.imbi.com.au/overlib-clone-mini-prototype-class/overlib-clone-sample.php Here is a link to a .phps (source) page showing the whole script source... http://www.imbi.com.au/overlib-clone-mini-prototype-class/overlib_clone_diagnostic_class_js_source.phps This project is about 95% complete, next test phase will be to implement it within an <iframe> page as per here... http://www.imbi.com.au/indie-applications/ to be used on the (Top Ten Indie Links App) Thanks in advance to all helpers!! Gilbert Rehling Creative Imagineering Productions -> <?php MCSE; MCTS; ?> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---