r80927 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80926‎ | r80927 | r80928 >
Date:22:04, 24 January 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
open #forminput/#formlink in floating frame when param 'popup' present
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_floatedit.js (added) (history)
  • /trunk/extensions/SemanticForms/skins/SF_floatedit.css (added) (history)
  • /trunk/extensions/SemanticForms/skins/loadingbg.png (added) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -136,6 +136,7 @@
137137 array_shift( $params ); // don't need the parser
138138 // set defaults
139139 $inFormName = $inLinkStr = $inLinkType = $inQueryStr = $inTargetName = '';
 140+ $popupClassString = "";
140141 // assign params - support unlabelled params, for backwards compatibility
141142 foreach ( $params as $i => $param ) {
142143 $elements = explode( '=', $param, 2 );
@@ -155,6 +156,10 @@
156157 $inQueryStr = $value;
157158 elseif ( $param_name == 'target' )
158159 $inTargetName = $value;
 160+ elseif ( $param_name == null && $value == 'popup' ) {
 161+ self::loadScriptsForFloatWindow( $parser );
 162+ $popupClassString = 'class="floatlink"';
 163+ }
159164 elseif ( $i == 0 )
160165 $inFormName = $param;
161166 elseif ( $i == 1 )
@@ -171,11 +176,11 @@
172177 $link_url .= "/$inTargetName";
173178 }
174179 $link_url = str_replace( ' ', '_', $link_url );
 180+ $hidden_inputs = "";
175181 if ( $inQueryStr != '' ) {
176182 // special handling for 'post button' - query string
177183 // has to be turned into hidden inputs
178184 if ( $inLinkType == 'post button' ) {
179 - $hidden_inputs = "";
180185 // Change HTML-encoded ampersands to
181186 // URL-encoded ampersands, so that the string
182187 // doesn't get split up on the '&'.
@@ -202,11 +207,11 @@
203208 if ( $inLinkType == 'button' ) {
204209 $link_url = html_entity_decode( $link_url, ENT_QUOTES );
205210 $link_url = str_replace( "'", "\'", $link_url );
206 - $str = "<form><input type=\"button\" value=\"$inLinkStr\" onclick=\"window.location.href='$link_url'\"></form>";
 211+ $str = "<form $popupClassString><input type=\"button\" value=\"$inLinkStr\" onclick=\"window.location.href='$link_url'\"></form>";
207212 } elseif ( $inLinkType == 'post button' ) {
208 - $str = "<form action=\"$link_url\" method=\"post\"><input type=\"submit\" value=\"$inLinkStr\" />$hidden_inputs</form>";
 213+ $str = "<form action=\"$link_url\" method=\"post\" $popupClassString><input type=\"submit\" value=\"$inLinkStr\" />$hidden_inputs</form>";
209214 } else {
210 - $str = "<a href=\"$link_url\">$inLinkStr</a>";
 215+ $str = "<a href=\"$link_url\" $popupClassString>$inLinkStr</a>";
211216 }
212217 // hack to remove newline from beginning of output, thanks to
213218 // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function
@@ -220,6 +225,7 @@
221226 $inFormName = $inValue = $inButtonStr = $inQueryStr = '';
222227 $inAutocompletionSource = '';
223228 $inSize = 25;
 229+ $popupClassString = "";
224230 // assign params - support unlabelled params, for backwards compatibility
225231 foreach ( $params as $i => $param ) {
226232 $elements = explode( '=', $param, 2 );
@@ -245,6 +251,9 @@
246252 } elseif ( $param_name == 'autocomplete on namespace' ) {
247253 $inAutocompletionSource = $value;
248254 $autocompletion_type = 'namespace';
 255+ } elseif ( $param_name == null && $value == 'popup' ) {
 256+ self::loadScriptsForFloatWindow( $parser );
 257+ $popupClassString = 'class="floatinput"';
249258 }
250259 elseif ( $i == 0 )
251260 $inFormName = $param;
@@ -279,13 +288,13 @@
280289 $fs_url = $fs->getTitle()->getLocalURL();
281290 if ( empty( $inAutocompletionSource ) ) {
282291 $str = <<<END
283 - <form action="$fs_url" method="get">
 292+ <form action="$fs_url" method="get" $popupClassString>
284293 <p><input type="text" name="page_name" size="$inSize" value="$inValue" class="formInput" />
285294
286295 END;
287296 } else {
288297 $str = <<<END
289 - <form name="createbox" action="$fs_url" method="get">
 298+ <form name="createbox" action="$fs_url" method="get" $popupClassString>
290299 <p><input type="text" name="page_name" id="input_$input_num" size="$inSize" value="$inValue" class="autocompleteInput createboxInput formInput" autocompletesettings="input_$input_num" />
291300
292301 END;
@@ -486,4 +495,43 @@
487496 return implode( $new_delimiter, $results_array );
488497 }
489498
 499+ static function loadScriptsForFloatWindow ( &$parser ) {
 500+
 501+ global $sfgScriptPath;
 502+
 503+ wfDebug( "loadScriptsForFloatWindow \n" );
 504+
 505+ if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) {
 506+
 507+ // on MW 1.17+ just request the ResourceLoader to include modules
 508+
 509+ $parser->getOutput()->addModules( 'ext.semanticforms.floatedit' );
 510+
 511+ } else {
 512+
 513+ // on MW pre1.17 insert the necessary headers into the page head
 514+
 515+ static $loaded = false;
 516+
 517+ // load JavaScript and CSS files only once
 518+ if ( $loaded ) return true;
 519+
 520+ // load extensions JavaScript
 521+ $parser->getOutput()->addHeadItem(
 522+ '<script type="text/javascript" src="' . $sfgScriptPath
 523+ . '/libs/SF_floatedit.js"></script> ' . "\n"
 524+ );
 525+
 526+ // load extensions style sheet
 527+ $parser->getOutput()->addHeadItem(
 528+ '<link rel="stylesheet" href="' . $sfgScriptPath
 529+ . '/skins/SF_floatedit.css"/> ' . "\n"
 530+ );
 531+
 532+ $loaded = true;
 533+
 534+ }
 535+
 536+ return true;
 537+ }
490538 }
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php
@@ -147,6 +147,11 @@
148148 'ext.semanticforms.autogrow' => $sfgResourceTemplate + array(
149149 'scripts' => 'libs/SF_autogrow.js',
150150 ),
 151+ 'ext.semanticforms.floatedit' => $sfgResourceTemplate + array(
 152+ 'scripts' => 'libs/SF_floatedit.js',
 153+ 'styles' => 'skins/SF_floatedit.css',
 154+ 'dependencies' => array( 'jquery' ),
 155+ ),
151156 );
152157 }
153158
Index: trunk/extensions/SemanticForms/skins/loadingbg.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/SemanticForms/skins/loadingbg.png
___________________________________________________________________
Added: svn:mime-type
154159 + image/png
Index: trunk/extensions/SemanticForms/skins/SF_floatedit.css
@@ -0,0 +1,93 @@
 2+/*
 3+ Document : floatedit.css
 4+ Created on : 05.01.2011, 20:56:24
 5+ Author : fox
 6+ Description:
 7+ Purpose of the stylesheet follows.
 8+*/
 9+
 10+/*
 11+ TODO customize this sample style
 12+ Syntax recommendation http://www.w3.org/TR/REC-CSS2/
 13+*/
 14+
 15+div.floatlink, div.floatinput,
 16+div.floatlink form, div.floatinput form {
 17+ display: inline;
 18+}
 19+
 20+div.floatedit-wrapper {
 21+ position: fixed;
 22+ left: 0px;
 23+ top: 0px;
 24+ height: 100%;
 25+ width: 100%;
 26+}
 27+
 28+div.floatedit-background {
 29+ left: 0px;
 30+ top: 0px;
 31+ height: 100%;
 32+ width: 100%;
 33+ background: black;
 34+ z-index: 4;
 35+
 36+}
 37+
 38+div.floatedit-anchor {
 39+ position: fixed;
 40+ left: 50%;
 41+ top: 50%;
 42+ width: 0;
 43+ height: 0;
 44+ z-index: 6;
 45+}
 46+
 47+div.floatedit-container {
 48+ position: absolute;
 49+ background-color: white;
 50+ border: 2px solid midnightblue;
 51+}
 52+
 53+iframe.floatedit-innerdocument {
 54+ width: 100%;
 55+ height: 100%;
 56+ border: none;
 57+}
 58+
 59+div.floatedit-close {
 60+ position: absolute;
 61+ right: -25px;
 62+ top: -25px;
 63+ width: 30px;
 64+ height: 30px;
 65+ cursor: pointer;
 66+ background-image: url('../skins/fancy_close.png');
 67+}
 68+
 69+div.floatedit-loading {
 70+ position: fixed;
 71+ left: 50%;
 72+ top: 50%;
 73+ z-index: 5;
 74+}
 75+
 76+div.floatedit-loadingbg {
 77+ position: absolute;
 78+ left: -63px;
 79+ top: -63px;
 80+ width: 127px;
 81+ height: 127px;
 82+ background-color: transparent;
 83+ background-image: url('../skins/loadingbg.png');
 84+}
 85+
 86+div.floatedit-loadingfg {
 87+ position: absolute;
 88+ left: -15px;
 89+ top: -15px;
 90+ width: 30px;
 91+ height: 30px;
 92+ background-color: transparent;
 93+ background-image: url('../skins/loading.gif');
 94+}
Property changes on: trunk/extensions/SemanticForms/skins/SF_floatedit.css
___________________________________________________________________
Added: svn:eol-style
195 + native
Index: trunk/extensions/SemanticForms/libs/SF_floatedit.js
@@ -0,0 +1,582 @@
 2+/**
 3+ * Javascript code to be used with extension FloatEdit.
 4+ *
 5+ * @author Stephan Gambke
 6+ * @version 0.1 alpha
 7+ *
 8+ */
 9+
 10+// initialise
 11+jQuery(function(){
 12+
 13+ // register eventhandlers on 'edit' links and buttons
 14+
 15+ // register formlink with link
 16+ jQuery('a.floatlink').click(function(evt){
 17+ return ext.floatedit.handleFloatLink( evt.target.getAttribute('href'), this );
 18+ });
 19+
 20+ // register formlink with button
 21+ jQuery( 'form.floatlink[method!="post"] input' ).each(function() {
 22+
 23+ var input = jQuery(this);
 24+
 25+ // Yay, IE 4 lines, FF 0 lines
 26+ var target = String (this.getAttribute("onclick"));
 27+ var start = target.indexOf("window.location.href='") + 22;
 28+ var stop = target.indexOf("'", start);
 29+ target = target.substring( start, stop );
 30+
 31+ input.data( "target", target ) // extract link target from event handler
 32+ .attr( "onclick", null ) // and remove event handler
 33+ .click( function( evt ){
 34+ return ext.floatedit.handleFloatLink( jQuery( this ).data( "target" ), this);
 35+ });
 36+ })
 37+
 38+ // register formlink with post button
 39+ jQuery( 'form.floatlink[method="post"]' ).submit(function(evt){
 40+ return ext.floatedit.handleFloatLink( this.getAttribute( 'action' ), this );
 41+ });
 42+
 43+
 44+ // register forminput
 45+ jQuery( 'form.floatinput' ).submit(function(evt){
 46+ return ext.floatedit.handleFloatInput( this.getAttribute( 'action' ), this );
 47+ });
 48+
 49+});
 50+
 51+// create ext if it does not exist yet
 52+if ( typeof( window[ 'ext' ] ) == "undefined" ) {
 53+ window[ 'ext' ] = {};
 54+}
 55+
 56+window.ext.floatedit = new function() {
 57+
 58+ var wrapper;
 59+ var background;
 60+ var container;
 61+ var iframe;
 62+ var waitIndicator;
 63+ var instance = 0;
 64+
 65+ var doc;
 66+ var docWidth;
 67+ var docHeight;
 68+
 69+ var brokenBrowser, brokenChrome;
 70+
 71+ function handleFloatInput( ptarget, elem ) {
 72+
 73+ showForm();
 74+
 75+ iframe.one( 'load', function(){
 76+ // attach event handler to iframe
 77+ iframe.bind( 'load', handleLoadFrame );
 78+ return false;
 79+ })
 80+
 81+ elem.target = 'floatedit-iframe' + instance;
 82+ return true;
 83+ }
 84+
 85+ function handleFloatLink( ptarget, elem ) {
 86+
 87+ showForm();
 88+
 89+ // attach event handler to iframe
 90+ iframe.bind( 'load', handleLoadFrame );
 91+
 92+ if ( elem.tagName == 'FORM' ) {
 93+
 94+ elem.target = 'floatedit-iframe' + instance;
 95+ return true;
 96+
 97+ } else {
 98+
 99+ var delim = ptarget.indexOf( '?' );
 100+ var form = document.createElement("form");
 101+
 102+ form.target = 'floatedit-iframe' + instance;
 103+
 104+ // Do we have parameters?
 105+ if ( delim > 0 ) {
 106+ form.action = ptarget.substr( 0, delim );
 107+ var params = String( ptarget.substr( delim + 1 ) ).split("&");
 108+ for ( var i = 0; i < params.length; ++i ) {
 109+
 110+ var input = document.createElement("input");
 111+ var param = String( params[i] ).split('=');
 112+ input.type = 'hidden';
 113+ input.name = decodeURIComponent( param[0] );
 114+ input.value = decodeURIComponent( param[1] );
 115+ form.appendChild( input );
 116+
 117+ }
 118+ } else {
 119+ form.action = ptarget;
 120+ }
 121+
 122+ document.getElementsByTagName('body')[0].appendChild(form);
 123+ form.submit();
 124+ document.getElementsByTagName('body')[0].removeChild(form);
 125+
 126+ return false;
 127+ }
 128+ }
 129+
 130+ function showForm() {
 131+
 132+ instance++;
 133+
 134+ brokenChrome =
 135+ ( navigator.userAgent.indexOf("Chrome") >= 0 &&
 136+ navigator.platform.indexOf("Linux x86_64") >= 0 );
 137+
 138+ brokenBrowser= jQuery.browser.msie ||brokenChrome;
 139+
 140+ wrapper = jQuery( "<div class='floatedit-wrapper' >" );
 141+ background = jQuery( "<div class='floatedit-background' >" );
 142+
 143+ var waitIndicatorWrapper = jQuery( "<div class='floatedit-loading'>" );
 144+
 145+ waitIndicator = jQuery( "<div class='floatedit-loadingbg'></div><div class='floatedit-loadingfg'></div>" );
 146+
 147+ var anchor = jQuery( "<div class='floatedit-anchor' >" );
 148+
 149+ container = jQuery( "<div class='floatedit-container' >" );
 150+ iframe = jQuery( "<iframe class='floatedit-innerdocument' name='floatedit-iframe" + instance + "' id='floatedit-iframe" + instance + "' >");
 151+
 152+ var closeBtn = jQuery( "<div class='floatedit-close'></div> " );
 153+
 154+ // initially hide background and waitIndicator
 155+ if (brokenChrome) background.css("background", "transparent");
 156+ else background.css("opacity", 0.0);
 157+
 158+ waitIndicator.hide();
 159+ container.hide()
 160+
 161+ // insert background and wait indicator into wrapper and all into document
 162+ waitIndicatorWrapper
 163+ .append( waitIndicator );
 164+
 165+ container
 166+ .append( closeBtn )
 167+ .append( iframe );
 168+
 169+ anchor
 170+ .append(container);
 171+
 172+ wrapper
 173+ .append( background )
 174+ .append( waitIndicatorWrapper )
 175+ .append( anchor )
 176+ .appendTo( "body" );
 177+
 178+ // fade background in
 179+ if ( !brokenChrome ) background.fadeTo( 400, 0.3 );
 180+ fadeIn( waitIndicator );
 181+
 182+ // attach event handler to close button
 183+ closeBtn.click( handleCloseFrame );
 184+
 185+ // TODO: wrapper must be set to max z-index;
 186+
 187+ }
 188+
 189+ function handleLoadFrame( event ){
 190+
 191+ var iframe = jQuery( event.target );
 192+ var iframecontents = iframe.contents();
 193+
 194+ if ( brokenChrome ) container[0].style.visibility = "hidden";
 195+ else container[0].style.opacity = 0;
 196+
 197+ container.show();
 198+
 199+ // GuMaxDD has #content but keeps headlines in #gumax-content-body
 200+ var content = iframecontents.find("#gumax-content-body");
 201+
 202+ // normal skins use #content (e.g. Vector, Monobook)
 203+ if ( content.length == 0 ) content = iframecontents.find("#content");
 204+
 205+ // some skins use #mw_content (e.g. Modern)
 206+ if ( content.length == 0 ) content = iframecontents.find("#mw_content");
 207+
 208+ // this is not a normal MW page (or it uses an unknown skin)
 209+ if ( content.length == 0 ) content = iframecontents.find("body");
 210+
 211+ // the huge left margin looks ugly in Vector, reduce it
 212+ // (How does this look for other skins?)
 213+ var siblings = content
 214+ .css( {
 215+ margin: 0,
 216+ padding: "1em",
 217+ width: "auto",
 218+ height: "auto",
 219+ minWidth: "0px",
 220+ minHeight:"0px"
 221+ } )
 222+ .parents().css( {
 223+ margin: 0,
 224+ padding: 0,
 225+ width: "auto",
 226+ height: "auto",
 227+ minWidth: "0px",
 228+ minHeight:"0px"
 229+ })
 230+ .andSelf().siblings();
 231+
 232+ if ( jQuery.browser.msie && jQuery.browser.version < "6" ) {
 233+ siblings.hide();
 234+ } else {
 235+ siblings
 236+ .each( function(){
 237+ var elem = jQuery(this);
 238+// if ( ( elem.outerWidth(true) > 0 && elem.outerHeight(true) > 0 ) &&
 239+ if ( getStyle(this, "display") != "none"
 240+ && ( getStyle( this, "width") != "0px" || getStyle( this, "height") != "0px" )
 241+ && ! (
 242+ ( this.offsetLeft + elem.outerWidth(true) < 0 ) || // left of document
 243+ ( this.offsetTop + elem.outerHeight(true) < 0 ) || // above document
 244+ ( this.offsetLeft > 100000 ) || // right of document
 245+ ( this.offsetTop > 100000 ) // below document
 246+ )
 247+ ) {
 248+
 249+ jQuery(this).hide();
 250+ // css({
 251+ // height : "0px",
 252+ // width : "0px",
 253+ // minWidth : "0px",
 254+ // minHeight : "0px",
 255+ // margin : "0px",
 256+ // padding : "0px"
 257+ // border : "none",
 258+ // overflow: "hidden"
 259+ // //position: "static"
 260+ // });
 261+ }
 262+ if ( ( this.offsetLeft + elem.outerWidth() < 0 ) ||
 263+ ( this.offsetTop + elem.outerHeight() < 0 )
 264+ ) {
 265+ this.style.left = (-elem.outerWidth(true)) + "px";
 266+ this.style.top = (-elem.outerHeight(true)) + "px";
 267+ }
 268+ });
 269+ //.children().css("position", "static");
 270+ }
 271+
 272+ // find content document
 273+ doc = iframe[0].contentWindow || iframe[0].contentDocument;
 274+
 275+ if (doc.document) {
 276+ doc = doc.document;
 277+ }
 278+
 279+ // first try if the content enforces its dimensions (e.g. GuMaxDD)
 280+ docWidth = content.outerWidth(true);
 281+ docHeight = content.outerHeight(true);
 282+
 283+ // then try if it grows to its dimensions given enough space (e.g. Vector)
 284+ var origPos = content[0].style.position;
 285+ content[0].style.position = "fixed";
 286+
 287+ if ( content.outerWidth(true) > docWidth || content.outerHeight(true) > docHeight ) {
 288+ docWidth = content.outerWidth(true);
 289+ docHeight = content.outerHeight(true);
 290+ }
 291+
 292+ content[0].style.position = origPos;
 293+
 294+ // default for broken browsers
 295+ if ( docWidth == 0 || docHeight == 0 ) {
 296+
 297+ docWidth = jQuery(window).width();
 298+ docHeight = jQuery(window).height();
 299+
 300+ }
 301+
 302+
 303+ // adjust frame size to dimensions just calculated
 304+ adjustFrameSize();
 305+
 306+ // and attach event handler to adjust frame size every time the window
 307+ // size changes
 308+ jQuery( window ).resize( adjustFrameSize );
 309+
 310+ var form = content.find("#sfForm");
 311+
 312+ if (form.length > 0) {
 313+
 314+ var submitok = false;
 315+ var innersubmitprocessed = false;
 316+
 317+ // catch form submit event
 318+ form
 319+ .bind( "submit", function( event ){
 320+
 321+ var interval = setInterval(function(){
 322+
 323+ if ( innersubmitprocessed ) {
 324+ clearInterval( interval );
 325+ innersubmitprocessed = false;
 326+ if ( submitok ) handleSubmitData( event );
 327+ }
 328+
 329+ }, 10)
 330+ event.stopPropagation();
 331+ return false;
 332+
 333+ });
 334+
 335+ var innerwdw = window.frames['floatedit-iframe' + instance];
 336+
 337+ // catch inner form submit event
 338+ innerwdw.jQuery(form[0])
 339+ .bind( "submit", function( event ) {
 340+ submitok = event.result;
 341+ innersubmitprocessed = true;
 342+ return false;
 343+ })
 344+ }
 345+
 346+ // catch 'Cancel'-Link (and other 'back'-links) and close frame instead of going back
 347+ var allLinks = content.find("a[href]");
 348+ var backlinks = allLinks.filter('a[href="javascript:history.go(-1);"]');
 349+
 350+ backlinks.click(handleCloseFrame);
 351+
 352+ // promote any other links to open in main window, prevent nested browsing
 353+ allLinks
 354+ .not('a[href*="javascript:"]') // scripted links
 355+ .not('a[target]') // targeted links
 356+ .not('a[href^="#"]') // local links
 357+ .click(function(event){
 358+ if ( event.result != false ) {
 359+ closeFrameAndFollowLink( event.target.getAttribute('href') )
 360+ }
 361+ return false;
 362+ });
 363+
 364+ // finally show the frame
 365+ fadeOut ( waitIndicator, function(){
 366+ fadeTo( container, 400, 1 );
 367+ });
 368+
 369+ return false;
 370+
 371+ }
 372+
 373+ function handleSubmitData( event ){
 374+
 375+ fadeOut( container, function() {
 376+ fadeIn( waitIndicator );
 377+ });
 378+
 379+ var form = jQuery( event.target );
 380+ var formdata = form.serialize() + "&wpSave=" + escape(form.find("#wpSave").attr("value"));
 381+
 382+ // Send form data off. SF will send back a fake edit page
 383+ //
 384+ // Normally we should check this.action first and only if it is empty
 385+ // revert to this.ownerDocument.URL. Tough luck, IE does not return an
 386+ // empty action but fills in some bogus
 387+ jQuery.post( event.target.ownerDocument.URL , formdata, handleInnerSubmit);
 388+
 389+ return false;
 390+
 391+
 392+ function handleInnerSubmit ( returnedData, textStatus, XMLHttpRequest ) {
 393+
 394+
 395+ // find form in fake edit page
 396+ var innerform = jQuery("<div>" + returnedData + "</div>").find("form");
 397+
 398+ // check if we got an error page
 399+ if ( innerform.length == 0 ) {
 400+
 401+ form.unbind( event );
 402+
 403+ var iframe = container.find("iframe");
 404+ var doc = iframe[0].contentWindow || iframe[0].contentDocument;
 405+ if (doc.document) {
 406+ doc = doc.document;
 407+ }
 408+
 409+ doc.open();
 410+ doc.write(returnedData);
 411+ doc.close();
 412+
 413+ return false;
 414+ }
 415+
 416+ // Send the form data off, we do not care for the returned data
 417+ var innerformdata = innerform.serialize();
 418+ jQuery.post( innerform.attr("action"), innerformdata );
 419+
 420+ // build new url for outer page (we have to ask for a purge)
 421+
 422+ var url = location.href;
 423+
 424+ // does a querystring exist?
 425+ var start = url.indexOf("action=");
 426+
 427+ if ( start >= 0 ) {
 428+
 429+ var stop = url.indexOf("&", start);
 430+
 431+ if ( stop >= 0 ) url = url.substr( 0, start - 1 ) + url.substr(stop + 1);
 432+ else url = url.substr( 0, start - 1 );
 433+
 434+ }
 435+
 436+
 437+
 438+ var form = jQuery('<form action="' + url + '" method="POST"><input type="hidden" name="action" value="purge"></form>')
 439+ .appendTo('body');
 440+
 441+ form
 442+ .submit();
 443+
 444+ fadeOut( container, function(){
 445+ fadeIn( waitIndicator );
 446+ });
 447+
 448+ return false;
 449+
 450+ }
 451+ }
 452+
 453+ function adjustFrameSize() {
 454+
 455+ var availW = jQuery(window).width();
 456+ var availH = jQuery(window).height();
 457+
 458+ var w, h;
 459+
 460+ // Standard max height/width is 80% of viewport, but we will allow
 461+ // up to 85% to avoid scrollbars with nearly nothing to scroll
 462+ if ( docWidth > availW * .85 || docHeight > availH * .85 ) {
 463+
 464+ iframe[0].style.overflow = "auto";
 465+
 466+ if ( docWidth > availW * .85 ) {
 467+ w = ( availW * .8 );
 468+ } else {
 469+ w = docWidth + 20;
 470+ }
 471+
 472+ if ( docHeight > availH * .85 ) {
 473+ h = ( availH * .8 );
 474+ } else {
 475+ h = docHeight + 20;
 476+ }
 477+
 478+ } else {
 479+ iframe[0].style.overflow = "hidden";
 480+ w = docWidth;
 481+ h = docHeight;
 482+ }
 483+
 484+ with ( container[0].style ) {
 485+ width = ( w ) + "px";
 486+ height = ( h ) + "px";
 487+ top = (( - h ) / 2) + "px";
 488+ left = (( - w ) / 2) + "px";
 489+ }
 490+
 491+ }
 492+
 493+ function closeFrameAndFollowLink( link ){
 494+
 495+ fadeOut( container, function(){
 496+ fadeIn ( waitIndicator );
 497+ window.location.href = link;
 498+ });
 499+
 500+ }
 501+
 502+ function handleCloseFrame( event ){
 503+
 504+ jQuery(window).unbind( "resize", adjustFrameSize )
 505+
 506+ fadeOut( container, function(){
 507+ background.fadeOut( function(){
 508+ wrapper.remove();
 509+ });
 510+ });
 511+ return false;
 512+ }
 513+
 514+ // Saw it on http://robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element
 515+ // and liked it
 516+ function getStyle(oElm, strCssRule){
 517+ var strValue = "";
 518+ if(document.defaultView && document.defaultView.getComputedStyle){
 519+ strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
 520+ }
 521+ else if(oElm.currentStyle){
 522+ strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
 523+ return p1.toUpperCase();
 524+ });
 525+ strValue = oElm.currentStyle[strCssRule];
 526+ }
 527+ return strValue;
 528+ }
 529+
 530+ function fadeIn(elem, callback ) {
 531+ // no fading for broken browsers
 532+ if ( brokenBrowser ){
 533+
 534+ elem.show();
 535+ if ( callback ) callback();
 536+
 537+ } else {
 538+
 539+ // what an ugly hack
 540+ if ( elem === waitIndicator ) elem.fadeIn( 200, callback );
 541+ else elem.fadeIn( callback );
 542+
 543+ }
 544+ }
 545+
 546+ function fadeOut(elem, callback ) {
 547+ // no fading for broken browsers
 548+ if ( brokenBrowser ){
 549+
 550+ elem.hide();
 551+ if ( callback ) callback();
 552+
 553+ } else {
 554+
 555+ // what an ugly hack
 556+ if ( elem === waitIndicator ) elem.fadeOut( 200, callback );
 557+ else elem.fadeOut( callback );
 558+
 559+ }
 560+ }
 561+
 562+ function fadeTo(elem, time, target, callback) {
 563+ // no fading for broken browsers
 564+ if ( brokenBrowser ){
 565+
 566+ if (target > 0) elem[0].style.visibility = "visible";
 567+ else elem[0].style.visibility = "hidden";
 568+
 569+ if ( callback ) callback();
 570+
 571+ } else {
 572+
 573+ elem.fadeTo(time, target, callback);
 574+
 575+ }
 576+
 577+ }
 578+
 579+ // export public funcitons
 580+ this.handleFloatInput = handleFloatInput;
 581+ this.handleFloatLink = handleFloatLink;
 582+
 583+}
\ No newline at end of file
Property changes on: trunk/extensions/SemanticForms/libs/SF_floatedit.js
___________________________________________________________________
Added: svn:eol-style
1584 + native