/*** DOCUMENTATION LAYER moshi myspace 95 thesis widget (m95.wx.js) Author: Tom at klenwell@gmail.com Last Updated: Nov 2006 FUNCTIONS wx_m95() wx_m95_html(text, num) js_get_script_path(js_fname) js_rand(min, max) NOTES To link: To display widget:
The following css settings may be used to modify appearance RECOMMENDED #m95_wrap { position:absolute; top:10px; right:10px; } .m95_wx { font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; font-size:14px; font-style:italic; font-weight:bold; color:#330000; } .m95_wx a { color:#993300; text-decoration:none; } .m95_wx a:hover { color:#ff9900; } OPTIONAL .m95_mid {} .m95_text {} .m95_num {} .m95_top {} DEPENDENCIES requires three image files for background: m95_top.png, m95_mid.png, m95_btm.png LICENSE GPL (see http://www.gnu.org/copyleft/gpl.html) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, &c. ______________________________________________________________________________*/ // global parameters var debug = 0; // debugging on? var list95_src_fname = 'm95.src.js' // thesis source file var m95_css_fname = 'm95.css'; var js_fname = 'm95.wx.js'; // this file (for autostyling below) // autostyle if ( typeof m95_autostyle == 'undefined' ) m95_autostyle = 0; // get script path var dir_path = js_get_script_path(js_fname); // background images var bg_top_src = dir_path + 'm95_top.png'; var bg_mid_src = dir_path + 'm95_mid.png'; var bg_btm_src = dir_path + 'm95_btm.png'; var list95_src = dir_path + list95_src_fname; // load thesis source file document.write(''); // wx_myspace95thesis /*____________________________________________________________________________*/ function wx_m95() { // *** DATA // hard parameters _debug = 0; // *** MANIPULATE // sanity check if ( !LIST95.length ) { if ( debug ) alert('95thesis array empty!'); return; } // num items in list var len = LIST95.length; // get random number var idx = js_rand(0, len-1); // get thesis selection selection = LIST95[idx]; // get number of entry num = ( idx == len-1 ) ? 95 : idx + 1; // build html for display m95_html = wx_m95_html(selection, num); // display document.write(m95_html); // return (void) return; } // end Fx /*____________________________________________________________________________*/ // wx_myspace95thesis /*____________________________________________________________________________*/ function wx_m95_html(text, num) { // *** DATA // elements var top_block = ''; var num_block = ''; var mid_block = ''; var m95_footer = ''; var yanker = ''; // return var html = ''; // *** MANIPULATE // internal style settings top_block_style = 'height:34px; background-image:url(' + bg_top_src + '); background-repeat:no-repeat; background-position:top center;'; mid_block_style = 'background-image:url(' + bg_mid_src + '); background-repeat:repeat-y; background-position:top center; padding:2px 20px;'; wx_style = 'position:relative; width:180px; padding-bottom:24px; background-image:url(' + bg_btm_src + '); background-repeat:no-repeat; background-position:bottom center; overflow:hidden; z-index:10;' num_style = 'font-size:1.4em; padding-left:1em; font-weight:bold;'; // top block top_block = ''; // build num block if ( !isNaN(num) ) num_block = '