https://www.mediawiki.org/wiki/Special:Code/MediaWiki/108224
Revision: 108224
Author: nikerabbit
Date: 2012-01-06 12:24:44 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
Stylize before I dare to touch these
Modified Paths:
--------------
trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js
trunk/extensions/SemanticForms/libs/SF_autogrow.js
trunk/extensions/SemanticForms/libs/SF_imagePreview.js
trunk/extensions/SemanticForms/libs/SF_popupform.js
trunk/extensions/SemanticForms/libs/SF_submit.js
trunk/extensions/SemanticForms/libs/SF_wikieditor.js
trunk/extensions/SemanticForms/libs/SemanticForms.js
Modified: trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js 2012-01-06
12:06:13 UTC (rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js 2012-01-06
12:24:44 UTC (rev 108224)
@@ -9,14 +9,14 @@
var interval;
function ajaxFormPreviewInit(){
-
+
if ((wgNamespaceNumber % 2 == 0) && /\.(js|css)$/.test(wgTitle)) return;
-
+
if(!document.getElementById('wikiPreview')) return;
-
+
var btnOld = document.getElementById('wpPreview');
if (!btnOld || !document.getElementById('wikiPreview')) return; //
need preview-button and preview-placeholder
-
+
var btn = document.createElement('input');
btn.type = 'button';
btn.onclick = ajaxFormPreviewClick;
@@ -24,68 +24,68 @@
btn.name = btnOld.name;
btn.value = btnOld.value;
btn.title = btnOld.title;
-
+
btn.value2 = btn.value;
-
+
btn.accessKey = btnOld.accessKey;
btn.disabled = btnOld.disabled;
btn.tabIndex = btnOld.tabIndex;
-
+
btnOld.parentNode.replaceChild(btn, btnOld);
}
-
+
function ajaxFormPreviewClick(){
ajaxFormPreviewRun(this)
}
function ajaxFormPreviewRun(btn){
-
+
wkPreview = document.getElementById('wikiPreview');
var form = document.createbox;
var aj = sajax_init_object();
var aj2 = sajax_init_object();
-
+
// remove old error messages
var el = document.getElementById("form_error_header");
if (el) el.parentNode.removeChild(el);
-
+
if (!wkPreview || !form || !aj || !aj2 || !validateAll() ) return;
-
+
var frag=document.createElement("div");
-
+
var htm;
-
+
// gray out old preview
wkPreview.style.opacity = '0.3';
wkPreview.style.color = 'gray';
-
+
document.body.style.cursor = 'wait';
-
+
//prepare
var action = document.URL;
if (wgAction=='formedit') action += '&live';
-
+
var boundary = '--------123xyz';
var data = '';
-
+
//FCKeditor visible? update free text first
// if (!oFCKeditor.ready) return false; //sajax_do_call in action -
what do we do?
if ( typeof FCKeditorAPI != "undefined" )
if ( showFCKEditor & RTE_VISIBLE ) {
-
+
var SRCtextarea = document.getElementById( 'free_text'
);
-
+
if ( SRCtextarea ) {
-
+
var oEditorIns = FCKeditorAPI.GetInstance(
'free_text' );
SRCtextarea.value = oEditorIns.GetData(
oEditorIns.Config.FormatSource );
-
+
}
-
+
}
-
+
elts = form.elements;
-
+
for (i=0; i < elts.length; ++i) {
if (elts[i].name && elts[i].name !== '' && !elts[i].disabled &&
((elts[i].type!='submit' && elts[i].type!='button' &&
elts[i].type!='radio' && elts[i].type!='checkbox') || elts[i].checked)) {
@@ -98,20 +98,20 @@
btn.style.width = Math.max(btn.scrollWidth, btn.offsetWidth) + 'px';
btn.value = '...';
btn.disabled='1';
-
+
//send
-
+
aj.open('POST', action, true);
aj.setRequestHeader('Content-Type', 'multipart/form-data;
boundary='+boundary);
aj.send(data + '--' + boundary);
aj.onreadystatechange = function(){
-
+
if (aj.readyState != 4) return;
-
+
// Got Wikitext. Now fetch HTML...
-
+
frag.innerHTML = aj.responseText;
-
+
if (!frag.getElementsByTagName("form")["editform"]) {
wkPreview.innerHTML = aj.responseText;
}
@@ -169,7 +169,7 @@
doc.open();
doc.write(htm);
doc.close();
-
+
interval=setInterval(function(){
if ( ! doc.getElementById("SF_PREVIEW_EOD") )
return;
@@ -238,7 +238,7 @@
}
},100);
-
+
wkPreview.style.opacity = '';
wkPreview.style.color = '';
wkPreview.style.display='block';
Modified: trunk/extensions/SemanticForms/libs/SF_autogrow.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_autogrow.js 2012-01-06 12:06:13 UTC
(rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_autogrow.js 2012-01-06 12:24:44 UTC
(rev 108224)
@@ -11,7 +11,7 @@
* @author Jevin O. Sewaruth
* @author Yaron Koren
*/
-
+
var autoGrowColsDefault = new Array();
var autoGrowRowsDefault = new Array();
Modified: trunk/extensions/SemanticForms/libs/SF_imagePreview.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_imagePreview.js 2012-01-06
12:06:13 UTC (rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_imagePreview.js 2012-01-06
12:24:44 UTC (rev 108224)
@@ -1,14 +1,14 @@
/**
* JavasSript for the Semantic Forms MediaWiki extension.
- *
+ *
* @licence GNU GPL v3+
* @author Jeroen De Dauw <jeroendedauw at gmail dot com>
*/
(function( $ ) {
-
+
var _this = this;
-
+
this.getPreviewImage = function( args, callback ) {
$.getJSON(
wgScriptPath + '/api.php',
@@ -23,7 +23,7 @@
function( data ) {
if ( data.query && data.query.pages ) {
var pages = data.query.pages;
-
+
for ( p in pages ) {
var info = pages[p].imageinfo;
for ( i in info ) {
@@ -36,14 +36,14 @@
}
);
};
-
+
$( document ).ready( function() {
$( '.sfImagePreview' ).each( function( index, domElement ) {
var $uploadLink = $( domElement );
var inputId = $uploadLink.attr( 'data-input-id' );
var $input = $( '#' + inputId );
var $previewDiv = $( '#' + inputId + '_imagepreview' );
-
+
var showPreview = function() {
_this.getPreviewImage(
{
@@ -60,13 +60,13 @@
}
);
};
-
+
$input.change( showPreview );
-
+
// if ( $previewDiv.html() === '' ) {
// showPreview();
// }
} );
} );
-
+
})( window.jQuery );
Modified: trunk/extensions/SemanticForms/libs/SF_popupform.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_popupform.js 2012-01-06 12:06:13 UTC
(rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_popupform.js 2012-01-06 12:24:44 UTC
(rev 108224)
@@ -5,7 +5,7 @@
*
*/
-// initialise
+// initialise
jQuery(function(){
// register eventhandlers on 'edit' links and buttons
@@ -75,7 +75,7 @@
elem.target = 'popupform-iframe' + instance;
return true;
-
+
} else {
var delim = ptarget.indexOf( '?' );
@@ -95,7 +95,7 @@
input.name = decodeURIComponent(
param[0] );
input.value = decodeURIComponent(
param[1] );
form.appendChild( input );
-
+
}
} else {
form.action = ptarget;
@@ -180,10 +180,10 @@
}
function handleLoadFrame( event ){
-
+
var iframe = jQuery( event.target );
var iframecontents = iframe.contents();
-
+
if ( brokenBrowser ) container[0].style.visibility = "hidden";
else container[0].style.opacity = 0;
@@ -191,7 +191,7 @@
// GuMaxDD has #content but keeps headlines in
#gumax-content-body
content = iframecontents.find("#gumax-content-body");
-
+
// normal skins use #content (e.g. Vector, Monobook)
if ( content.length == 0 ) content =
iframecontents.find("#content");
@@ -317,7 +317,7 @@
}, 10)
event.stopPropagation();
return false;
-
+
});
// catch inner form submit event
@@ -339,7 +339,7 @@
innerwdw.jQuery( innerwdw[0] ).unload(function (event) {
return false;
});
-
+
//
content.bind( 'click', function() {
var foundQueue = false;
@@ -393,7 +393,7 @@
});
return false;
-
+
}
function handleSubmitData( event ){
@@ -442,7 +442,7 @@
// Send the form data off, we do not care for the
returned data
var innerformdata = innerform.serialize();
jQuery.post( innerform.attr("action"), innerformdata );
-
+
// build new url for outer page (we have to ask for a
purge)
var url = location.href;
@@ -500,7 +500,7 @@
var html = body.parent();
var scrollTgt = html;
-
+
if ( jQuery.browser.webkit || jQuery.browser.safari ) {
scrollTgt = body;
}
@@ -590,7 +590,7 @@
contH = docH;
frameH = docpH;
}
-
+
if ( needsHScroll ){
frameH += scrollH;
} else {
Modified: trunk/extensions/SemanticForms/libs/SF_submit.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_submit.js 2012-01-06 12:06:13 UTC
(rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_submit.js 2012-01-06 12:24:44 UTC
(rev 108224)
@@ -47,7 +47,7 @@
var el = document.getElementById("form_error_header");
if (el) el.parentNode.removeChild(el);
-
+
if (validateAll()) {
// disable save and continue button
@@ -56,7 +56,7 @@
sacButtons
.addClass("sf-save_and_continue-wait")
.removeClass("sf-save_and_continue-changed");
-
+
sajax_request_type = 'POST';
var form = $('#sfForm');
@@ -94,7 +94,7 @@
sacButtons
.addClass("sf-save_and_continue-error")
.removeClass("sf-save_and_continue-wait");
-
+
// Remove all old error messages and
set new one
jQuery(".errorMessage").remove();
jQuery("#contentSub").append('<div
id="form_error_header" class="warningMessage" style="font-size: medium">' +
ajaxHeader.responseText + '</div>');
@@ -112,9 +112,9 @@
var summaryfield = jQuery("#wpSummary", form);
if ( summaryfield.length > 0 ) {
-
+
var oldsummary = summaryfield.attr("value");
-
+
if ( oldsummary != "" ) {
summaryfield.attr("value", oldsummary + " (" +
sfgSaveAndContinueSummary + ")");
} else {
@@ -124,12 +124,12 @@
var params = form.serialize();
summaryfield.attr("value", oldsummary );
-
+
} else {
-
+
var params = form.serialize();
params += "&wpSummary=" + sfgSaveAndContinueSummary;
-
+
}
if (wgAction == "formedit") {
@@ -163,7 +163,7 @@
}
params += "&wpMinoredit=1";
-
+
return params;
}
Modified: trunk/extensions/SemanticForms/libs/SF_wikieditor.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SF_wikieditor.js 2012-01-06
12:06:13 UTC (rev 108223)
+++ trunk/extensions/SemanticForms/libs/SF_wikieditor.js 2012-01-06
12:24:44 UTC (rev 108224)
@@ -4,55 +4,55 @@
}
window.ext.wikieditor = new function(){
-
+
// initialize the wikieditor on the specified element
this.init = function init ( input_id, params ) {
-
+
if ( window.mediaWiki ) {
mediaWiki.loader.using( 'ext.semanticforms.wikieditor',
function(){
-
+
var input = jQuery( '#' + input_id );
-
+
// load toolbar
mediaWiki.loader.using(
['jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config'] , function(){
if ( jQuery.wikiEditor.isSupported(
jQuery.wikiEditor.modules.toolbar ) ) {
-
+
input.wikiEditor( 'addModule',
jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
// hide sig if required
if ( wgWikiEditorEnabledModules
&& wgWikiEditorEnabledModules['hidesig'] == true ) {
input.wikiEditor(
'removeFromToolbar', {
- 'section':
'main',
- 'group':
'insert',
+ 'section':
'main',
+ 'group':
'insert',
'tool':
'signature'
} );
}
}
});
-
+
// load dialogs
mediaWiki.loader.using(
['jquery.wikiEditor.dialogs', 'jquery.wikiEditor.dialogs.config'] , function(){
if ( jQuery.wikiEditor.isSupported(
jQuery.wikiEditor.modules.dialogs ) ) {
-
+
jQuery.wikiEditor.modules.dialogs.config.replaceIcons( input );
input.wikiEditor( 'addModule',
$.wikiEditor.modules.dialogs.config.getDefaultConfig() );
-
+
}
});
-
+
// load toc
// TODO: Can this be enabled? Should it?
// mediaWiki.loader.using(
['jquery.wikiEditor.toc' ] , function(){
// if ( jQuery.wikiEditor.isSupported(
jQuery.wikiEditor.modules.toc ) ) {
-//
+//
// input.wikiEditor( 'addModule',
'toc' );
-//
+//
// }
// });
-
+
} );
}
}
Modified: trunk/extensions/SemanticForms/libs/SemanticForms.js
===================================================================
--- trunk/extensions/SemanticForms/libs/SemanticForms.js 2012-01-06
12:06:13 UTC (rev 108223)
+++ trunk/extensions/SemanticForms/libs/SemanticForms.js 2012-01-06
12:24:44 UTC (rev 108224)
@@ -69,7 +69,7 @@
this.delimiter = delimiter;
/* extending jquery functions */
- jQuery.extend( jQuery.ui.autocomplete, {
+ jQuery.extend( jQuery.ui.autocomplete, {
filter: function(array, term) {
if ( sfgAutocompleteOnAllChars ) {
var matcher = new
RegExp(jQuery.ui.autocomplete.escapeRegex(term), "i" );
@@ -120,7 +120,7 @@
return false;
}
});
-
+
} else {
// Autocomplete for a single value
jQuery(this).autocomplete({
@@ -182,7 +182,7 @@
jQuery.ajax({
url: myServer,
dataType: "json",
- data: {
+ data: {
substr:request.term
},
success: function( data ) {
@@ -324,7 +324,7 @@
elem.each( function() {
if ( jQuery(this).css('display') == 'none' ) {
-
+
jQuery(this).slideDown(speed, function() {
jQuery(this).fadeTo(speed,1);
});
@@ -343,13 +343,13 @@
// hardcoded in English.
alert( "Warning: this form has \"show on select\" pointing to
an invalid element ID (\"" + div_id + "\") - IDs in HTML cannot contain
spaces." );
}
-
+
var elem = jQuery('[id="' + div_id + '"]', instanceWrapperDiv);
elem.find("span, div").addClass('hiddenBySF');
-
+
elem.each( function() {
if ( jQuery(this).css('display') != 'none' ) {
-
+
// if 'display' is not 'hidden', but the element is
hidden otherwise
// (e.g. by having height = 0), just hide it, else
animate the hiding
if ( jQuery(this).is(':hidden') ) {
@@ -387,7 +387,7 @@
if ( instanceWrapperDiv.length == 0 ) {
instanceWrapperDiv = null;
}
-
+
if ( showOnSelectVals !== undefined ) {
for ( var i = 0; i < showOnSelectVals.length; i++ ) {
var options = showOnSelectVals[i][0];
@@ -395,7 +395,7 @@
showDivIfSelected( options, div_id, inputVal,
instanceWrapperDiv, initPage );
}
}
-
+
return this;
}
@@ -409,7 +409,7 @@
}
}
hideDiv(div_id, instanceWrapperDiv);
-
+
return this;
}
@@ -423,7 +423,7 @@
if ( instanceWrapperDiv.length == 0 ) {
instanceWrapperDiv = null;
}
-
+
if ( showOnSelectVals !== undefined ) {
for ( var i = 0; i < showOnSelectVals.length; i++ ) {
var options = showOnSelectVals[i][0];
@@ -431,7 +431,7 @@
this.showDivIfChecked(options, div_id,
instanceWrapperDiv, initPage );
}
}
-
+
return this;
}
@@ -444,13 +444,13 @@
if ( instanceWrapperDiv.length == 0 ) {
instanceWrapperDiv = null;
}
-
+
if (jQuery(this).is(":checked")) {
showDiv(div_id, instanceWrapperDiv, initPage ? 0 : 'fast' );
} else {
hideDiv(div_id, instanceWrapperDiv, initPage ? 0 : 'fast' );
}
-
+
return this;
}
@@ -661,7 +661,7 @@
jQuery.fn.addInstance = function() {
// Global variable.
num_elements++;
-
+
// Create the new instance
var new_div = this.closest(".multipleTemplateWrapper")
.find(".multipleTemplateStarter")
@@ -805,7 +805,7 @@
jQuery(this).showIfSelected(false);
});
});
-
+
this.find(".sfShowIfChecked").each( function() {
jQuery(this)
.showIfChecked(true)
@@ -813,7 +813,7 @@
jQuery(this).showIfChecked(false);
});
});
-
+
this.find(".sfShowIfCheckedCheckbox").each( function() {
jQuery(this)
.showIfCheckedCheckbox(true)
@@ -827,11 +827,11 @@
jQuery(this).closest(".multipleTemplateInstance")
.fadeTo('fast', 0, function() {
jQuery(this).slideUp('fast', function() {
- jQuery(this).remove();
+ jQuery(this).remove();
});
});
});
-
+
this.find('.autocompleteInput').attachAutocomplete();
this.find('.sfComboBox').combobox();
this.find('.autoGrow').autoGrow();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs