Sha256: 900a000b213adf28ed279717f8bea4cbc805e25faa90c06c34d9a9456374e9a2
Contents?: true
Size: 1.17 KB
Versions: 11
Compression:
Stored size: 1.17 KB
Contents
var mvpreview = new Object(); mvpreview.preview_divs = $A( document.getElementsByTagName('div') ).findAll( function(elem){ return (elem.getAttribute('mv:preview') != null); }); mvpreview.copySections = function(){ var mv_sections_needing_copy = this.preview_divs.findAll( function(elem){ var prevAttr = elem.getAttribute('mv:preview'); return (prevAttr.substring(0,7) == 'copyOf:'); }); //copy sections mv_sections_needing_copy.each( function(e){ var id = e.getAttribute('mv:preview').split(':')[1]; e.innerHTML = $(id).innerHTML; } ); }; mvpreview.sections = mvpreview.preview_divs.findAll( function(elem){ return (elem.getAttribute('mv:preview') == 'showOne'); }); mvpreview.hideSections = function(){ this.sections.each( function(elem){ window.Element.hide(elem); } ); } mvpreview.findSectionToShow = function(id){ return this.sections.find( function(e){ return (e.id == id); } ); } mvpreview.showOneSection = function(id){ this.hideSections(); window.Element.show( this.findSectionToShow(id) ); }
Version data entries
11 entries across 11 versions & 2 rubygems