Strict Standards: Only variables should be passed by reference in /home/abeall/public_html/fireworks/download.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/abeall/public_html/fireworks/download.php:28) in /home/abeall/public_html/fireworks/download.php on line 44
/* Fireworks CS5 JavaScript Command Randomly applies styles (from panel or specified) to selected elements Install by copying to Fireworks/Configuration/Commands/ Aaron Beall 2011 - http://abeall.com Version 1.0 */ var dom = fw.getDocumentDOM(); var sel = [].concat(fw.selection); function RandomizeStyles() { // Require active document if(!fw.documents.length) return false; // Require selection if(!sel.length) return alert("Unable to randomize; please select some objects."); // User input var input = prompt("Enter list of style names (case insensitive) from the Styles panel (use wildcard * to match multiple styles):", fw.RandomizeStyles_input || "*"); if(!input) return false; var applyAll = input == "*" var args = input; if(!applyAll) args = args.split(","); fw.RandomizeStyles_input = input; // Find selected styles var i = args.length; while(i--) args[i] = args[i].split(" ").join("").toLowerCase(); var styles = fw.styles, applyStyles = []; for(var i = 0; i < styles.length; i++){ var styleName = styles[i].name.split(" ").join("").toLowerCase(); if(applyAll || isMatch(styleName, args)) applyStyles.push(styles[i].name); } if(!applyStyles.length) return alert("Unable to find any matching styles. Make sure your Styles panel is not empty; use the names shown in the Styles panel, or search terms using a * wildcard."); // Apply random style to all selected elements var s = sel.length; while(s--){ var elem = sel[s]; fw.selection = [elem]; var style = applyStyles[Math.floor(applyStyles.length * Math.random())]; dom.applyStyle(style, 0); sel[s] = fw.selection[0]; } // Restore selection fw.selection = sel; // Command success return true; } try{ RandomizeStyles(); }catch(e){alert([e.lineNumber, ":", e, e.fileName])}; function trim(str){ while(str.charAt(0) == " ") str = str.substr(1); while(str.charAt(str.length - 1) == " ") str = str.substr(0, str.length - 1); return str; } function isMatch(str, terms){ for(var i = 0; i < terms.length; i++){ var term = terms[i].split("*"); if(term.length == 1){ if(str == term[0]) return true; }else{ for(var t = 0; t < term.length; t++) if(term[t].length && str.indexOf(term[t]) != -1) return true; } } return false; }