Index: trunk/extensions/wikiwyg/Wikiwyg.php
===================================================================
--- trunk/extensions/wikiwyg/Wikiwyg.php (revision 0)
+++ trunk/extensions/wikiwyg/Wikiwyg.php (revision 36026)
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Main file for the Wikiwyg extension that loads all other stuff
+ *
+ * @ingroup Extensions
+ */
+if ( !defined( 'MEDIAWIKI' ) ) {
+ exit( 1 );
+}
+
+$wgWikiwygEnabled = true;
+$wgWysiwygEnabled = true;
+$wgInPageEnabled = true;
+$wgYuiPath = "http://yui.yahooapis.com/2.3.0/build";
+require_once("$IP/extensions/wikiwyg/share/MediaWiki/extensions/MediaWikiWyg.php");
+require_once("$IP/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/WikiwygEditing.php");
+require_once("$IP/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/SpecialCreatePage.php");
+require_once("$IP/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/CreatePageCore.php");
+
+$dir = dirname(__FILE__);
+$wgExtensionMessagesFiles['Wikiwyg'] = $dir . '/Wikiwyg.i18n.php';
\ No newline at end of file
Property changes on: trunk/extensions/wikiwyg/Wikiwyg.php
___________________________________________________________________
Name: svn:eol-style
+ native
Index: trunk/extensions/wikiwyg/Wikiwyg.i18n.php
===================================================================
--- trunk/extensions/wikiwyg/Wikiwyg.i18n.php (revision 0)
+++ trunk/extensions/wikiwyg/Wikiwyg.i18n.php (revision 36026)
@@ -0,0 +1,244 @@
+<?php
+/**
+ * Internationalization file for Wikiwyg extension
+ *
+ * @author Jack Phoenix <wikia.jack@gmail.com>
+ * @copyright © 2008 Jack Phoenix
+ */
+
+$messages = array();
+
+/** English
+ * @author Bartek Łapiński
+ */
+$messages['en'] = array (
+ /* Createpage */
+ 'createpage' => 'Create a new article',
+ 'createpage-button' => 'Create a new article',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'title',
+ 'createpage-button-caption' => 'Create!',
+ 'createpage-title' => 'Create a new article',
+ 'createpage-categories' => 'Categories:',
+ 'createpage-title-caption' => 'Title:',
+ 'createpage-loading-mesg' => 'Loading... please wait...',
+ 'createpage-enter-text' => 'Text:',
+ 'createpage-here' => 'here',
+ 'createpage-show-cloud' => '[show category cloud]',
+ 'createpage-hide-cloud' => '[hide category cloud]',
+ 'createpage-alternate-creation' => 'or click $1 to use original editor',
+ 'createpage-categories-help' => 'Categories help organize information in this wiki. Please choose from the list below or type a new one.',
+ /* EZParser */
+ 'ezparser' => 'Simple parser test',
+ /* PocketDiff */
+ 'pocketdiff' => 'retrieves difference',
+ /* WikiwygEditing */
+ 'wikiwyg-editing-option' => 'you can switch to old editor in preferences $1',
+ 'wikiwyg-use-cloud' => ', for editing with CategoryCloud, use $1 link',
+ 'wikiwyg-editing-here' => 'here',
+ 'wikiwyg-editing-this' => 'this',
+ /* MediaWikiWyg */
+ 'wysiwygcaption' => 'Visual editing',
+ 'insertimage' => 'Insert image',
+ 'save' => 'Save',
+ 'wysiwygcaption' => 'Visual editing',
+ 'insertimage' => 'Insert image',
+ 'edit-summary' => 'Edit summary',
+ 'tog-in-page' => 'use in-page editor',
+ 'wysiwygdef' => 'wysiwyg default mode',
+ 'wikitextdef' => 'wikitext default mode',
+ 'wikiwyg-return' => 'Return to editing',
+);
+
+/** Bulgarian
+ * @author DCLXVI
+ */
+$messages['bg'] = array (
+ /* Createpage */
+ 'createpage' => 'Започване на нова страница',
+ 'createpage-button' => 'Създаване на нова страница',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'заглавие',
+ 'createpage-button-caption' => 'Създаване',
+ 'createpage-title' => 'Създаване на нова страница',
+ 'createpage-categories' => 'Категории:',
+ 'createpage-title-caption' => 'Заглавие:',
+ 'createpage-loading-mesg' => 'Зареждане... моля изчакайте...',
+ 'createpage-enter-text' => 'Текст:',
+ 'createpage-here' => 'тук',
+ 'createpage-show-cloud' => '[показване на облака с категории]',
+ 'createpage-hide-cloud' => '[скриване на облака с категории]',
+ 'createpage-alternate-creation' => 'или натиснете $1 за да използвате оригиналния редактор',
+ 'createpage-categories-help' => 'Категориите помагат организирането на информацията в това уики. Изберете от списъка по-долу или създайте нова.',
+ /* MediaWikiWyg */
+ 'save' => 'Съхранение',
+ 'edit-summary' => 'Резюме на редакцията',
+);
+
+/** German
+ * @author Rieke Hain
+ */
+$messages['de'] = array (
+ /* Createpage */
+ 'createpage' => 'Neue Seite anlegen',
+ 'createpage-button' => 'Neue Seite anlegen',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'titel',
+ 'createpage-title' => 'Neue Seite anlegen',
+ 'createpage-categories' => 'Kategorien:',
+ 'createpage-title-caption' => 'Titel:',
+ 'createpage-here' => 'hier',
+);
+
+/** Spanish (Español)
+ * @author Bola
+ */
+$messages['es'] = array (
+ /* Createpage */
+ 'createpage' => 'Crear un artículo nuevo',
+ 'createpage-button' => 'Crear un articulo nuevo',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'Título:',
+ 'createpage-button-caption' => 'Crear artículo',
+ 'createpage-title' => 'Crear un artículo nuevo',
+ 'createpage-categories' => 'Categorías:',
+ 'createpage-title-caption' => 'Título:',
+ 'createpage-loading-mesg' => 'Cargando... Espere por favor...',
+ 'createpage-enter-text' => 'Escribe tu texto aquí:',
+ 'createpage-here' => 'aquí',
+ 'createpage-show-cloud' => '[mostrar nube de categorías]',
+ 'createpage-hide-cloud' => '[esconder nube de categorías]',
+ 'createpage-alternate-creation' => 'Puedes hacer click $1 pasa usar el editor original.',
+ 'createpage-categories-help' => 'Las categorías ayudan a organizar la información de este wiki. Por favor, selecciona al menos una de la lista de más abajo o escribe una nueva.',
+ /* WikiwygEditing */
+ 'wikiwyg-editing-option' => 'o puedes utilizar el editor básico cambiando tus preferencias $1',
+ 'wikiwyg-use-cloud' => ', para la edición con CategoryCloud, utilice $1 enlace',
+ 'wikiwyg-editing-here' => 'aquí',
+ 'wikiwyg-editing-this' => 'este',
+ /* MediaWikiWyg */
+ 'save' => 'Guardar',
+ 'wysiwygcaption' => 'Visual edición',
+ 'insertimage' => 'Insertar imagen',
+ 'edit-summary' => 'Editar descripción',
+ 'tog-in-page' => 'Uso editor visual',
+ 'wysiwygdef' => 'wysiwyg modo por defecto',
+ 'wikitextdef' => 'wikitext modo por defecto',
+);
+
+/** Finnish (Suomi)
+ * @author Jack Phoenix
+ */
+$messages['fi'] = array (
+ /* Createpage */
+ 'createpage' => 'Luo uusi artikkeli',
+ 'createpage-button' => 'Luo uusi artikkeli',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'otsikko',
+ 'createpage-button-caption' => 'Luo!',
+ 'createpage-title' => 'Luo uusi artikkeli',
+ 'createpage-categories' => 'Luokat:',
+ 'createpage-title-caption' => 'Otsikko:',
+ 'createpage-loading-mesg' => 'Ladataan... odota hetki...',
+ 'createpage-enter-text' => 'Teksti:',
+ 'createpage-here' => 'tästä',
+ 'createpage-show-cloud' => '[näytä luokkapilvi]',
+ 'createpage-hide-cloud' => '[piilota luokkapilvi]',
+ 'createpage-alternate-creation' => 'tai napsauta $1 käyttääksesi alkuperästä editoria',
+ 'createpage-categories-help' => 'Luokat auttavat järjestämään tietoa tässä wikissä. Valitse allaolevasta listatsta tai kirjoita luodaksesi uuden.',
+ /* WikiwygEditing */
+ 'wikiwyg-editing-option' => 'voit vaihtaa vanhaan editoriin asetuksissasi $1',
+ 'wikiwyg-use-cloud' => ', muokataksesi luokkapilven kanssa, käytä $1 linkkiä',
+ 'wikiwyg-editing-here' => 'täällä',
+ 'wikiwyg-editing-this' => 'tätä',
+ /* MediaWikiWyg */
+ 'save' => 'Tallenna',
+ 'wysiwygcaption' => 'Visuaalinen muokkaaminen',
+ 'insertimage' => 'Lisää kuva',
+ 'edit-summary' => 'Yhteenveto',
+ 'tog-in-page' => 'Käytä visuaalista editoria',
+ 'wysiwygdef' => 'wysiwyg-oletusasetus',
+ 'wikitextdef' => 'wikitext-oletusasetus',
+ 'wikiwyg-return' => 'Palaa muokkaamaan',
+);
+
+/** Italian (Italiano)
+ * @author Godo-fuffix
+ */
+$messages['it'] = array (
+ /* Createpage */
+ 'createpage' => 'Crea un nuovo articolo',
+ 'createpage-button' => 'Crea un nuovo articolo',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'Titolo',
+ 'createpage-button-caption' => 'Crea articolo',
+ 'createpage-title' => 'Crea un nuovo articolo',
+ 'createpage-categories' => 'Categorie:',
+ 'createpage-title-caption' => 'Titolo:',
+ 'createpage-loading-mesg' => 'Caricamento... attendere prego...',
+ 'createpage-enter-text' => 'Testo:',
+ 'createpage-here' => 'qui',
+ 'createpage-show-cloud' => '[mostra le categorie]',
+ 'createpage-hide-cloud' => '[nascondi le categorie]',
+ 'createpage-alternate-creation' => 'o clicca $1 per usare l\'editor originale',
+ 'createpage-categories-help' => 'Categorie meglio organizzare le informazioni in questo sito. Si prega di scegliere dalla lista qui sotto o digitare una nuova.',
+ /* WikiwygEditing */
+ 'wikiwyg-editing-option' => 'è possibile passare al vecchio editor e preferenze $1',
+ 'wikiwyg-use-cloud' => ', per l\'editing con CategoryCloud, usa $1 link',
+ 'wikiwyg-editing-here' => 'qui',
+ 'wikiwyg-editing-this' => 'questo',
+ /* MediaWikiWyg */
+ 'save' => 'Salva',
+ 'wysiwygcaption' => 'Visual editing',
+ 'insertimage' => 'Inserire immagini',
+ 'edit-summary' => 'Riassunto',
+ 'tog-in-page' => 'uso in-page editor',
+ 'wysiwygdef' => 'wysiwyg modalità di default',
+ 'wikitextdef' => 'wikitext modalità di default',
+);
+
+/** Japanese
+ * @author Shun Fukuzawa
+ */
+$messages['ja'] = array (
+ /* Createpage */
+ 'createpage' => '新規記事を作成',
+ 'createpage-button' => '新規記事を作成',
+ 'createpage-help' => '',
+ 'createpage-caption' => '項目名',
+ 'createpage-button-caption' => '新規記事を作成!',
+ 'createpage-title' => '新規記事を作成',
+ 'createpage-categories' => 'カテゴリ:',
+ 'createpage-title-caption' => 'タイトル:',
+ 'createpage-loading-mesg' => 'ページをロードしています。少しお待ちください。',
+ 'createpage-enter-text' => '本文:',
+ 'createpage-here' => 'ここ',
+ 'createpage-show-cloud' => '[カテゴリ群を表示する]',
+ 'createpage-hide-cloud' => '[カテゴリ群を隠す]',
+ 'createpage-alternate-creation' => '従来のエディタを使うには、 $1 をクリックしてください。',
+ 'createpage-categories-help' => 'カテゴリを使うことで、このウィキアの情報を整理できます。是非とも、下のリストから選ぶか、新しいカテゴリを作成してみてください。',
+);
+
+/** Russian
+ * @author Sergey Leschina
+ */
+$messages['ru'] = array (
+ /* Createpage */
+ 'createpage' => 'Создать новую статью',
+ 'createpage-button' => 'Создать новую статью',
+ 'createpage-help' => '',
+ 'createpage-caption' => 'заголовок',
+ 'createpage-button-caption' => 'Создать!',
+ 'createpage-title' => 'Создать новую статью',
+ 'createpage-categories' => 'Категории:',
+ 'createpage-title-caption' => 'Заголовок:',
+ 'createpage-loading-mesg' => 'Загрузка… пожалуйста, подождите…',
+ 'createpage-enter-text' => 'Текст:',
+ 'createpage-here' => 'здесь',
+ 'createpage-show-cloud' => '[показать облако категорий]',
+ 'createpage-hide-cloud' => '[скрыть облако категорий]',
+ 'createpage-alternate-creation' => 'или кликните $1 , чтобы воспользоваться оригинальным редактором',
+ 'createpage-categories-help' => 'Категории помогают организовывать информацию в этой вики. Пожалуйста, выберите из списка ниже или введите новую.',
+ /* MediaWikiWyg */
+ 'insertimage' => 'Вставить изображение',
+ 'edit-summary' => 'Описание правки',
+);
\ No newline at end of file
Property changes on: trunk/extensions/wikiwyg/Wikiwyg.i18n.php
___________________________________________________________________
Name: svn:eol-style
+ native
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/CreatePageCore.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/CreatePageCore.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/CreatePageCore.php (revision 36026)
@@ -1,32 +1,30 @@
-<?
+<?php
-/*
-* @author Bartek Łapiński
-* @copyright Copyright © 2007, Wikia Inc.
-* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
-*/
+/**
+ * @author Bartek Łapiński
+ * @copyright Copyright © 2007, Wikia Inc.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
if ( ! defined( 'MEDIAWIKI' ) )
- die();
+ die();
-$wgHooks ['EditFilter'][] = 'wfCreatePageSanityCheck' ;
+$wgHooks ['EditFilter'][] = 'wfCreatePageSanityCheck';
function wfCreatePageSanityCheck () {
- global $wgRequest, $wgOut ;
+ global $wgRequest, $wgOut;
- $isCreatePage = $wgRequest->getBool ('wpCreatePage') ;
+ $isCreatePage = $wgRequest->getBool('wpCreatePage');
if ($isCreatePage) {
if ($wgRequest->getVal ('title') == '' ) {
- /* do not allow blanking Main Page each time non-js user hits 'Create Article'
+ /* do not allow blanking Main Page each time non-js user hits 'Create Article'
go back to SpecialCreatePage and display error
*/
- $titleObj = Title::makeTitle (NS_SPECIAL, 'Createpage') ;
- $wgOut->redirect ( $titleObj->getFullURL ('action=failure')) ;
- return false ;
+ $titleObj = Title::makeTitle(NS_SPECIAL, 'Createpage');
+ $wgOut->redirect ( $titleObj->getFullURL ('action=failure'));
+ return false;
}
}
- return true ;
-}
-
-?>
+ return true;
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/SpecialCreatePage.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/SpecialCreatePage.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/SpecialCreatePage.php (revision 36026)
@@ -1,54 +1,35 @@
<?php
-/*
-* A special page to create a new article, attempting to use wikiwyg, a wysiwig wikitext editor
-* @author Bartek Łapiński
-* @copyright Copyright © 2007, Wikia Inc.
-* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
-*/
+/**
+ * A special page to create a new article, attempting to use Wikiwyg, a wysiwyg wikitext editor
+ * @author Bartek Łapiński
+ * @copyright Copyright © 2007, Wikia Inc.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
if(!defined('MEDIAWIKI'))
die();
$wgExtensionFunctions[] = 'wfCreatePageSetup';
$wgExtensionCredits['specialpage'][] = array(
- 'name' => 'Create Page',
- 'author' => 'Bartek Lapinski',
- 'url' => 'http://www.wikia.com' ,
- 'description' => 'allows to create a new page - with the wysiwyg editor '
+ 'name' => 'Create Page',
+ 'author' => 'Bartek Łapiński',
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Wikiwyg',
+ 'description' => 'Allows to create a new page - with the WYSIWYG editor'
);
/* special page init */
function wfCreatePageSetup() {
- global $IP, $wgMessageCache, $wgOut ;
+ global $IP, $wgOut;
require_once($IP. '/includes/SpecialPage.php');
- /* add messages to all the translator people out there to play with */
- $wgMessageCache->addMessages(
- array(
- 'createpage' => 'Create a new article' ,
- 'createpage_button' => 'Create a new article' ,
- 'createpage_help' => '' ,
- 'createpage_caption' => 'title' ,
- 'createpage_button_caption' => 'Create!' ,
- 'createpage_title' => 'Create a new article' ,
- 'createpage_categories' => 'Categories:' ,
- 'createpage_title_caption' => 'Title:' ,
- 'createpage_loading_mesg' => 'Loading... please wait...' ,
- 'createpage_enter_text' => 'Text:' ,
- 'createpage_here' => 'here' ,
- 'createpage_show_cloud' => '[show category cloud]' ,
- 'createpage_hide_cloud' => '[hide category cloud]' ,
- 'createpage_alternate_creation' => 'or click $1 to use original editor' ,
- 'createpage_categories_help' => 'Categories help organize information in this wiki. Please choose from the list below or type a new one.'
- )
- );
SpecialPage::addPage(new SpecialPage('Createpage', '', true, 'wfCreatePageSpecial', false));
}
/* the core */
function wfCreatePageSpecial( $par ) {
- global $wgOut, $wgUser, $wgRequest, $wgServer, $wgScriptPath, $wgEnableAjaxLogin, $wgContLang ;
- require_once($IP. 'extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php') ;
+ global $IP, $wgOut, $wgUser, $wgRequest, $wgServer, $wgScriptPath, $wgEnableAjaxLogin, $wgContLang;
+ wfLoadExtensionMessages('Wikiwyg');
+ require_once("$IP/extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php");
if (! isset($wgWikiwygPath)) {
$wgWikiwygPath = "{$wgServer}/{$wgScriptPath}/extensions/wikiwyg";
@@ -67,13 +48,13 @@
/* load main js file when not loaded yet */
if (wfGetDependingOnSkin () == 0) {
if (isset($wgWysiwygEnabled) && ($wgWysiwygEnabled == true)) {
- $useWysiwygTrue = 1 ;
+ $useWysiwygTrue = 1;
} else {
- $useWysiwygTrue = 0 ;
+ $useWysiwygTrue = 0;
}
if (! isset($wgEnableAjaxLogin) || ($wgEnableAjaxLogin == false)) {
- $wgEnableAjaxLogin = 0 ;
+ $wgEnableAjaxLogin = 0;
}
$wgOut->addScript("
<script type=\"text/javascript\">
@@ -109,43 +90,44 @@
$wgOut->addScript("<script type=\"text/javascript\" src=\"$wgWikiwygJsPath/extensions/CreatePage/js/createpage.js\"></script>\n");
if (! isset($wgEnableAjaxLogin) || ($wgEnableAjaxLogin == false)) {
- $wgEnableAjaxLogin = 0 ;
+ $wgEnableAjaxLogin = 0;
}
$wgOut->addHTML ("
<script type=\"text/javascript\">
- var wgEnableAjaxLogin = $wgEnableAjaxLogin ;
+ var wgEnableAjaxLogin = $wgEnableAjaxLogin;
</script>"
) ;
- $wgOut->setPageTitle (wfMsg('createpage_title'));
- $cSF = new CreatePageForm ($par) ;
+ $wgOut->setPageTitle(wfMsg('createpage-title'));
+ $cSF = new CreatePageForm($par);
- $action = $wgRequest->getVal ('action') ;
+ $action = $wgRequest->getVal('action');
if ('success' == $action) {
/* do something */
} else if ( $wgRequest->wasPosted() && 'submit' == $action &&
- $wgUser->matchEditToken( $wgRequest->getVal ('wpEditToken') ) ) {
- $cSF->doSubmit () ;
+ $wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) ) {
+ $cSF->doSubmit();
} else if ('failure' == $action) {
- $cSF->showForm ('Please specify title') ;
+ $cSF->showForm('Please specify title');
} else if ('check' == $action) {
- $cSF->checkArticleExists ($wgRequest->getVal ('to_check')) ;
+ $cSF->checkArticleExists ($wgRequest->getVal('to_check'));
} else {
- $cSF->showForm ('') ;
+ $cSF->showForm('');
}
}
/* the form for blocking names and addresses */
class CreatePageForm {
- var $mMode, $mLink, $mDo, $mFile ;
+ var $mMode, $mLink, $mDo, $mFile;
/* constructor */
function CreatePageForm ( $par ) {
- global $wgRequest ;
+ global $wgRequest;
}
/* output */
function showForm ( $err ) {
- global $wgOut, $wgUser, $wgRequest ;
+ global $wgOut, $wgUser, $wgRequest;
+ wfLoadExtensionMessages('Wikiwyg');
if ($wgUser->isLoggedIn()) {
$token = htmlspecialchars( $wgUser->editToken() );
@@ -159,22 +141,22 @@
$wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
$wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
}
- $alternate_link = "<a href=\"#\" onclick=\"CreatePageNormalEdit(); return false;\" >".wfMsg ('createpage_here')."</a>" ;
- $wgOut->addHTML ("<div id=\"createpage_subtitle\" style=\"display:none\">".wfMsg ('createpage_alternate_creation', $alternate_link)."</div>") ;
+ $alternate_link = "<a href=\"#\" onclick=\"CreatePageNormalEdit(); return false;\" >".wfMsg('createpage-here')."</a>";
+ $wgOut->addHTML ("<div id=\"createpage_subtitle\" style=\"display:none\">".wfMsg('createpage-alternate-creation', $alternate_link)."</div>");
- $edittime = wfTimestamp(TS_MW, $this->mTimestamp) ;
+ $edittime = wfTimestamp(TS_MW, $this->mTimestamp);
/* make a TagCloud html */
- $cloud_html = "" ;
- $MyCloud = new TagCloud ;
- $num = 0 ;
+ $cloud_html = "";
+ $MyCloud = new TagCloud;
+ $num = 0;
if (is_array ($MyCloud->tags)) {
foreach ($MyCloud->tags as $name => $tag) {
$cloud_html .= ("<span id=\"tag-$num\" style=\"font-size:". $tag["size"]."pt\">
- <a href=\"#\" id=\"cloud_$num\" onclick=\"CreatePageAddCategory ('$name', $num) ; return false ;\">$name</a>
+ <a href=\"#\" id=\"cloud_$num\" onclick=\"CreatePageAddCategory ('$name', $num); return false;\">$name</a>
</span>
") ;
- $num++ ;
+ $num++;
}
}
@@ -182,24 +164,24 @@
$html = "
<form name=\"editform\" method=\"post\" action=\"{$action}\">
<div id=\"createpage_messenger\" style=\"display:none; color:red \" ></div>
- <b>".wfMsg ('createpage_title_caption')."</b>
+ <b>".wfMsg('createpage-title-caption')."</b>
<br />
<input name=\"title\" id=\"title\" value=\"\" size=\"100\" /><br /><br />
- <b>".wfMsg ('createpage_enter_text')."</b>
+ <b>".wfMsg('createpage-enter-text')."</b>
<br /><div id=\"wikiwyg\"></div>
- <div id=\"loading_mesg\"><b>".wfMsg('createpage_loading_mesg')."</b></div>
+ <div id=\"loading_mesg\"><b>".wfMsg('createpage-loading-mesg')."</b></div>
<noscript>
<style type=\"text/css\">
#loading_mesg, #image_upload {
- display: none ;
+ display: none;
}
</style>
<textarea tabindex=\"1\" accesskey=\",\" name=\"wpTextbox1\" id=\"wpTextbox1\" rows=\"25\" cols=\"80\" ></textarea>
</noscript>
<div id=\"backup_textarea_placeholder\"></div>
<iframe id=\"wikiwyg-iframe\" height=\"0\" width=\"0\" frameborder=\"0\"></iframe>
- <input type=\"submit\" name=\"wpSave\" id=\"wpSaveBottom\" value=\"".wfMsg ('createpage_button_caption') ."\" />
+ <input type=\"submit\" name=\"wpSave\" id=\"wpSaveBottom\" value=\"".wfMsg('createpage-button-caption')."\" />
<input type='hidden' name='wpEditToken' value=\"{$token}\" />
<input type=\"hidden\" name=\"wpCreatePage\" value=\"true\" />
@@ -209,10 +191,10 @@
<table id=\"editpage_table\">
<tr style=\"padding: 6px 0px 6px 0px\">
<td class=\"editpage_header\"> </td>
- <td>".wfMsg ('createpage_categories_help')."</td>
+ <td>".wfMsg('createpage-categories-help')."</td>
</tr>
<tr>
- <td class=\"editpage_header\">".wfMsg ('createpage_categories')."</td>
+ <td class=\"editpage_header\">".wfMsg('createpage-categories')."</td>
<td>
<textarea name=\"category\" id=\"category\" rows=\"1\" cols=\"80\" /></textarea>
<div id=\"category_cloud_wrapper\" class=\editpage_inside\">
@@ -220,55 +202,51 @@
</div>
</td>
</tr>
- </table>" ;
+ </table>";
- $wgOut->addHtml( $html );
- $wgOut->addHTML ("
- </div><br />
-</form>"
- );
+ $wgOut->addHTML( $html );
+ $wgOut->addHTML("</div><br /></form>");
}
/* draws select and selects it properly */
function makeSelect ($name, $options_array, $current, $tabindex) {
- global $wgOut ;
- $wgOut->addHTML ("<select tabindex=\"$tabindex\" name=\"$name\" id=\"$name\">") ;
+ global $wgOut;
+ $wgOut->addHTML ("<select tabindex=\"$tabindex\" name=\"$name\" id=\"$name\">");
foreach ($options_array as $key => $value) {
if ($value == $current )
- $wgOut->addHTML ("<option value=\"$value\" selected=\"selected\">$key</option>") ;
+ $wgOut->addHTML("<option value=\"$value\" selected=\"selected\">$key</option>");
else
- $wgOut->addHTML ("<option value=\"$value\">$key</option>") ;
+ $wgOut->addHTML("<option value=\"$value\">$key</option>");
}
- $wgOut->addHTML ("</select>") ;
+ $wgOut->addHTML("</select>");
}
/* check if article exists */
function checkArticleExists ($given) {
- global $wgOut ;
+ global $wgOut;
$wgOut->setArticleBodyOnly( true );
$title = Title::newFromText( $given );
- $page = $title->getText () ;
- $page = str_replace( ' ', '_', $page ) ;
- $dbr =& wfGetDB (DB_SLAVE);
- $exists = $dbr->selectField ('page', 'page_title', array ('page_title' => $page)) ;
+ $page = $title->getText();
+ $page = str_replace( ' ', '_', $page );
+ $dbr = wfGetDB (DB_SLAVE);
+ $exists = $dbr->selectField ('page', 'page_title', array ('page_title' => $page));
if ($exists != '')
$wgOut->addHTML('pagetitleexists');
}
/* on success */
function showSuccess () {
- global $wgOut, $wgRequest ;
- $wgOut->setPageTitle (wfMsg('createpage_success_title') ) ;
- $wgOut->setSubTitle(wfMsg('createpage_success_subtitle')) ;
+ global $wgOut, $wgRequest;
+ wfLoadExtensionMessages('Wikiwyg');
+ $wgOut->setPageTitle (wfMsg('createpage-success-title') );
+ $wgOut->setSubTitle(wfMsg('createpage-success-subtitle'));
}
-
/* on submit */
function doSubmit () {
- global $wgOut, $wgUser, $wgRequest ;
- $wgOut->setSubTitle ( wfMsg ('createpage_success_subtitle', wfMsg('createpage_'.$this->mMode) ) ) ;
+ global $wgOut, $wgUser, $wgRequest;
+ wfLoadExtensionMessages('Wikiwyg');
+ $wgOut->setSubTitle ( wfMsg ('createpage-success-subtitle', wfMsg('createpage-'.$this->mMode) ) );
}
-}
-
-?>
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/js/createpage.js
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/js/createpage.js (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/CreatePage/js/createpage.js (revision 36026)
@@ -13,59 +13,58 @@
// copied and adapted from phpBB
function insertTags(tagOpen, tagClose, sampleText) {
if (WikiwygInstance.enabled) {
- var out = WikiwygInstance.current_mode ;
- out.insert_html (tagOpen + sampleText + tagClose) ;
+ var out = WikiwygInstance.current_mode;
+ out.insert_html (tagOpen + sampleText + tagClose);
}
}
/* fall back if edit mode not supported - provide a normal interface */
function CreatePageFallBack () {
- var loading_mesg = document.getElementById ('loading_mesg') ;
- loading_mesg.style.display = 'none' ;
- var input1 = document.createElement ('textarea') ;
- input1.setAttribute ('name','wpTextbox1') ;
- input1.setAttribute ('id','wpTextbox1') ;
- input1.setAttribute ('rows', 25) ;
- input1.setAttribute ('cols', 80) ;
- var backup_txt = document.getElementById ('backup_textarea_placeholder') ;
- backup_txt.appendChild (input1) ;
+ var loading_mesg = document.getElementById ('loading_mesg');
+ loading_mesg.style.display = 'none';
+ var input1 = document.createElement ('textarea');
+ input1.setAttribute ('name','wpTextbox1');
+ input1.setAttribute ('id','wpTextbox1');
+ input1.setAttribute ('rows', 25);
+ input1.setAttribute ('cols', 80);
+ var backup_txt = document.getElementById ('backup_textarea_placeholder');
+ backup_txt.appendChild (input1);
/* todo give standard edit toolbar - mainly for Opera users */
}
+document.insertTags = insertTags;
-document.insertTags = insertTags ;
-
/* modified function for image upload (omitting HACK section for non-existing watchthis link )*/
var imageUploadDialog = null;
/* provide an old-way edit */
function CreatePageNormalEdit () {
- var title = document.getElementById ('title') ;
- var error_msg = document.getElementById ('createpage_messenger') ;
+ var title = document.getElementById ('title');
+ var error_msg = document.getElementById ('createpage_messenger');
if (title.value == '') {
- error_msg.innerHTML = 'Please specify title first' ;
- error_msg.style.display = '' ;
- return ;
+ error_msg.innerHTML = 'Please specify title first';
+ error_msg.style.display = '';
+ return;
}
/* check for unsaved changes (they will always be *unsaved* here... ) */
- var textarea = WikiwygInstance.current_mode.get_edit_document().body.innerHTML ;
- textarea = textarea.replace ("<br>", "") ;
+ var textarea = WikiwygInstance.current_mode.get_edit_document().body.innerHTML;
+ textarea = textarea.replace ("<br>", "");
if (textarea != "") {
- var abandon_changes = confirm ("You have unsaved changes. Clicking OK will result in abandoning them.","Unsaved changes") ;
+ var abandon_changes = confirm ("You have unsaved changes. Clicking OK will result in abandoning them.","Unsaved changes");
if (!abandon_changes) {
- return ;
+ return;
}
}
- var fixed_article_path = wgArticlePath.replace ('$1','') ;
- fixed_article_path = fixed_article_path.replace ('index.php[^\/]','index.php?title=') ;
- window.location = fixed_article_path + title.value + '?action=edit' ;
+ var fixed_article_path = wgArticlePath.replace ('$1','');
+ fixed_article_path = fixed_article_path.replace ('index.php[^\/]','index.php?title=');
+ window.location = fixed_article_path + title.value + '?action=edit';
}
function fixupRelativeUrl(url) {
var loc = String(location);
if (loc.match (/\?index\.php/i) != '') {
var base = loc.replace (/&action=.*$/i, '');
- return base ;
+ return base;
} else {
var base = loc.replace(/index\.php.*/, '');
if (base == loc)
@@ -77,50 +76,50 @@
}
function CreatePageShowSection (section) {
- var this_section = document.getElementById ('createpage_' + section + '_section') ;
- var show_this = document.getElementById ('createpage_show_' + section) ;
- var hide_this = document.getElementById ('createpage_hide_' + section) ;
+ var this_section = document.getElementById ('createpage_' + section + '_section');
+ var show_this = document.getElementById ('createpage_show_' + section);
+ var hide_this = document.getElementById ('createpage_hide_' + section);
- this_section.style.display = '' ;
- show_this.style.display = 'none' ;
- hide_this.style.display = '' ;
+ this_section.style.display = '';
+ show_this.style.display = 'none';
+ hide_this.style.display = '';
}
function CreatePageHideSection (section) {
- var this_section = document.getElementById ('createpage_' + section + '_section') ;
- var show_this = document.getElementById ('createpage_show_' + section) ;
- var hide_this = document.getElementById ('createpage_hide_' + section) ;
+ var this_section = document.getElementById ('createpage_' + section + '_section');
+ var show_this = document.getElementById ('createpage_show_' + section);
+ var hide_this = document.getElementById ('createpage_hide_' + section);
- this_section.style.display = 'none' ;
- show_this.style.display = '' ;
- hide_this.style.display = 'none' ;
+ this_section.style.display = 'none';
+ show_this.style.display = '';
+ hide_this.style.display = 'none';
}
function CreatePageAddCategory (category, num) {
if (category != '') {
if (document.editform.category.value == '') {
- document.editform.category.value += category ;
+ document.editform.category.value += category;
} else {
- document.editform.category.value += ',' + category ;
+ document.editform.category.value += ',' + category;
}
/* change colour */
- this_button = document.getElementById ('cloud_'+ num) ;
- this_span = document.getElementById ('tag-' + num) ;
+ this_button = document.getElementById ('cloud_'+ num);
+ this_span = document.getElementById ('tag-' + num);
this_button.onclick = function() { eval("CreatePageRemoveCategory('" + category + "', " + num + ")"); return false };
- this_button.style["color"] = "#419636" ;
+ this_button.style["color"] = "#419636";
}
}
function CreatePageRemoveCategory (category, num) {
- category_text = document.editform.category.value ;
- this_pos = category_text.indexOf(category) ;
+ category_text = document.editform.category.value;
+ this_pos = category_text.indexOf(category);
if (this_pos != -1) {
- category_text = category_text.substr (0, this_pos-1 ) + category_text.substr (this_pos + category.length) ;
- document.editform.category.value = category_text ;
+ category_text = category_text.substr (0, this_pos-1 ) + category_text.substr (this_pos + category.length);
+ document.editform.category.value = category_text;
}
- this_button = document.getElementById ('cloud_'+ num) ;
+ this_button = document.getElementById ('cloud_'+ num);
this_button.onclick = function() { eval("CreatePageAddCategory('" + category + "', " + num + ")"); return false };
- this_button.style["color"] = "" ;
+ this_button.style["color"] = "";
}
function CreatePageShowThrobber (text) {
@@ -135,16 +134,16 @@
window.onload = function() {
- var WikiwygDiv = document.getElementById ('wikiwyg') ;
- var category_wrapper = document.getElementById ('category_wrapper') ;
- var subtitle = document.getElementById ('contentSub') ;
- var cp_subtitle = document.getElementById ('createpage_subtitle') ;
- subtitle.innerHTML = cp_subtitle.innerHTML ;
+ var WikiwygDiv = document.getElementById ('wikiwyg');
+ var category_wrapper = document.getElementById ('category_wrapper');
+ var subtitle = document.getElementById ('contentSub');
+ var cp_subtitle = document.getElementById ('createpage_subtitle');
+ subtitle.innerHTML = cp_subtitle.innerHTML;
CreatePageShowThrobber ('') ;
- category_wrapper.style.display = 'block' ;
+ category_wrapper.style.display = 'block';
var WikiwygConfig = {
- doubleClickToEdit: true ,
- editHeightMinimum: 300 ,
+ doubleClickToEdit: true,
+ editHeightMinimum: 300,
wysiwyg: {
iframeId: 'wikiwyg-iframe'
},
@@ -176,90 +175,90 @@
]
},
modeClasses: [
- 'Wikiwyg.Wysiwyg.Custom' ,
+ 'Wikiwyg.Wysiwyg.Custom',
'Wikiwyg.Wikitext.Custom'
]
} ;
- WikiwygInstance = new Wikiwyg.Test ();
+ WikiwygInstance = new Wikiwyg.Test();
WikiwygInstance.createWikiwygArea(WikiwygDiv, WikiwygConfig);
if (WikiwygInstance.enabled) {
setTimeout("WikiwygInstance.editMode();",400);
} else {
- CreatePageFallBack () ;
+ CreatePageFallBack();
}
- document.getElementById ('loading_mesg').style.display = 'none' ;
+ document.getElementById ('loading_mesg').style.display = 'none';
// register edit page
- var CreatePageLinkBottom = document.getElementById ('wpSaveBottom') ;
- var self = WikiwygInstance ;
+ var CreatePageLinkBottom = document.getElementById ('wpSaveBottom');
+ var self = WikiwygInstance;
CreatePageLinkBottom.onclick = function() { eval('WikiwygInstance.saveChanges()'); return false };
- CreatePageHideThrobber ('') ;
+ CreatePageHideThrobber('');
}
proto = new Subclass('Wikiwyg.Test', 'Wikiwyg');
proto.modeClasses = [
- 'Wikiwyg.Wysiwyg.Custom',
+ 'Wikiwyg.Wysiwyg.Custom',
'Wikiwyg.Wikitext.Custom'
];
proto.saveChanges = function () {
if (!this.checkContents()) {
- return false ;
+ return false;
}
- var title = document.getElementById ('title') ;
+ var title = document.getElementById ('title');
if (!this.checkIfArticleExists (title.value)) {
- return false ;
+ return false;
}
}
proto.imageUpload = function (tagOpen, tagClose, sampleText) {
- Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText) ;
+ Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText);
}
proto.checkContents = function () {
- var error_msg = document.getElementById ('createpage_messenger') ;
- var title = document.getElementById ('title') ;
- article_text = this.current_mode.get_edit_document().body.innerHTML ;
- article_text = article_text.replace(/<br[^>]+./gi,"<br>") ;
+ var error_msg = document.getElementById ('createpage_messenger');
+ var title = document.getElementById ('title');
+ article_text = this.current_mode.get_edit_document().body.innerHTML;
+ article_text = article_text.replace(/<br[^>]+./gi,"<br>");
// article_text = article_text.replace(/<br><br>/gi,"<p>") ;
var class_name = this.config.modeClasses[1];
var mode_object = this.mode_objects[class_name];
- article_text = mode_object.convert_html_to_wikitext(article_text) ;
+ article_text = mode_object.convert_html_to_wikitext(article_text);
if ( (title.value == '') || (article_text == '') ) {
- error_msg.innerHTML = "You need to specify both title and some content to create an article." ;
- error_msg.style.display = 'block' ;
- return false ;
+ error_msg.innerHTML = "You need to specify both title and some content to create an article.";
+ error_msg.style.display = 'block';
+ return false;
}
- return true ;
+ return true;
}
proto.checkIfArticleExists = function (article) {
- CreatePageShowThrobber ('') ;
+ CreatePageShowThrobber('');
WKWAjax.post (
- fixupRelativeUrl('Special:Createpage') ,
- 'action=check&to_check=' + article ,
+ fixupRelativeUrl('Special:Createpage'),
+ 'action=check&to_check=' + article,
function (response) {
WikiwygInstance.handleArticleExistsResponse (response)
}
- ) ;
+ );
}
proto.handleArticleExistsResponse = function (response) {
if (response.indexOf("pagetitleexists") != -1) {
- var error_msg = document.getElementById ('createpage_messenger') ;
- var title = document.getElementById ('title') ;
- error_msg.innerHTML = "That title already exists. Please choose another title." ;
- error_msg.style.display = 'block' ;
- CreatePageHideThrobber ('') ;
- return false ;
+ var error_msg = document.getElementById ('createpage_messenger');
+ var title = document.getElementById ('title');
+ error_msg.innerHTML = "That title already exists. Please choose another title.";
+ error_msg.style.display = 'block';
+ CreatePageHideThrobber('');
+ return false;
} else {
/* select wikitext mode */
var class_name = this.config.modeClasses[1];
var mode_object = this.mode_objects[class_name];
- this.current_mode.saveChanges (mode_object) ;
- CreatePageHideThrobber ('') ;
- return true ;
+ this.current_mode.saveChanges (mode_object);
+ CreatePageHideThrobber('');
+ return true;
}
}
@@ -295,35 +294,35 @@
}
proto.saveChanges = function (mode) {
- var title = document.getElementById ('title') ;
- document.editform.action= wgScriptPath + "/index.php?title=" + title.value + "&action=submit" ;
- this.disableCreateButtons () ;
- var input1 = document.createElement ('input') ;
- input1.setAttribute ('name','wpTextbox1') ;
- input1.setAttribute ('id','wpTextbox1') ;
- input1.setAttribute ('type','hidden') ;
- document.editform.appendChild (input1) ;
- var article_text = this.get_edit_document().body.innerHTML ;
- article_text = article_text.replace(/<br[^>]+./gi,"<br>") ;
- article_text = article_text.replace(/<br><br>/gi,"<p>") ;
- article_text = mode.convert_html_to_wikitext(article_text) ;
- document.editform.wpTextbox1.value = article_text ;
- this.getCategories () ;
- document.editform.submit() ;
+ var title = document.getElementById ('title');
+ document.editform.action= wgScriptPath + "/index.php?title=" + title.value + "&action=submit";
+ this.disableCreateButtons();
+ var input1 = document.createElement ('input');
+ input1.setAttribute ('name','wpTextbox1');
+ input1.setAttribute ('id','wpTextbox1');
+ input1.setAttribute ('type','hidden');
+ document.editform.appendChild (input1);
+ var article_text = this.get_edit_document().body.innerHTML;
+ article_text = article_text.replace(/<br[^>]+./gi,"<br>");
+ article_text = article_text.replace(/<br><br>/gi,"<p>");
+ article_text = mode.convert_html_to_wikitext(article_text);
+ document.editform.wpTextbox1.value = article_text;
+ this.getCategories();
+ document.editform.submit();
}
proto.getCategories = function () {
/* get categories separated by commas */
- var categories = document.getElementById ('category').value ;
- categories = categories.split (",") ;
+ var categories = document.getElementById ('category').value;
+ categories = categories.split (",");
for (i=0;i<categories.length;i++) {
- this.addCategory (categories[i]) ;
+ this.addCategory (categories[i]);
}
}
proto.addCategory = function (text) {
if (text != '') {
- document.editform.wpTextbox1.value += '[[Category:'+text+']]' ;
+ document.editform.wpTextbox1.value += '[[Category:'+text+']]';
}
}
@@ -341,16 +340,16 @@
}
proto.do_youtube = function () {
- this.make_do ('youtube') ;
+ this.make_do ('youtube');
}
Wikiwyg.Wysiwyg.prototype.do_wikify = function() {
var selection = this.get_link_selection_text();
- if (!selection) return ;
- var self = this ;
+ if (!selection) return;
+ var self = this;
WKWAjax.post (
- fixupRelativeUrl('Special:Createpage') ,
- 'action=check&to_check=' + selection ,
+ fixupRelativeUrl('Special:Createpage'),
+ 'action=check&to_check=' + selection,
function (response) {
if (response.indexOf("pagetitleexists") != -1) {
link_color = "26579A";
@@ -379,12 +378,12 @@
if (Wikiwyg.is_ie) {
//hack to remember Caret Position in IE
this.ieRange = this.get_edit_document().selection.createRange();
- this.ieRange.moveStart ('character', -this.get_inner_html().length) ;
+ this.ieRange.moveStart ('character', -this.get_inner_html().length);
this.ieCaretPos = this.ieRange.text.length;
}
var url = prompt("Add YouTube Video. Copy and paste the video's URL or Embed code.", "");
- if (url == null) return ;
+ if (url == null) return;
if(Wikiwyg.is_ie){
// Move selection start and end to 0 position
@@ -393,9 +392,9 @@
// Move selection start and end to desired position
self.ieRange.moveStart ('character', self.ieCaretPos);
self.ieRange.moveEnd ('character', 0);
- self.ieRange.select ();
+ self.ieRange.select();
}
- this.insert_youtube(url) ;
+ this.insert_youtube(url);
}
Wikiwyg.Wysiwyg.Custom.prototype.extract_youtube_id = function(youTubeCode) {
@@ -426,26 +425,26 @@
proto.format_table = function(element) {
this.insert_new_line();
- this.appendOutput ('{|') ;
- this.assert_blank_line() ;
+ this.appendOutput('{|') ;
+ this.assert_blank_line();
this.walk(element);
- this.assert_blank_line() ;
- this.appendOutput ('|}') ;
+ this.assert_blank_line();
+ this.appendOutput('|}');
this.insert_new_line();
}
proto.format_tr = function(element) {
- this.appendOutput('|-') ;
- this.assert_new_line() ;
- this.appendOutput('|') ;
- this.walk(element) ;
- this.assert_blank_line() ;
- this.assert_new_line() ;
+ this.appendOutput('|-');
+ this.assert_new_line();
+ this.appendOutput('|');
+ this.walk(element);
+ this.assert_blank_line();
+ this.assert_new_line();
}
proto.format_br = function (element) {
- this.insert_new_line () ;
- this.insert_new_line () ;
+ this.insert_new_line();
+ this.insert_new_line();
}
proto.format_p = function(element) {
@@ -466,7 +465,6 @@
this.appendOutput('||');
}
-
proto.format_div = function(element) {
if (! this.previous_was_newline_or_start())
this.insert_new_line();
@@ -475,7 +473,6 @@
this.assert_blank_line();
}
-
proto.normalizeDomWhitespace = function(dom) {
Wikiwyg.Wikitext.prototype.normalizeDomWhitespace.call(this, dom);
var tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li'];
@@ -514,5 +511,4 @@
hr: ['line_alone', '----'],
table: ['line_alone', '{ | A | B | C |\n| | | |\n| | | | }']
}
-}
-
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/MediaWikiWyg.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/MediaWikiWyg.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/MediaWikiWyg.php (revision 36026)
@@ -1,75 +1,66 @@
-<?PHP
+<?php
-global $wgHooks, $wgInPageEnabled ;
- if (!isset($wgInPageEnabled) || ($wgInPageEnabled == false)) {
- return ;
- }
+global $wgHooks, $wgInPageEnabled;
+ if (!isset($wgInPageEnabled) || ($wgInPageEnabled == false)) {
+ return;
+ }
-$wgHooks['ParserBeforeTidy'][] = 'beforeTidyHook' ;
-$wgHooks['UserToggles'][] = 'wfWikiwygToggle' ;
-$wgHooks['handleWikiPrefs'][] = 'wfWikiwygHandleEditingPrefs' ;
-$wgHooks['getEditingPreferencesTab'][] = 'wfWikiwygAddEditingPrefs' ;
+$wgHooks['ParserBeforeTidy'][] = 'beforeTidyHook';
+$wgHooks['UserToggles'][] = 'wfWikiwygToggle';
+$wgHooks['handleWikiPrefs'][] = 'wfWikiwygHandleEditingPrefs';
+$wgHooks['getEditingPreferencesTab'][] = 'wfWikiwygAddEditingPrefs';
$wgExtensionFunctions[] = 'registerWikiwygExtension';
$wgExtensionCredits['other'][] = array(
- 'name' => 'MediaWikiWyg',
- 'author' => 'http://svn.wikiwyg.net/code/trunk/wikiwyg/AUTHORS, Bartek Lapinski',
- 'version' => 0.20,
- 'url' => 'http://www.wikiwyg.net, http://www.wikia.com',
- 'description' => 'Mediawiki integration of the Wikiwyg WYSIWYG wiki editor'
+ 'name' => 'MediaWikiWyg',
+ 'author' => array('http://svn.wikiwyg.net/code/trunk/wikiwyg/AUTHORS', 'Bartek Łapiński'),
+ 'version' => 0.20,
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Wikiwyg',
+ 'description' => 'MediaWiki integration of the Wikiwyg WYSIWYG wiki editor'
);
function wfGetDependingOnSkin () {
- $useInPageTrue = '' ;
- global $wgCookiePrefix, $wgUser, $wgInPageEnabled ;
-
+ $useInPageTrue = '';
+ global $wgCookiePrefix, $wgUser, $wgInPageEnabled;
+
/* do not forget about editor disabled from variable... */
if (!$wgInPageEnabled || !isset ($wgInPageEnabled)) {
- return 0 ;
+ return 0;
}
if ($wgUser->getOption ('in-page', 2) == 2) {
- $skin = $wgUser->getSkin() ;
+ $skin = $wgUser->getSkin();
if (is_object ($skin)){
/* forget about the _real_ skinname - it's not loaded yet */
- $skinname = get_class ($skin) ;
+ $skinname = get_class($skin);
/*
if (($skinname == 'SkinMonoBook') ) {
return 1 ;
} else {
return 0 ;
}*/
- return 1 ;
+ return 1;
} else {
- return 0 ;
+ return 0;
}
} else {
- return $wgUser->getOption ('in-page', 1) ;
+ return $wgUser->getOption ('in-page', 1);
}
}
function registerWikiwygExtension() {
- global $wgOut,$wgSkin,$jsdir,$cssdir, $wgScriptPath ;
- global $wgWikiwygPath, $wgUser, $wgTitle ;
- global $wgServer,$wgWikiwygJsPath,$wgWikiwygCssPath,$wgWikiwygImagePath;
- global $wgRequest, $wgWysiwygEnabled, $wgMessageCache ;
- global $wgLang, $wgContLang, $wgEnableAjaxLogin ;
+ global $wgOut, $wgSkin, $jsdir, $cssdir, $wgScriptPath;
+ global $wgWikiwygPath, $wgUser, $wgTitle;
+ global $wgServer, $wgWikiwygJsPath, $wgWikiwygCssPath, $wgWikiwygImagePath;
+ global $wgRequest, $wgWysiwygEnabled, $wgMessageCache;
+ global $wgLang, $wgContLang, $wgEnableAjaxLogin;
+ wfLoadExtensionMessages('Wikiwyg');
+
if (wfGetDependingOnSkin () == 0) {
- return ;
+ return;
}
- $wgMessageCache->addMessages(
- array(
- 'wysiwygcaption' => 'Visual editing' ,
- 'insertimage' => 'Insert image' ,
- 'save' => 'Save' ,
- 'wysiwygcaption' => 'Visual editing' ,
- 'insertimage' => 'Insert image' ,
- 'edit-summary' => 'Edit summary'
- )
- );
-
if (! isset($wgWikiwygPath)) {
$wgWikiwygPath = $wgScriptPath . "/extensions/wikiwyg";
}
@@ -85,13 +76,13 @@
$wgOut->addScript("<style type=\"text/css\" media=\"screen,projection\">/*<![CDATA[*/ @import \"$wgWikiwygCssPath/MediaWikiwyg.css\"; /*]]>*/</style>\n");
if (isset($wgWysiwygEnabled) && ($wgWysiwygEnabled == true)) {
- $useWysiwygTrue = 1 ;
+ $useWysiwygTrue = 1;
} else {
- $useWysiwygTrue = 0 ;
+ $useWysiwygTrue = 0;
}
if (! isset($wgEnableAjaxLogin) || ($wgEnableAjaxLogin == false)) {
- $wgEnableAjaxLogin = 0 ;
+ $wgEnableAjaxLogin = 0;
}
@@ -145,19 +136,19 @@
function wfDetermineStartingLevel ($text) {
for ($i = 0; $i < 8 ; $i++) {
if ( preg_match ('/<h'.$i.'>/i', $text) ) {
- return $i ;
+ return $i;
}
}
- return "NONE" ;
+ return "NONE";
}
function wfDetermineNextLevel ($level, $text) {
for ($i = $level + 1; $i < 8; $i++) {
if ( preg_match ('/<h'.$i.'>/i', $text) ) {
- return $i ;
+ return $i;
}
}
- return "NONE" ;
+ return "NONE";
}
/* parse recurrently depending on current header level */
@@ -170,7 +161,7 @@
$i = 0;
$full = array_shift($blocks);
- $header_block = "" ;
+ $header_block = "";
foreach ($blocks as $block) {
/* now, _this_ is an edit link */
if (preg_match('/<h'.$level.'><span class="editsection".*?<\/span>/i', $block)) {
@@ -183,8 +174,8 @@
/* now, this is a real edit link... */
$i++;
/* extract the _real_ section number */
- preg_match ('/section=[0-9]+/',$inner_block, $section_number) ;
- $section_number = substr ($section_number[0], 8) ;
+ preg_match ('/section=[0-9]+/',$inner_block, $section_number);
+ $section_number = substr ($section_number[0], 8);
$full .= "<span class='wikiwyg_edit' id=\"wikiwyg_edit_{$section_number}\">
$inner_block
</span>
@@ -192,9 +183,9 @@
} else {
/* not an edit link... */
if (!preg_match('/<h'.$level.'>/i', $inner_block)) {
- $full .= $inner_block ;
+ $full .= $inner_block;
} else {
- $header_block = $inner_block ;
+ $header_block = $inner_block;
}
}
}
@@ -205,7 +196,7 @@
die("Wrong order!");
}
/* correct next level to actually match next level... */
- $next_level = wfDetermineNextLevel ($level - 1,$block) ;
+ $next_level = wfDetermineNextLevel ($level - 1,$block);
if (preg_match('/<h'.$next_level.'>/i',$block)) {
/* investigate matter further - there may be subsections */
/* we found more sections - split it up, add the main thing and go deeper */
@@ -213,15 +204,15 @@
'/(<\/h'.$level.'>)/i',
$block, -1, PREG_SPLIT_DELIM_CAPTURE
);
- $block = '' ;
- $block .= $blocked_splits[0].$blocked_splits[1] ;
- $block .= wfRecurrentParse($blocked_splits[2], $next_level) ;
+ $block = '';
+ $block .= $blocked_splits[0].$blocked_splits[1];
+ $block .= wfRecurrentParse($blocked_splits[2], $next_level);
}
/* split it up further to insert the throbber - we need to put it after mw-headline */
- $full .= "<span class=\"wikiwyg_section\" id=\"wikiwyg_section_{$section_number}\">$header_block" ;
- $full .= $block ;
- $full .= "
+ $full .= "<span class=\"wikiwyg_section\" id=\"wikiwyg_section_{$section_number}\">$header_block";
+ $full .= $block;
+ $full .= "
</span>
<iframe class='wikiwyg_iframe'
id=\"wikiwyg_iframe_{$section_number}\"
@@ -231,18 +222,19 @@
";
}
}
- return $full ;
+ return $full;
}
-function beforeTidyHook($parser,$text) {
- global $wgServer, $wgScriptPath, $wgUser ;
- if ($wgUser->getOption ('in-page', 1) == 0 ) return ;
- $wgScriptPath != "" ? $fixedPath = $wgServer."/".$wgScriptPath : $fixedPath = $wgServer ;
+function beforeTidyHook($parser, $text) {
+ global $wgServer, $wgScriptPath, $wgUser;
+ if ($wgUser->getOption ('in-page', 1) == 0 ) return;
+ $wgScriptPath != "" ? $fixedPath = $wgServer."/".$wgScriptPath : $fixedPath = $wgServer;
/* stuff changed in MW 1.9.3, the order of elements is different now */
/* one more interesting thing - determine the maximum depth of the headers
(remember, MW uses level 2 headers as suggested ones...) */
- $starting_level = wfDetermineStartingLevel ($text) ;
- $text = wfRecurrentParse ($text, $starting_level, 0) ;
+ $starting_level = wfDetermineStartingLevel($text);
+ $text = wfRecurrentParse ($text, $starting_level, 0);
+ return true;
}
# Not a valid entry point, skip unless MEDIAWIKI is defined
@@ -253,10 +245,10 @@
global $IP;
require_once( $IP.'/includes/SpecialPage.php' );
-class EZParser extends UnlistedSpecialPage
-{
+class EZParser extends UnlistedSpecialPage {
function EZParser() {
UnlistedSpecialPage::UnlistedSpecialPage('EZParser');
+ wfLoadExtensionMessages('Wikiwyg');
}
function execute( $par ) {
@@ -272,9 +264,9 @@
$this->setHeaders();
- $text = $wgRequest->getText ('text') ;
- $title = $wgRequest->getText ('rtitle') ;
- $namespace = $wgRequest->getText ('rnamespace') ;
+ $text = $wgRequest->getText('text');
+ $title = $wgRequest->getText('rtitle');
+ $namespace = $wgRequest->getText('rnamespace');
if ( $text ) {
$this->parseText( $text, $title );
@@ -284,42 +276,39 @@
}
function parseText($text, $title){
- #still need to make it actually parse the input.
- global $wgOut, $wgUser, $wgTitle, $wgParser, $wgAllowDiffPreview, $wgEnableDiffPreviewPreference;
-$parserOptions = ParserOptions::newFromUser( $wgUser );
- $parserOptions->setEditSection( false );
- $rtitle = Title::newFromText ($title) ;
+ #still need to make it actually parse the input.
+ global $wgOut, $wgUser, $wgTitle, $wgParser, $wgAllowDiffPreview, $wgEnableDiffPreviewPreference;
+ $parserOptions = ParserOptions::newFromUser( $wgUser );
+ $parserOptions->setEditSection( false );
+ $rtitle = Title::newFromText($title);
- $pre_parsed = $wgParser->preSaveTransform ($text, $rtitle, $wgUser, $parserOptions, true) ;
- $output = $wgParser->parse( $pre_parsed, $rtitle, $parserOptions );
- $wgOut->setArticleBodyOnly( true );
+ $pre_parsed = $wgParser->preSaveTransform ($text, $rtitle, $wgUser, $parserOptions, true) ;
+ $output = $wgParser->parse( $pre_parsed, $rtitle, $parserOptions );
+ $wgOut->setArticleBodyOnly( true );
-# Here we filter the output. If there's a section header in the beginning,
-# we'll have an empty wikiwyg_section_0 div, and we do not want it.
-# So we strip the empty span out.
+ # Here we filter the output. If there's a section header in the beginning,
+ # we'll have an empty wikiwyg_section_0 div, and we do not want it.
+ # So we strip the empty span out.
- $goodHTML = str_replace("<span class=\"wikiwyg_section_0\">\n<p><!-- before block -->\n</p><p><br />\n</p><p><!-- After block -->\n</p>\n</span><iframe class=\"wikiwyg_iframe\" id=\"wikiwyg_iframe_0\" height='0' width='0' frameborder='0'></iframe>", "", $output->mText) ;
- /* manually strip away TOC */
- $goodHTML = preg_replace ('/<table id="toc".*<\/table>*.<script type="text\/javascript"> if \(window\.showTocToggle\).*<\/script>/is', "", $goodHTML) ;
- $wgOut->addHTML($goodHTML) ;
+ $goodHTML = str_replace("<span class=\"wikiwyg_section_0\">\n<p><!-- before block -->\n</p><p><br />\n</p><p><!-- After block -->\n</p>\n</span><iframe class=\"wikiwyg_iframe\" id=\"wikiwyg_iframe_0\" height='0' width='0' frameborder='0'></iframe>", "", $output->mText);
+ /* manually strip away TOC */
+ $goodHTML = preg_replace ('/<table id="toc".*<\/table>*.<script type="text\/javascript"> if \(window\.showTocToggle\).*<\/script>/is', "", $goodHTML);
+ $wgOut->addHTML($goodHTML);
}
}
-global $wgMessageCache;
SpecialPage::addPage( new EZParser );
-$wgMessageCache->addMessage( 'ezparser', 'Simple parser test' );
-
}
-$wgExtensionFunctions[] = 'wfPocketDiff' ;
+$wgExtensionFunctions[] = 'wfPocketDiff';
function wfPocketDiff () {
global $IP;
require_once( $IP.'/includes/SpecialPage.php' );
-class PocketDiff extends UnlistedSpecialPage
-{
+class PocketDiff extends UnlistedSpecialPage {
function PocketDiff() {
UnlistedSpecialPage::UnlistedSpecialPage('PocketDiff');
+ wfLoadExtensionMessages('Wikiwyg');
}
function execute( $par ) {
@@ -327,10 +316,10 @@
$this->setHeaders();
- $text = $wgRequest->getText ('text') ;
- $title = $wgRequest->getText ('rtitle') ;
- $section = $wgRequest->getText ('rsection') ;
- $namespace = $wgRequest->getText ('rnamespace') ;
+ $text = $wgRequest->getText('text');
+ $title = $wgRequest->getText('rtitle');
+ $section = $wgRequest->getText('rsection');
+ $namespace = $wgRequest->getText('rnamespace');
$wgOut->setArticleBodyOnly( true );
if ( $text ) {
@@ -339,20 +328,20 @@
}
function makeADifference ($text, $title, $section) {
- global $wgOut ;
- /* make an article object */
- $rtitle = Title::newFromText ($title) ;
+ global $wgOut;
+ /* make an article object */
+ $rtitle = Title::newFromText($title);
- $rarticle = new Article ($rtitle, $rtitle->getArticleID ()) ;
- $epage = new EditPage ($rarticle) ;
- $epage->section = $section ;
+ $rarticle = new Article($rtitle, $rtitle->getArticleID ());
+ $epage = new EditPage($rarticle);
+ $epage->section = $section;
/* customized getDiff from EditPage */
$oldtext = $epage->mArticle->fetchContent();
$edittime = $epage->mArticle->getTimestamp();
$newtext = $epage->mArticle->replaceSection(
$section, $text, '', $edittime );
-
+
$newtext = $epage->mArticle->preSaveTransform( $newtext );
$oldtitle = wfMsgExt( 'currentrev', array('parseinline') );
$newtitle = wfMsgExt( 'yourtext', array('parseinline') );
@@ -365,80 +354,71 @@
}
$diffdiv = '<div id="wikiDiff">' . $difftext . '</div>';
- $wgOut->addHTML ($diffdiv) ;
-
+ $wgOut->addHTML ($diffdiv);
}
}
-global $wgMessageCache;
SpecialPage::addPage( new PocketDiff );
-$wgMessageCache->addMessage( 'pocketdiff', 'retrieves difference' );
-
}
function wfWikiwygToggle ($toggles) {
- global $wgMessageCache, $wgWysiwygEnabled ;
- $wgMessageCache->addMessages (
- array (
- 'tog-in-page' => 'use in-page editor' ,
- 'wysiwygdef' => 'wysiwyg default mode' ,
- 'wikitextdef' => 'wikitext default mode'
- )
- ) ;
- $toggles ["in-page"] = "in-page" ;
+ global $wgWysiwygEnabled;
+ wfLoadExtensionMessages('Wikiwyg');
+ $toggles["in-page"] = "in-page";
+ return true;
}
function wfWikiwygAddEditingPrefs ($prefsForm, $prefs) {
- global $wgWysiwygEnabled ;
+ global $wgWysiwygEnabled;
$prefs = array_merge ($prefs, array (
'in-page'
- )) ;
+ ));
+ return true;
}
function wfWikiwygHandleEditingPrefs () {
- global $wgOut, $wgWysiwygEnabled ;
+ global $wgOut, $wgWysiwygEnabled;
if (isset($wgWysiwygEnabled) && $wgWysiwygEnabled) {
$wgOut->addScript("
<script type=\"text/javascript\">
function WikiwygEnhanceControls () {
- var inPageControl = document.getElementById ('in-page') ;
- var WysiwygControl = document.getElementById ('wpVisualEditorWysiwyg') ;
- var WikitextControl = document.getElementById ('wpVisualEditorWikitext') ;
+ var inPageControl = document.getElementById ('in-page');
+ var WysiwygControl = document.getElementById ('wpVisualEditorWysiwyg');
+ var WikitextControl = document.getElementById ('wpVisualEditorWikitext');
//initial enable
if (inPageControl.checked) {
- WysiwygControl.disabled = false ;
- WysiwygControl.parentNode.style.fontColor = 'black' ;
- WikitextControl.disabled = false ;
- WikitextControl.parentNode.style.fontColor = 'black' ;
+ WysiwygControl.disabled = false;
+ WysiwygControl.parentNode.style.fontColor = 'black';
+ WikitextControl.disabled = false;
+ WikitextControl.parentNode.style.fontColor = 'black';
}
- var PreferencesSave = document.getElementById ('wpSaveprefs') ;
+ var PreferencesSave = document.getElementById ('wpSaveprefs');
inPageControl.onclick = function () {
if (inPageControl.checked) {
- WysiwygControl.disabled = false ;
- WysiwygControl.parentNode.style.fontColor = 'black' ;
- WikitextControl.disabled = false ;
- WikitextControl.parentNode.style.fontColor = 'black' ;
+ WysiwygControl.disabled = false;
+ WysiwygControl.parentNode.style.fontColor = 'black';
+ WikitextControl.disabled = false;
+ WikitextControl.parentNode.style.fontColor = 'black';
} else {
- WysiwygControl.parentNode.style.fontColor = 'gray' ;
- WysiwygControl.disabled = true ;
- WikitextControl.parentNode.style.fontColor = 'gray' ;
- WikitextControl.disabled = true ;
+ WysiwygControl.parentNode.style.fontColor = 'gray';
+ WysiwygControl.disabled = true;
+ WikitextControl.parentNode.style.fontColor = 'gray';
+ WikitextControl.disabled = true;
}
}
PreferencesSave.onclick = function () {
- Cookie.del (\"WikiwygEditMode\") ;
- //Cookie.del (\"WikiwygFPEditMode\") ;
+ Cookie.del (\"WikiwygEditMode\");
+ //Cookie.del (\"WikiwygFPEditMode\");
}
}
- addOnloadHook (WikiwygEnhanceControls) ;
+ addOnloadHook (WikiwygEnhanceControls);
</script>"
) ;
}
+ return true;
}
-} # End if(defined MEDIAWIKI)
-
-?>
+} # End if(defined MEDIAWIKI)
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/EZParser.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/EZParser.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/EZParser.php (revision 36026)
@@ -1,6 +1,5 @@
<?php
-
# Not a valid entry point, skip unless MEDIAWIKI is defined
if (defined('MEDIAWIKI')) {
$wgExtensionFunctions[] = 'wfEZParser';
@@ -14,11 +13,11 @@
require_once( $IP.'/includes/SpecialPage.php' );
#class EZParser extends UnlistedSpecialPage
-class EZParser extends SpecialPage
-{
+class EZParser extends SpecialPage {
function EZParser() {
# UnlistedSpecialPage::UnlistedSpecialPage('EZParser');
SpecialPage::SpecialPage('EZParser');
+ wfLoadExtensionMessages('Wikiwyg');
}
function execute( $par ) {
@@ -44,13 +43,13 @@
}
function parseText($text){
- #still need to make it actually parse the input.
- global $wgOut, $wgUser, $wgTitle, $wgParser, $wgAllowDiffPreview, $wgEnableDiffPreviewPreference;
-$parserOptions = ParserOptions::newFromUser( $wgUser );
- $parserOptions->setEditSection( false );
- $output = $wgParser->parse( $text, $wgTitle, $parserOptions );
- $wgOut->setArticleBodyOnly( true );
- $wgOut->addHTML($output->mText);
+ #still need to make it actually parse the input.
+ global $wgOut, $wgUser, $wgTitle, $wgParser, $wgAllowDiffPreview, $wgEnableDiffPreviewPreference;
+ $parserOptions = ParserOptions::newFromUser( $wgUser );
+ $parserOptions->setEditSection( false );
+ $output = $wgParser->parse( $text, $wgTitle, $parserOptions );
+ $wgOut->setArticleBodyOnly( true );
+ $wgOut->addHTML($output->mText);
}
function addForm(){
@@ -70,10 +69,6 @@
}
}
-global $wgMessageCache;
SpecialPage::addPage( new EZParser );
-$wgMessageCache->addMessage( 'ezparser', 'Simple parser test' );
-
}
-} # End if(defined MEDIAWIKI)
-
+} # End if(defined MEDIAWIKI)
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php (revision 36026)
@@ -1,9 +1,9 @@
<?php
-/*
-* @copyright Copyright © 2007, Wikia Inc.
-* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
-*/
+/**
+ * @copyright Copyright © 2007, Wikia Inc.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
class TagCloud {
var $tags_min_pts = 8;
@@ -17,7 +17,7 @@
}
public function initialize(){
- $dbr =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_MASTER );
$sql = "SELECT replace(replace(cl_to,'_News',''),'_Opinions','') as cl_to, count(*) as count FROM {$dbr->tableName( 'categorylinks' )} cl1
GROUP BY cl_to
ORDER BY
@@ -34,17 +34,15 @@
}
//sort tag array by key (tag name)
- if ($this->tags_highest_count == 0) return ;
+ if ($this->tags_highest_count == 0) return;
ksort($this->tags);
if ($this->tags_highest_count == 1) {
- $coef = $this->tags_max_pts - $this->tags_min_pts ;
+ $coef = $this->tags_max_pts - $this->tags_min_pts;
} else {
- $coef = ($this->tags_max_pts - $this->tags_min_pts)/(($this->tags_highest_count-1) * 2) ;
+ $coef = ($this->tags_max_pts - $this->tags_min_pts)/(($this->tags_highest_count-1) * 2);
}
foreach ($this->tags as $tag => $att) {
- $this->tags[$tag]["size"] = $this->tags_min_pts + ($this->tags[$tag]["count"] - 1) * $coef ;
+ $this->tags[$tag]["size"] = $this->tags_min_pts + ($this->tags[$tag]["count"] - 1) * $coef;
}
}
-}
-
-?>
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/WikiwygEditing.php
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/WikiwygEditing.php (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/WikiwygEditing.php (revision 36026)
@@ -1,52 +1,44 @@
-<?PHP
+<?php
global $wgHooks;
-$wgHooks['EditPage::showEditForm:initial'][] = 'WikiwygAlternateEdit' ;
-$wgHooks['EditForm:BeforeDisplayingTextbox'][] = 'WikiwygHideTextarea' ;
-$wgHooks['EditForm::AfterEdit:Form'][] = 'WikiwygEditTagCloud' ;
+$wgHooks['EditPage::showEditForm:initial'][] = 'WikiwygAlternateEdit';
+$wgHooks['EditForm:BeforeDisplayingTextbox'][] = 'WikiwygHideTextarea';
+$wgHooks['EditForm::AfterEdit:Form'][] = 'WikiwygEditTagCloud';
$wgExtensionFunctions[] = 'registerWikiwygEditing';
$wgExtensionCredits['other'][] = array(
- 'name' => 'WikiwygEditing' ,
- 'author' => 'Bartek Lapinski' ,
- 'version' => 1.0 ,
- 'url' => 'http://www.wikia.com' ,
- 'description' => 'Mediawiki integration of the Wikiwyg WYSIWYG wiki editor - for full page editing '
+ 'name' => 'WikiwygEditing',
+ 'author' => 'Bartek Łapiński',
+ 'version' => '1.0',
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Wikiwyg',
+ 'description' => 'MediaWiki integration of the Wikiwyg WYSIWYG wiki editor - for full page editing'
);
function registerWikiwygEditing () {
}
-
function wfIsCategoryCloudAllowed ($epage) {
- global $wgRequest ;
+ global $wgRequest;
if (($epage->mArticle->mTitle->getNamespace() != NS_MAIN) || ($wgRequest->getVal ('categoryCloud') == 'off' ) ) {
/* allow parameter override */
if ($wgRequest->getVal ('categoryCloud') != 'on' ) {
- return false ;
+ return false;
}
}
- return true ;
+ return true;
}
function WikiwygAlternateEdit ($epage) {
- global $wgOut,$wgSkin,$jsdir,$cssdir;
+ global $wgOut, $wgSkin, $jsdir, $cssdir;
global $wgWikiwygPath;
- global $wgServer,$wgWikiwygJsPath,$wgWikiwygCssPath,$wgWikiwygImagePath,$wgStyleVersion;
- global $wgUser, $wgMessageCache, $wgServer, $wgArticlePath, $wgEnableAjaxLogin ;
+ global $wgServer, $wgWikiwygJsPath, $wgWikiwygCssPath, $wgWikiwygImagePath, $wgStyleVersion;
+ global $wgUser, $wgMessageCache, $wgServer, $wgArticlePath, $wgEnableAjaxLogin;
- $wgMessageCache->addMessages(
- array(
- 'wikiwyg_editing_option' => 'you can switch to old editor in preferences $1' ,
- 'wikiwyg_use_cloud' => ', for editing with CategoryCloud, use $1 link' ,
- 'wikiwyg_editing_here' => 'here' ,
- 'wikiwyg_editing_this' => 'this'
- )
- );
+ wfLoadExtensionMessages('Wikiwyg');
/* in-page disabled automatically disables this loading */
if ( wfGetDependingOnSkin () == 0 ) {
- return true ;
+ return true;
}
if (! isset($wgWikiwygPath)) {
$wgWikiwygPath = $wgScriptPath . "/extensions/wikiwyg";
@@ -65,7 +57,7 @@
$wgOut->addScript("<script type=\"text/javascript\" src=\"$wgWikiwygJsPath/extensions/WikiwygEditing/js/editpage.js?$wgStyleVersion\"></script>\n");
if (! isset($wgEnableAjaxLogin) || ($wgEnableAjaxLogin == false)) {
- $wgEnableAjaxLogin = 0 ;
+ $wgEnableAjaxLogin = 0;
}
$wgOut->addScript("
@@ -77,77 +69,78 @@
");
$wgOut->addScript("<script type=\"text/javascript\" src=\"$wgWikiwygJsPath/MediaWikiWyg.js\"></script>\n");
- $fixed_art_path = preg_replace ('/\$1/', "", $wgArticlePath) ;
+ $fixed_art_path = preg_replace('/\$1/', "", $wgArticlePath);
- $alternate_link = "<a href=\"".$fixed_art_path."Special:Preferences#prefsection-4\" >".wfMsg ('wikiwyg_editing_here')."</a>" ;
- $has_cloud = wfIsCategoryCloudAllowed ($epage) ;
+ $alternate_link = "<a href=\"".$fixed_art_path."Special:Preferences#prefsection-4\" >".wfMsg('wikiwyg-editing-here')."</a>";
+ $has_cloud = wfIsCategoryCloudAllowed($epage);
- $subtitle_text = wfMsg ('wikiwyg_editing_option', $alternate_link) ;
+ $subtitle_text = wfMsg('wikiwyg-editing-option', $alternate_link);
if ($has_cloud) {
- $nocloud_link = "<a href=\"".$fixed_art_path.$epage->mArticle->mTitle->getPrefixedUrl()."?action=edit&categoryCloud=off\" >".wfMsg ('wikiwyg_editing_this')."</a>" ;
+ $nocloud_link = "<a href=\"".$fixed_art_path.$epage->mArticle->mTitle->getPrefixedUrl()."?action=edit&categoryCloud=off\" >".wfMsg('wikiwyg-editing-this')."</a>";
} else {
- $nocloud_link = "<a href=\"".$fixed_art_path.$epage->mArticle->mTitle->getPrefixedUrl()."?action=edit&categoryCloud=on\" >".wfMsg ('wikiwyg_editing_this')."</a>" ;
- $subtitle_text .= wfMsg('wikiwyg_use_cloud', $nocloud_link) ;
+ $nocloud_link = "<a href=\"".$fixed_art_path.$epage->mArticle->mTitle->getPrefixedUrl()."?action=edit&categoryCloud=on\" >".wfMsg('wikiwyg-editing-this')."</a>";
+ $subtitle_text .= wfMsg('wikiwyg-use-cloud', $nocloud_link);
}
$wgOut->addHTML ("<div id=\"wikiwyg_cancel_form\" style=\"display:none;\">
<form id=\"wikiwyg_toggle_editor\" action=\"\" >
- ".$subtitle_text) ;
+ ".$subtitle_text);
- $wgOut->addHTML ("</form>
- </div>") ;
- $wgOut->addHTML ("<div id=\"backup_textarea_placeholder\"></div>") ;
- return true ;
+ $wgOut->addHTML ("</form></div>");
+ $wgOut->addHTML ("<div id=\"backup_textarea_placeholder\"></div>");
+ return true;
}
function WikiwygHideTextarea ($epage, $hidden) {
- global $wgOut ;
+ global $wgOut;
+ wfLoadExtensionMessages('Wikiwyg');
if (wfGetDependingOnSkin () == 1) {
- $hidden = 'style="display:none;"' ;
- $wgOut->addHTML ("<div id=\"WikiwygEditingLoadingMesg\" style=\"font-weight:bold\">Loading...</div>") ;
+ $hidden = 'style="display:none;"';
+ $wgOut->addHTML ("<div id=\"WikiwygEditingLoadingMesg\" style=\"font-weight:bold\">".wfMsg('createpage-loading-mesg')."</div>");
$wgOut->addHTML ("<div id=\"WikiwygEditingUpperToolbar\" style=\"display:none; float: clear;\">
- <div style=\"float: right\"><a href=\"#article\">Return to editing</a></div>
+ <div style=\"float: right\"><a href=\"#article\">".wfMsg('wikiwyg-return')."</a></div>
<div><a href=\"#article\">Return to editing</a></div>
- </div>") ;
- $wgOut->addHTML ("<div id=\"WikiwygEditingPreviewArea\" style=\"display:none\"></div>") ;
+ </div>");
+ $wgOut->addHTML ("<div id=\"WikiwygEditingPreviewArea\" style=\"display:none\"></div>");
/* allow for users not having js enabled to edit too */
$wgOut->addHTML ("
<noscript>
<style type=\"text/css\">
#wpTextbox1 {
- display: block !important ;
+ display: block !important;
}
#WikiwygEditingLoadingMesg, #wikiwyg_lower_wrapper {
- display: none ;
+ display: none;
}
</style>
</noscript>
") ;
}
- return true ;
+ return true;
}
function WikiwygEditTagCloud ($epage) {
- global $wgOut, $wgRequest ;
+ global $IP, $wgOut, $wgRequest;
+ wfLoadExtensionMessages('Wikiwyg');
if (wfGetDependingOnSkin () == 1) {
/* only for NS_MAIN, except on override */
if ( !wfIsCategoryCloudAllowed ($epage) ) {
- return true ;
+ return true;
}
- require_once($IP. 'extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php') ;
+ require_once($IP. 'extensions/wikiwyg/share/MediaWiki/extensions/TagCloud/TagCloudClass.php');
- $MyCloud = new TagCloud ;
- $num = 0 ;
- $cloud_html = '' ;
+ $MyCloud = new TagCloud;
+ $num = 0;
+ $cloud_html = '';
if (is_array ($MyCloud->tags)) {
foreach ($MyCloud->tags as $name => $tag) {
/* take care of the sorting parameter */
- $core_name = str_replace('/|.*/','',$name) ;
+ $core_name = str_replace('/|.*/','',$name);
$cloud_html .= "<span id=\"tag-$num\" style=\"font-size:". $tag["size"]."pt\">
<a href=\"#\" id=\"cloud_$num\" onclick=\"EditPageAddCategory ('$name', $num) ; return false ;\">$core_name</a>
- </span>" ;
- $num++ ;
+ </span>";
+ $num++;
}
}
@@ -156,15 +149,15 @@
<div id=\"wikiwyg_lower_wrapper\">
<table id=\"editpage_table\">
<tr>
- <td class=\"editpage_header\">".wfMsg ('edit-summary').":</td>
+ <td class=\"editpage_header\">".wfMsg('edit-summary').":</td>
<td id=\"editpage_summary_td\"></td>
</tr>
<tr style=\"padding: 6px 0px 6px 0px\">
<td class=\"editpage_header\"> </td>
- <td>".wfMsg ('createpage_categories_help')."</td>
+ <td>".wfMsg('createpage-categories-help')."</td>
</tr>
<tr>
- <td class=\"editpage_header\">".wfMsg ('createpage_categories')."</td>
+ <td class=\"editpage_header\">".wfMsg('createpage-categories')."</td>
<td>
<span id=\"category_textarea_placeholder\"></span>
<div id=\"category_cloud_wrapper\" style=\"display: none\" class=\editpage_inside\">
@@ -178,7 +171,5 @@
<input type=\"hidden\" name=\"wpCategoryTagCount\", id=\"category_tag_count\" value=\"$num\" />
") ;
}
- return true ;
-}
-
-?>
+ return true;
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/js/editpage.js
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/js/editpage.js (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/extensions/WikiwygEditing/js/editpage.js (revision 36026)
@@ -1,12 +1,12 @@
/*
- @author Bartek Lapinski
+ @author Bartek Łapiński
@copyright Copyright © 2007, Wikia Inc.
@license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
-var WikiwygInstance ;
-var wgFullPageEditing = true ;
+var WikiwygInstance;
+var wgFullPageEditing = true;
/* copied and adapted from upload image script... */
// apply tagOpen/tagClose to selection in textarea,
@@ -14,70 +14,70 @@
// copied and adapted from phpBB
function WKWinsertTags(tagOpen, tagClose, sampleText) {
if (WikiwygInstance.enabled) {
- var out = WikiwygInstance.current_mode ;
- out.insert_html (tagOpen + sampleText + tagClose) ;
+ var out = WikiwygInstance.current_mode;
+ out.insert_html (tagOpen + sampleText + tagClose);
}
}
/* fall back if edit mode not supported - provide a normal interface */
EditPageFallBack = function () {
/* todo give standard edit toolbar */
- document.insertTags = insertTags ;
- WikiwygInstance.textbox.style.display = '' ;
- document.getElementById ('WikiwygEditingLoadingMesg').style.display = 'none' ;
+ document.insertTags = insertTags;
+ WikiwygInstance.textbox.style.display = '';
+ document.getElementById ('WikiwygEditingLoadingMesg').style.display = 'none';
}
-document.insertTags = WKWinsertTags ;
+document.insertTags = WKWinsertTags;
function EditPageShowSection (section) {
- var this_section = document.getElementById ('editpage_' + section + '_section') ;
- var show_this = document.getElementById ('editpage_show_' + section) ;
- var hide_this = document.getElementById ('editpage_hide_' + section) ;
+ var this_section = document.getElementById ('editpage_' + section + '_section');
+ var show_this = document.getElementById ('editpage_show_' + section);
+ var hide_this = document.getElementById ('editpage_hide_' + section);
- this_section.style.display = '' ;
- show_this.style.display = 'none' ;
- hide_this.style.display = '' ;
+ this_section.style.display = '';
+ show_this.style.display = 'none';
+ hide_this.style.display = '';
}
function EditPageHideSection (section) {
- var this_section = document.getElementById ('editpage_' + section + '_section') ;
- var show_this = document.getElementById ('editpage_show_' + section) ;
- var hide_this = document.getElementById ('editpage_hide_' + section) ;
+ var this_section = document.getElementById ('editpage_' + section + '_section');
+ var show_this = document.getElementById ('editpage_show_' + section);
+ var hide_this = document.getElementById ('editpage_hide_' + section);
- this_section.style.display = 'none' ;
- show_this.style.display = '' ;
- hide_this.style.display = 'none' ;
+ this_section.style.display = 'none';
+ show_this.style.display = '';
+ hide_this.style.display = 'none';
}
function EditPageAddCategory (category, num) {
if (category != '') {
- var category_field = document.getElementById ('category_textarea') ;
- category = unescape (category) ;
+ var category_field = document.getElementById ('category_textarea');
+ category = unescape (category);
if (category_field.value == '') {
- category_field.value += category ;
+ category_field.value += category;
} else {
- category_field.value += ',' + category ;
+ category_field.value += ',' + category;
}
- this_button = document.getElementById ('cloud_'+ num) ;
- this_span = document.getElementById ('tag-' + num) ;
+ this_button = document.getElementById ('cloud_'+ num);
+ this_span = document.getElementById ('tag-' + num);
this_button.onclick = function() { eval("EditPageRemoveCategory('" + escape(category) + "', " + num + ")"); return false };
- this_button.style["color"] = "#419636" ;
+ this_button.style["color"] = "#419636";
}
}
function EditPageRemoveCategory (category, num) {
- var category_field = document.getElementById('category_textarea') ;
- category_text = category_field.value ;
- category = unescape (category) ;
- this_pos = category_text.indexOf(category) ;
+ var category_field = document.getElementById('category_textarea');
+ category_text = category_field.value;
+ category = unescape (category);
+ this_pos = category_text.indexOf(category);
if (this_pos != -1) {
- category_text = category_text.substr (0, this_pos-1 ) + category_text.substr (this_pos + category.length) ;
- category_field.value = category_text ;
+ category_text = category_text.substr (0, this_pos-1 ) + category_text.substr (this_pos + category.length);
+ category_field.value = category_text;
}
- this_button = document.getElementById ('cloud_'+ num) ;
- category = category.replace (/\|.*/,'') ;
+ this_button = document.getElementById ('cloud_'+ num);
+ category = category.replace (/\|.*/,'');
this_button.onclick = function() { eval("EditPageAddCategory('" + escape(category) + "', " + num + ")"); return false };
- this_button.style["color"] = "" ;
+ this_button.style["color"] = "";
}
@@ -94,136 +94,136 @@
return base + url;
}
-window.onbeforeunload = confirmExit ;
+window.onbeforeunload = confirmExit;
window.onload = function() {
- var editform = document.getElementById ('editform') ;
- var edit_text = document.getElementById ('wpTextbox1') ;
- var wiki_diff = document.getElementById ('wikiDiff') ;
+ var editform = document.getElementById ('editform');
+ var edit_text = document.getElementById ('wpTextbox1');
+ var wiki_diff = document.getElementById ('wikiDiff');
if (wiki_diff) {
- var upper_toolbar = document.getElementById ('WikiwygEditingUpperToolbar') ;
- var new_upper_toolbar = Wikiwyg.createElementWithAttrs ('div', {id: 'WikiwygEditingUpperToolbarBis'}) ;
- new_upper_toolbar.innerHTML = upper_toolbar.innerHTML ;
- wiki_diff.parentNode.insertBefore (new_upper_toolbar, wiki_diff) ;
+ var upper_toolbar = document.getElementById ('WikiwygEditingUpperToolbar');
+ var new_upper_toolbar = Wikiwyg.createElementWithAttrs ('div', {id: 'WikiwygEditingUpperToolbarBis'});
+ new_upper_toolbar.innerHTML = upper_toolbar.innerHTML;
+ wiki_diff.parentNode.insertBefore (new_upper_toolbar, wiki_diff);
}
- var subtitle = document.getElementById ('contentSub') ;
- var cp_subtitle = document.getElementById ('wikiwyg_cancel_form') ;
- var copywarn = document.getElementById ('editpage-copywarn') ;
- copywarn.style.display = 'none' ;
- subtitle.innerHTML = cp_subtitle.innerHTML ;
- var summary_holder = document.getElementById ('wpSummaryLabel').firstChild ;
- summary_holder.innerHTML = wgSummaryCaption + ':' ;
- var content = edit_text.value ;
+ var subtitle = document.getElementById ('contentSub');
+ var cp_subtitle = document.getElementById ('wikiwyg_cancel_form');
+ var copywarn = document.getElementById ('editpage-copywarn');
+ copywarn.style.display = 'none';
+ subtitle.innerHTML = cp_subtitle.innerHTML;
+ var summary_holder = document.getElementById ('wpSummaryLabel').firstChild;
+ summary_holder.innerHTML = wgSummaryCaption + ':';
+ var content = edit_text.value;
- var templates_used = document.getElementById ('templates_used_explanation') ;
- var editpage_table = document.getElementById ('editpage_table') ;
+ var templates_used = document.getElementById ('templates_used_explanation');
+ var editpage_table = document.getElementById ('editpage_table');
if (templates_used) {
- templates_used.style.display = 'none' ;
- var templates_list = document.getElementById ('templates_used_list') ;
- templates_list.style.display = 'none' ;
- var templates_tr = document.createElement ('tr') ;
- var templates_td_header = Wikiwyg.createElementWithAttrs ('td', {'class': 'editpage_header'}) ;
- var templates_container = Wikiwyg.createElementWithAttrs ('div', {'style': 'border: 1px solid gray; '}) ;
- var templates_list_ul = document.createElement ('ul') ;
- templates_td_header.appendChild (document.createTextNode('Templates:')) ;
- var templates_td_body = document.createElement ('td') ;
- templates_list_ul.innerHTML = templates_list.innerHTML ;
+ templates_used.style.display = 'none';
+ var templates_list = document.getElementById ('templates_used_list');
+ templates_list.style.display = 'none';
+ var templates_tr = document.createElement ('tr');
+ var templates_td_header = Wikiwyg.createElementWithAttrs ('td', {'class': 'editpage_header'});
+ var templates_container = Wikiwyg.createElementWithAttrs ('div', {'style': 'border: 1px solid gray; '});
+ var templates_list_ul = document.createElement ('ul');
+ templates_td_header.appendChild (document.createTextNode('Templates:'));
+ var templates_td_body = document.createElement ('td');
+ templates_list_ul.innerHTML = templates_list.innerHTML;
templates_list_ul.innerHTML += '<li class="last"></li>'
- templates_container.appendChild (templates_list_ul) ;
- templates_td_body.appendChild (templates_container) ;
- templates_tr.appendChild (templates_td_header) ;
- templates_tr.appendChild (templates_td_body) ;
- editpage_table.appendChild (templates_tr) ;
+ templates_container.appendChild (templates_list_ul);
+ templates_td_body.appendChild (templates_container);
+ templates_tr.appendChild (templates_td_header);
+ templates_tr.appendChild (templates_td_body);
+ editpage_table.appendChild (templates_tr);
}
/* remove those, move to the template table */
- var summaryInput = document.getElementById ('wpSummary') ;
- var summaryTd = document.getElementById ('editpage_summary_td') ;
- var old_sum_text = summaryInput.value ;
+ var summaryInput = document.getElementById ('wpSummary');
+ var summaryTd = document.getElementById ('editpage_summary_td');
+ var old_sum_text = summaryInput.value;
if (summaryInput) {
- summaryInput.parentNode.removeChild (summaryInput) ;
+ summaryInput.parentNode.removeChild (summaryInput);
var newSummaryInput = Wikiwyg.createElementWithAttrs ('input',
- {'id': 'wpSummary' ,
- 'name': 'wpSummary' ,
- 'type': 'text' ,
- 'value': '' ,
+ {'id': 'wpSummary',
+ 'name': 'wpSummary',
+ 'type': 'text',
+ 'value': '',
'style': 'width: 360px !important'
}) ;
- newSummaryInput.value = old_sum_text ;
- summaryTd.appendChild (newSummaryInput) ;
+ newSummaryInput.value = old_sum_text;
+ summaryTd.appendChild (newSummaryInput);
/* clean up too */
- var summaryLabel = getLabelFor ('wpSummary') ;
- summaryLabel.parentNode.removeChild (summaryLabel) ;
+ var summaryLabel = getLabelFor ('wpSummary');
+ summaryLabel.parentNode.removeChild (summaryLabel);
}
- var minorInput = document.getElementById ('wpMinoredit') ;
+ var minorInput = document.getElementById ('wpMinoredit');
if (minorInput) {
- minorInput.parentNode.removeChild (minorInput) ;
- var minorInputLabel = getLabelFor ('wpMinoredit') ;
- var minorInputText = minorInputLabel.innerHTML ;
- minorInputLabel.parentNode.removeChild (minorInputLabel) ;
+ minorInput.parentNode.removeChild (minorInput);
+ var minorInputLabel = getLabelFor ('wpMinoredit');
+ var minorInputText = minorInputLabel.innerHTML;
+ minorInputLabel.parentNode.removeChild (minorInputLabel);
/* add input plus label */
var newMinorInput = Wikiwyg.createElementWithAttrs ('input',
- {'id': 'wpMinoredit' ,
- 'name': 'wpMinoredit' ,
- 'type': 'checkbox' ,
- 'value': '1' ,
+ {'id': 'wpMinoredit',
+ 'name': 'wpMinoredit',
+ 'type': 'checkbox',
+ 'value': '1',
'accesskey': 'i'
}) ;
var newMinorInputLabel = Wikiwyg.createElementWithAttrs ('label',
- {'for': 'wpMinoredit' ,
- 'accesskey': 'i' ,
- 'title': '' ,
+ {'for': 'wpMinoredit',
+ 'accesskey': 'i',
+ 'title': '',
'class': 'no-float'
}) ;
- newMinorInputLabel.innerHTML = minorInputText ;
- summaryTd.appendChild (newMinorInput) ;
- summaryTd.appendChild (newMinorInputLabel) ;
+ newMinorInputLabel.innerHTML = minorInputText;
+ summaryTd.appendChild (newMinorInput);
+ summaryTd.appendChild (newMinorInputLabel);
}
- var watchthisInput = document.getElementById ('wpWatchthis') ;
+ var watchthisInput = document.getElementById ('wpWatchthis');
if (watchthisInput) {
- watchthisInput.parentNode.removeChild (watchthisInput) ;
- var watchthisLabel = getLabelFor ('wpWatchthis') ;
- var watchthisText = watchthisLabel.innerHTML ;
- watchthisLabel.parentNode.removeChild (watchthisLabel) ;
+ watchthisInput.parentNode.removeChild (watchthisInput);
+ var watchthisLabel = getLabelFor ('wpWatchthis');
+ var watchthisText = watchthisLabel.innerHTML;
+ watchthisLabel.parentNode.removeChild (watchthisLabel);
/* add input plus label */
var newWatchthisInput = Wikiwyg.createElementWithAttrs ('input',
- {'id': 'wpWatchthis' ,
- 'name': 'wpWatchthis' ,
- 'type': 'checkbox' ,
- 'value': '1' ,
+ {'id': 'wpWatchthis',
+ 'name': 'wpWatchthis',
+ 'type': 'checkbox',
+ 'value': '1',
'accesskey': 'w',
'checked': 'checked'
}) ;
var newWatchthisInputLabel = Wikiwyg.createElementWithAttrs ('label',
- {'for': 'wpWatchthis' ,
- 'accesskey': 'w' ,
- 'title': '' ,
+ {'for': 'wpWatchthis',
+ 'accesskey': 'w',
+ 'title': '',
'class': 'no-float'
}) ;
- newWatchthisInputLabel.innerHTML = watchthisText ;
- summaryTd.appendChild (newWatchthisInput) ;
- summaryTd.appendChild (newWatchthisInputLabel) ;
+ newWatchthisInputLabel.innerHTML = watchthisText;
+ summaryTd.appendChild (newWatchthisInput);
+ summaryTd.appendChild (newWatchthisInputLabel);
}
- var WikiwygDiv = document.createElement ('div') ;
- WikiwygDiv.setAttribute ('id','wikiwyg') ;
+ var WikiwygDiv = document.createElement ('div');
+ WikiwygDiv.setAttribute ('id','wikiwyg');
- var WikiwygIframe = document.createElement ('iframe') ;
- WikiwygIframe.setAttribute ('id','wikiwyg-iframe') ;
- WikiwygIframe.setAttribute ('height','0') ;
- WikiwygIframe.setAttribute ('width','0') ;
- WikiwygIframe.setAttribute ('frameborder','0') ;
- document.editform.insertBefore (WikiwygIframe, edit_text) ;
- document.editform.insertBefore (WikiwygDiv, WikiwygIframe) ;
+ var WikiwygIframe = document.createElement ('iframe');
+ WikiwygIframe.setAttribute ('id','wikiwyg-iframe');
+ WikiwygIframe.setAttribute ('height','0');
+ WikiwygIframe.setAttribute ('width','0');
+ WikiwygIframe.setAttribute ('frameborder','0');
+ document.editform.insertBefore (WikiwygIframe, edit_text);
+ document.editform.insertBefore (WikiwygDiv, WikiwygIframe);
var WikiwygConfig = {
- doubleClickToEdit: true ,
- editHeightMinimum: 300 ,
+ doubleClickToEdit: true,
+ editHeightMinimum: 300,
wysiwyg: {
iframeId: 'wikiwyg-iframe'
},
@@ -233,160 +233,160 @@
link: ['bound_phrase', '[', ']']
},
controlLayout: [
- 'bold' ,
- 'italic' ,
- 'strike' ,
- 'www' ,
+ 'bold',
+ 'italic',
+ 'strike',
+ 'www',
'link',
- 'h1' ,
- 'h2' ,
- 'h3' ,
- 'h4' ,
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
'pre',
- 'hr' ,
- 'unordered' ,
- 'ordered' ,
- '|l' ,
- 'insertimage' ,
- '|l' ,
- 'help' ,
- '[' ,
- 'mode_selector' ,
- '|r' ,
- 'save' ,
- '|r' ,
- 'cancel' ,
+ 'hr',
+ 'unordered',
+ 'ordered',
+ '|l',
+ 'insertimage',
+ '|l',
+ 'help',
+ '[',
+ 'mode_selector',
+ '|r',
+ 'save',
+ '|r',
+ 'cancel',
']'
]
},
modeClasses: [
- 'Wikiwyg.Wysiwyg.Custom' ,
- 'Wikiwyg.Wikitext.Custom' ,
+ 'Wikiwyg.Wysiwyg.Custom',
+ 'Wikiwyg.Wikitext.Custom',
'Wikiwyg.Preview.Custom'
]
} ;
if (wgUseWysiwyg == 0) {
- WikiwygConfig.modeClasses.shift () ;
+ WikiwygConfig.modeClasses.shift();
}
- WikiwygInstance = new Wikiwyg.Test () ;
- WikiwygInstance.textbox = edit_text ;
- WikiwygInstance.createWikiwygArea(WikiwygDiv, WikiwygConfig);
+ WikiwygInstance = new Wikiwyg.Test();
+ WikiwygInstance.textbox = edit_text;
+ WikiwygInstance.createWikiwygArea(WikiwygDiv, WikiwygConfig);
if (WikiwygInstance.enabled) {
setTimeout("WikiwygInstance.editMode();",400);
- needToConfirm = true ;
- WikiwygInstance.textbox.style.display = 'none' ;
- document.getElementById ('WikiwygEditingLoadingMesg').style.display = 'none' ;
- document.getElementById ('toolbar').style.display = 'none' ;
- var anchor = Wikiwyg.createElementWithAttrs ('a', {'name': 'article'}) ;
- var anchor_div = Wikiwyg.createElementWithAttrs ('div', {id: 'WikiwygEditingAnchor'}) ;
- anchor_div.appendChild (anchor) ;
+ needToConfirm = true;
+ WikiwygInstance.textbox.style.display = 'none';
+ document.getElementById ('WikiwygEditingLoadingMesg').style.display = 'none';
+ document.getElementById ('toolbar').style.display = 'none';
+ var anchor = Wikiwyg.createElementWithAttrs ('a', {'name': 'article'});
+ var anchor_div = Wikiwyg.createElementWithAttrs ('div', {id: 'WikiwygEditingAnchor'});
+ anchor_div.appendChild (anchor);
- var SaveLink = document.getElementById ('wpSave') ;
- var ButtonsPanel = SaveLink.parentNode ;
- ButtonsPanel.style.display = 'none' ;
- WikiwygInstance.toolbarObject.placeLowerLinksSection () ;
- WikiwygInstance.insert_clean_after (editpage_table, WikiwygInstance.toolbarObject.linksDiv) ;
- WikiwygInstance.insert_clean_after (WikiwygInstance.toolbarObject.div, anchor_div) ;
- Event.addListener ('wikiwyg_ctrl_lnk_showLicense_wikiwyg', 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel) ;
- var cat_textarea = document.createElement('textarea') ;
- var cat_placeholder = document.getElementById ('category_textarea_placeholder') ;
+ var SaveLink = document.getElementById ('wpSave');
+ var ButtonsPanel = SaveLink.parentNode;
+ ButtonsPanel.style.display = 'none';
+ WikiwygInstance.toolbarObject.placeLowerLinksSection();
+ WikiwygInstance.insert_clean_after (editpage_table, WikiwygInstance.toolbarObject.linksDiv);
+ WikiwygInstance.insert_clean_after (WikiwygInstance.toolbarObject.div, anchor_div);
+ Event.addListener ('wikiwyg_ctrl_lnk_showLicense_wikiwyg', 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel);
+ var cat_textarea = document.createElement('textarea');
+ var cat_placeholder = document.getElementById ('category_textarea_placeholder');
if (cat_placeholder) {
- cat_textarea.setAttribute ('id', 'category_textarea') ;
- cat_textarea.setAttribute ('name', 'category') ;
- cat_textarea.setAttribute ('rows', '1') ;
- cat_textarea.setAttribute ('cols', '80') ;
- cat_placeholder.appendChild (cat_textarea) ;
+ cat_textarea.setAttribute ('id', 'category_textarea');
+ cat_textarea.setAttribute ('name', 'category');
+ cat_textarea.setAttribute ('rows', '1');
+ cat_textarea.setAttribute ('cols', '80');
+ cat_placeholder.appendChild (cat_textarea);
/* extract categories from text and place them into the category textarea */
- WikiwygInstance.categories_array = new Array () ;
- cat_textarea.value += WikiwygInstance.extractCategories (WikiwygInstance.textbox.value) ;
- var cat_full_section = document.getElementById ('editpage_cloud_section') ;
+ WikiwygInstance.categories_array = new Array();
+ cat_textarea.value += WikiwygInstance.extractCategories (WikiwygInstance.textbox.value);
+ var cat_full_section = document.getElementById ('editpage_cloud_section');
/* plus, extract the categories present in the current cloud */
- var cloud_num = document.getElementById ('category_tag_count').value ;
- var n_cat_count = cloud_num ;
- var cloud_categories = new Array () ;
+ var cloud_num = document.getElementById ('category_tag_count').value;
+ var n_cat_count = cloud_num;
+ var cloud_categories = new Array();
for (i=0;i<cloud_num;i++) {
- var cloud_id = 'cloud_' + i ;
- cloud_categories[i] = document.getElementById (cloud_id).innerHTML ;
+ var cloud_id = 'cloud_' + i;
+ cloud_categories[i] = document.getElementById (cloud_id).innerHTML;
}
var onclick_cat_fn = function (cat, id) {
- return function () {
- EditPageRemoveCategory(escape(cat), id) ;
- return false ;
+ return function () {
+ EditPageRemoveCategory(escape(cat), id);
+ return false;
}
}
for (i=0; i<WikiwygInstance.categories_array.length;i++) {
- var c_found = false ;
+ var c_found = false;
for (j in cloud_categories) {
- var core_cat = WikiwygInstance.categories_array[i].replace (/\|.*/,'') ;
+ var core_cat = WikiwygInstance.categories_array[i].replace (/\|.*/,'');
if (cloud_categories[j] == core_cat) {
- this_button = document.getElementById ('cloud_'+ j) ;
- var actual_cloud = cloud_categories[j] ;
- var cl_num = j ;
-
- this_button.onclick = onclick_cat_fn (WikiwygInstance.categories_array[i],j) ;
- this_button.style.color = "#419636" ;
- c_found = true ;
- break ;
+ this_button = document.getElementById ('cloud_'+ j);
+ var actual_cloud = cloud_categories[j];
+ var cl_num = j;
+
+ this_button.onclick = onclick_cat_fn (WikiwygInstance.categories_array[i],j);
+ this_button.style.color = "#419636";
+ c_found = true;
+ break;
}
}
if (!c_found) { /* that category is not present in the cloud, add it */
- var n_cat = document.createElement ('a') ;
- var s_cat = document.createElement ('span') ;
- n_cat_count++ ;
- var cat_num = n_cat_count - 1 ;
- n_cat.setAttribute ('id','cloud_' + cat_num) ;
- n_cat.setAttribute ('href','#') ;
- n_cat.onclick = onclick_cat_fn (WikiwygInstance.categories_array[i], cat_num) ;
- n_cat.style.color = '#419636' ;
- n_cat.style.fontSize = '10pt' ;
- s_cat.setAttribute ('id','tag-' + n_cat_count) ;
- t_cat = document.createTextNode (core_cat) ;
- space = document.createTextNode (' ') ;
- n_cat.appendChild (t_cat) ;
- s_cat.appendChild (n_cat) ;
- s_cat.appendChild (space) ;
- cat_full_section.appendChild (s_cat) ;
+ var n_cat = document.createElement ('a');
+ var s_cat = document.createElement ('span');
+ n_cat_count++;
+ var cat_num = n_cat_count - 1;
+ n_cat.setAttribute ('id','cloud_' + cat_num);
+ n_cat.setAttribute ('href','#');
+ n_cat.onclick = onclick_cat_fn (WikiwygInstance.categories_array[i], cat_num);
+ n_cat.style.color = '#419636';
+ n_cat.style.fontSize = '10pt';
+ s_cat.setAttribute ('id','tag-' + n_cat_count);
+ t_cat = document.createTextNode (core_cat);
+ space = document.createTextNode (' ');
+ n_cat.appendChild (t_cat);
+ s_cat.appendChild (n_cat);
+ s_cat.appendChild (space);
+ cat_full_section.appendChild (s_cat);
}
}
}
} else {
- EditPageFallBack () ;
+ EditPageFallBack();
}
}
proto = new Subclass('Wikiwyg.Test', 'Wikiwyg');
proto.getCategories = function () {
- var category_txt = document.getElementById ('category_textarea') ;
+ var category_txt = document.getElementById ('category_textarea');
if (!category_txt) {
- return ;
+ return;
}
/* get categories separated by commas */
- var categories = category_txt.value ;
- categories = categories.split (",") ;
+ var categories = category_txt.value;
+ categories = categories.split (",");
for (i=0;i<categories.length;i++) {
- this.addCategory (categories[i]) ;
+ this.addCategory (categories[i]);
}
}
proto.imageUpload = function (tagOpen, tagClose, sampleText) {
- Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText) ;
+ Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText);
}
proto.addCategory = function (text) {
- if (text != '') {
- WikiwygInstance.textbox.value += '\n\n[[' + wgCategoryPrefix + ':'+text+']]' ;
+ if (text != '') {
+ WikiwygInstance.textbox.value += '\n\n[[' + wgCategoryPrefix + ':'+text+']]';
}
}
proto.insert_clean_after = function (container, cargo) {
if (container.parentNode.lastchild == container) {
- container.parentNode.appendChild (cargo) ;
+ container.parentNode.appendChild (cargo);
} else {
container.parentNode.insertBefore (cargo, container.nextSibling);
}
@@ -400,99 +400,99 @@
matches = re.exec(window.location.href);
}
var domain = matches[1];
- needToConfirm = false ;
- window.location.replace (wgServer + wgScriptPath + "/wiki/" + wgPageName) ;
+ needToConfirm = false;
+ window.location.replace (wgServer + wgScriptPath + "/wiki/" + wgPageName);
}
proto.showChanges = function () {
- needToConfirm = false ;
- this.current_mode.showChanges () ;
+ needToConfirm = false;
+ this.current_mode.showChanges();
}
proto.saveChanges = function () {
- needToConfirm = false ;
+ needToConfirm = false;
var class_name = this.config.modeClasses[1];
var mode_object = this.mode_objects[class_name];
- this.current_mode.saveChanges (mode_object) ;
+ this.current_mode.saveChanges (mode_object);
}
proto.extractCategories = function (wikitext) {
- var cat_reg = new RegExp ('[\\r\\n]*\\[\\[' + wgCategoryPrefix + ':[^\\[\\]]*\\]\\]','gi') ;
- var short_cat = new RegExp ('[\\r\\n]*\\[\\[' + wgCategoryPrefix + ':') ;
- var found = wikitext.match (cat_reg) ;
+ var cat_reg = new RegExp ('[\\r\\n]*\\[\\[' + wgCategoryPrefix + ':[^\\[\\]]*\\]\\]','gi');
+ var short_cat = new RegExp ('[\\r\\n]*\\[\\[' + wgCategoryPrefix + ':');
+ var found = wikitext.match (cat_reg);
if (!found) {
- return '' ;
+ return '';
}
- this.textbox.value = this.textbox.value.replace (cat_reg,'') ;
- var allcategories = "" ;
+ this.textbox.value = this.textbox.value.replace (cat_reg,'');
+ var allcategories = "";
for (i = 0 ; i < found.length; i++) {
if (allcategories != '') {
- allcategories += ',' ;
+ allcategories += ',';
}
found[i] = found[i].replace (short_cat,'')
.replace (/\]\]/,'')
- allcategories += found[i] ;
- this.categories_array[i] = found [i] ;
+ allcategories += found[i];
+ this.categories_array[i] = found [i];
}
- return allcategories ;
+ return allcategories;
}
proto.updateStuff = function () {
- var article_text = this.current_mode.normalizeContent () ;
- this.textbox.value = article_text ;
-// document.editform.submit () ;
+ var article_text = this.current_mode.normalizeContent();
+ this.textbox.value = article_text;
+// document.editform.submit();
}
proto.clearModes = function () {
/* run through all elements and clear them */
for (var i = 0; i < this.config.modeClasses.length; i++) {
- var mode_radio = document.getElementById () ;
+ var mode_radio = document.getElementById();
if (this.config.modeClasses[i] == this.current_mode.classname) {
- mode_radio.checked = 'checked' ;
+ mode_radio.checked = 'checked';
} else {
- mode_radio.checked = false ;
+ mode_radio.checked = false;
}
}
}
proto.switchMode = function(new_mode_key) {
/* don't really switch mode, just show preview plus links */
- var preview_div = document.getElementById ('wikiwyg_preview_area') ;
- var preview_area = document.getElementById ('WikiwygEditingPreviewArea') ;
- var preview_toolbar = document.getElementById ('WikiwygEditingUpperToolbar') ;
- var second_preview_toolbar = document.getElementById ('WikiwygEditingUpperToolbarBis') ;
- var wiki_diff = document.getElementById ('wikiDiff') ;
+ var preview_div = document.getElementById ('wikiwyg_preview_area');
+ var preview_area = document.getElementById ('WikiwygEditingPreviewArea');
+ var preview_toolbar = document.getElementById ('WikiwygEditingUpperToolbar');
+ var second_preview_toolbar = document.getElementById ('WikiwygEditingUpperToolbarBis');
+ var wiki_diff = document.getElementById ('wikiDiff');
if (wiki_diff) {
- wiki_diff.style.display = 'none' ;
- second_preview_toolbar.style.display = 'none' ;
+ wiki_diff.style.display = 'none';
+ second_preview_toolbar.style.display = 'none';
}
if (!preview_div) {
- var preview_div = document.createElement ('div') ;
- preview_div.id = 'wikiwyg_preview_area' ;
- preview_div.style.backgroundColor = 'lightyellow' ;
- preview_div.style.padding = '4px 4px 4px 4px' ;
- preview_div.style.border = '1px solid #cccccc' ;
+ var preview_div = document.createElement ('div');
+ preview_div.id = 'wikiwyg_preview_area';
+ preview_div.style.backgroundColor = 'lightyellow';
+ preview_div.style.padding = '4px 4px 4px 4px';
+ preview_div.style.border = '1px solid #cccccc';
} else {
- preview_div.style.display = '' ;
+ preview_div.style.display = '';
}
- preview_area.appendChild (preview_div) ;
+ preview_area.appendChild (preview_div);
- var preview_text = WikiwygInstance.current_mode.textarea.value ;
+ var preview_text = WikiwygInstance.current_mode.textarea.value;
Wikiwyg.Wysiwyg.Custom.prototype.convertWikitextToHtml (
preview_text ,
function (preview_text) {
- preview_div.innerHTML = preview_text ;
+ preview_div.innerHTML = preview_text;
if (preview_area.style.display == 'none') {
- preview_area.style.display = '' ;
- preview_toolbar.style.display = '' ;
+ preview_area.style.display = '';
+ preview_toolbar.style.display = '';
}
}
- ) ;
+ );
}
@@ -509,14 +509,14 @@
this.apply_stylesheets();
this.enable_keybindings();
this.clear_inner_html();
- var to_convert = WikiwygInstance.textbox.value ;
- var self = this ;
+ var to_convert = WikiwygInstance.textbox.value;
+ var self = this;
this.convertWikitextToHtml (
to_convert,
function (to_convert) {
- self.set_inner_html (to_convert) ;
+ self.set_inner_html (to_convert);
}
- ) ;
+ );
}
proto.convertWikitextToHtml = function(wikitext, func) {
@@ -529,32 +529,32 @@
proto.disableCreateButtons = function () {
- var EditPageLink = document.getElementById ('wpSave') ;
- EditPageLink.disabled = true ;
+ var EditPageLink = document.getElementById ('wpSave');
+ EditPageLink.disabled = true;
}
proto.normalizeContent = function () {
- var class_name = WikiwygInstance.config.modeClasses[1] ;
- var mode_object = WikiwygInstance.mode_objects[class_name] ;
+ var class_name = WikiwygInstance.config.modeClasses[1];
+ var mode_object = WikiwygInstance.mode_objects[class_name];
- var content = this.get_edit_document().body.innerHTML ;
- content = content.replace(/<br[^>]+./gi,"<br>") ;
- content = content.replace(/<br><br>/gi,"<p>") ;
- content = mode_object.convert_html_to_wikitext (content) ;
- return content ;
+ var content = this.get_edit_document().body.innerHTML;
+ content = content.replace(/<br[^>]+./gi,"<br>");
+ content = content.replace(/<br><br>/gi,"<p>");
+ content = mode_object.convert_html_to_wikitext (content);
+ return content;
}
proto.saveChanges = function (mode) {
- document.editform.action="index.php?title=" + wgPageName + "&action=submit" ;
- this.disableCreateButtons () ;
- var input1 = document.createElement ('input') ;
- var article_text = this.get_edit_document().body.innerHTML ;
- article_text = article_text.replace(/<br[^>]+./gi,"<br>") ;
- article_text = article_text.replace(/<br><br>/gi,"<p>") ;
- article_text = mode.convert_html_to_wikitext(article_text) ;
- WikiwygInstance.textbox.value = article_text ;
- WikiwygInstance.getCategories () ;
- document.editform.submit() ;
+ document.editform.action="index.php?title=" + wgPageName + "&action=submit";
+ this.disableCreateButtons();
+ var input1 = document.createElement ('input');
+ var article_text = this.get_edit_document().body.innerHTML;
+ article_text = article_text.replace(/<br[^>]+./gi,"<br>");
+ article_text = article_text.replace(/<br><br>/gi,"<p>");
+ article_text = mode.convert_html_to_wikitext(article_text);
+ WikiwygInstance.textbox.value = article_text;
+ WikiwygInstance.getCategories();
+ document.editform.submit();
}
proto = new Subclass('Wikiwyg.Wikitext.Custom', 'Wikiwyg.Wikitext');
@@ -565,30 +565,30 @@
this.textarea = document.getElementById(this.config.textareaId);
else
this.textarea = document.createElement('textarea');
- this.textarea.setAttribute ('id', 'wikiwyg_wikitext_textarea') ;
- var categories_panel = document.getElementById ('category_cloud_wrapper') ;
+ this.textarea.setAttribute ('id', 'wikiwyg_wikitext_textarea');
+ var categories_panel = document.getElementById ('category_cloud_wrapper');
this.div.appendChild(this.textarea);
this.area = this.textarea;
this.clear_inner_text();
if (categories_panel) {
- this.stripCategories (this.textarea.value) ;
- categories_panel.style.display = '' ;
+ this.stripCategories (this.textarea.value);
+ categories_panel.style.display = '';
}
}
/* fetch categories from text, throw them all into textarea */
proto.stripCategories = function (text) {
- var found = text.match (/\[\[Category:.*\]\]/gi) ;
+ var found = text.match (/\[\[Category:.*\]\]/gi);
if (!found) {
- return '' ;
+ return '';
}
- var tempcat = "" ;
+ var tempcat = "";
for (i = 0 ; i < found.length; i++) {
tempcat = found[i].replace (/\[\[Category:/,'')
- .replace (/\]\]/,'') ;
+ .replace (/\]\]/,'');
}
- var splitted = text.split (/\[\[Category:[^\]]*\]\]/) ;
+ var splitted = text.split (/\[\[Category:[^\]]*\]\]/);
}
@@ -600,70 +600,70 @@
}
proto.normalizeContent = function () {
- return this.textarea.value ;
+ return this.textarea.value;
}
proto.saveChanges = function () {
- article_text = this.normalizeContent () ;
- WikiwygInstance.textbox.value = article_text ;
- WikiwygInstance.getCategories () ;
- document.editform.submit() ;
+ article_text = this.normalizeContent();
+ WikiwygInstance.textbox.value = article_text;
+ WikiwygInstance.getCategories();
+ document.editform.submit();
}
proto.showChanges = function () {
- article_text = this.normalizeContent () ;
- WikiwygInstance.textbox.value = article_text ;
- WikiwygInstance.getCategories () ;
+ article_text = this.normalizeContent ();
+ WikiwygInstance.textbox.value = article_text;
+ WikiwygInstance.getCategories();
var diff = Wikiwyg.createElementWithAttrs ('input', {
- 'name': 'wpDiff' ,
+ 'name': 'wpDiff',
'value': 'OK',
'type': 'hidden'
}) ;
- document.editform.appendChild (diff) ;
- document.editform.submit() ;
+ document.editform.appendChild (diff);
+ document.editform.submit();
}
proto.addCategory = function (text) {
if (text != '') {
- WikiwygInstance.textbox.value += '[[Category:'+text+']]' ;
+ WikiwygInstance.textbox.value += '[[Category:'+text+']]';
}
}
proto.getCategories = function () {
/* get categories separated by commas */
- var categories = document.getElementById ('category_textarea').value ;
- categories = categories.split (",") ;
+ var categories = document.getElementById ('category_textarea').value;
+ categories = categories.split (",");
for (i=0;i<categories.length;i++) {
- this.addCategory (categories[i]) ;
+ this.addCategory (categories[i]);
}
}
proto.enableThis = function() {
Wikiwyg.Mode.prototype.enableThis.call(this);
this.textarea.style.width = '100%';
- this.textarea.style.height = '300px' ;
+ this.textarea.style.height = '300px';
this.setHeightOfEditor();
this.enable_keybindings();
- this.textarea.value = WikiwygInstance.textbox.value ;
+ this.textarea.value = WikiwygInstance.textbox.value;
}
proto.format_table = function(element) {
this.insert_new_line();
- this.appendOutput ('{|') ;
- this.assert_blank_line() ;
+ this.appendOutput ('{|');
+ this.assert_blank_line();
this.walk(element);
- this.assert_blank_line() ;
- this.appendOutput ('|}') ;
+ this.assert_blank_line();
+ this.appendOutput ('|}');
this.insert_new_line();
}
proto.format_tr = function(element) {
- this.appendOutput('|-') ;
- this.assert_new_line() ;
- this.appendOutput('|') ;
- this.walk(element) ;
- this.assert_blank_line() ;
- this.assert_new_line() ;
+ this.appendOutput('|-');
+ this.assert_new_line();
+ this.appendOutput('|');
+ this.walk(element);
+ this.assert_blank_line();
+ this.assert_new_line();
}
proto.format_td = function(element) {
@@ -682,7 +682,7 @@
}
proto.normalizeContent = function () {
- return this.textarea.value ;
+ return this.textarea.value;
}
proto.config = {
@@ -708,15 +708,14 @@
}
}
-proto = new Subclass ('Wikiwyg.Preview.Custom', 'Wikiwyg.Preview') ;
+proto = new Subclass ('Wikiwyg.Preview.Custom', 'Wikiwyg.Preview');
proto.normalizeContent = function () {
- var content = WikiwygInstance.textbox.value ;
- return content ;
+ var content = WikiwygInstance.textbox.value;
+ return content;
}
proto.saveChanges = function () {
- WikiwygInstance.getCategories () ;
- document.editform.submit() ;
-}
-
+ WikiwygInstance.getCategories();
+ document.editform.submit();
+}
\ No newline at end of file
Index: trunk/extensions/wikiwyg/share/MediaWiki/MediaWikiWyg.js
===================================================================
--- trunk/extensions/wikiwyg/share/MediaWiki/MediaWikiWyg.js (revision 36025)
+++ trunk/extensions/wikiwyg/share/MediaWiki/MediaWikiWyg.js (revision 36026)
@@ -2,22 +2,22 @@
// BEGIN ../../lib/Wikiwyg/Init.js
/*==============================================================================
-Initial stuff by Bartek Lapinski
+Initial stuff by Bartek Łapiński
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -35,8 +35,8 @@
=============================================================================*/
-var currentWikiwyg ;
-var needToConfirm = false ;
+var currentWikiwyg;
+var needToConfirm = false;
/* comfirming exit from page */
function confirmExit(){
@@ -45,45 +45,45 @@
}
}
-/* Yahoo stuff - Bartek Lapinski */
+/* Yahoo stuff - Bartek Łapiński */
YAHOO.namespace('Wikia');
-var Event = YAHOO.util.Event ;
+var Event = YAHOO.util.Event;
YAHOO.Wikia.Wikiwyg = {
buildLicensePanel: function () {
- var copywarn = document.getElementById ('editpage-copywarn') ;
- var copywarn_copy = document.createElement ('div') ;
- copywarn_copy.id = 'copywarn-license' ;
- copywarn_copy.innerHTML = copywarn.innerHTML ;
- YAHOO.Wikia.Wikiwyg.applyTargetToLinks (copywarn_copy, "_new") ;
- document.body.appendChild (copywarn_copy) ;
+ var copywarn = document.getElementById ('editpage-copywarn');
+ var copywarn_copy = document.createElement ('div');
+ copywarn_copy.id = 'copywarn-license';
+ copywarn_copy.innerHTML = copywarn.innerHTML;
+ YAHOO.Wikia.Wikiwyg.applyTargetToLinks (copywarn_copy, "_new");
+ document.body.appendChild (copywarn_copy);
YAHOO.Wikia.Wikiwyg.licensePanel = new YAHOO.widget.Panel('copywarn-license', {
- width: "600px" ,
- modal: true ,
- constraintoviewport: true ,
- draggable: false ,
- fixedcenter: true ,
+ width: "600px",
+ modal: true,
+ constraintoviewport: true,
+ draggable: false,
+ fixedcenter: true,
underlay: "none"
} );
- YAHOO.Wikia.Wikiwyg.licensePanel.render () ;
+ YAHOO.Wikia.Wikiwyg.licensePanel.render();
} ,
// apply target to all links included in the selected element
applyTargetToLinks: function (element, target) {
- var links = element.getElementsByTagName ('a') ;
+ var links = element.getElementsByTagName('a');
if (links && (links.length > 0)) {
- for (var i=0 ; i < links.length; i++) {
- links[i].target = target ;
+ for (var i=0; i < links.length; i++) {
+ links[i].target = target;
}
}
} ,
showLicensePanel: function (e) {
- YAHOO.util.Event.preventDefault (e) ;
+ YAHOO.util.Event.preventDefault(e);
if (!YAHOO.Wikia.Wikiwyg.licensePanel) {
- YAHOO.Wikia.Wikiwyg.buildLicensePanel () ;
+ YAHOO.Wikia.Wikiwyg.buildLicensePanel();
}
- YAHOO.Wikia.Wikiwyg.licensePanel.show () ;
+ YAHOO.Wikia.Wikiwyg.licensePanel.show();
}
}
@@ -114,7 +114,7 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
@@ -122,9 +122,9 @@
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -221,7 +221,7 @@
proto.initializeObject = function(div, config) {
/* enable people to use Special:Createpage regardless of this preference */
- if ((wgUseInPage == 0) && (wgCanonicalSpecialPageName != "Createpage") ) return ;
+ if ((wgUseInPage == 0) && (wgCanonicalSpecialPageName != "Createpage") ) return;
if (! Wikiwyg.browserIsSupported) return;
if (this.enabled) return;
@@ -245,22 +245,22 @@
? this.config.firstMode
: this.config.modeClasses[0];
this.setFirstModeByName(firstMode);
- var section_number = this.div.id.replace(/.*?(\d+)$/, '$1') ;
+ var section_number = this.div.id.replace(/.*?(\d+)$/, '$1');
if (this.config.toolbarClass) {
- var class_name = this.config.toolbarClass ;
- this.toolbarObject = eval('new ' + class_name + '()') ;
- this.toolbarObject.wikiwyg = this ;
- this.toolbarObject.set_config(config.toolbar) ;
- this.toolbarObject.initializeObject(section_number) ;
- this.placeToolbar(this.toolbarObject.div) ;
+ var class_name = this.config.toolbarClass;
+ this.toolbarObject = eval('new ' + class_name + '()');
+ this.toolbarObject.wikiwyg = this;
+ this.toolbarObject.set_config(config.toolbar);
+ this.toolbarObject.initializeObject(section_number);
+ this.placeToolbar(this.toolbarObject.div);
if (!wgFullPageEditing) {
- this.toolbarObject.placeLowerToolbar () ;
- this.placeLowerToolbar (this.toolbarObject.linksDiv) ;
- this.placeLowerToolbar (this.toolbarObject.summaryDiv) ;
- /* attach the event for the license */
- Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel) ;
+ this.toolbarObject.placeLowerToolbar();
+ this.placeLowerToolbar (this.toolbarObject.linksDiv);
+ this.placeLowerToolbar (this.toolbarObject.summaryDiv);
+ /* attach the event for the license */
+ Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel);
}
}
@@ -311,14 +311,14 @@
}
proto.toggleCategory = function () {
- var category_tab = document.getElementById ('editpage_cloud_section') ;
- var category_link = document.getElementById ('wikiwyg_ctrl_lnk_toggleCategory_wikiwyg') ;
+ var category_tab = document.getElementById ('editpage_cloud_section');
+ var category_link = document.getElementById ('wikiwyg_ctrl_lnk_toggleCategory_wikiwyg');
if (category_tab.style.display == 'none') {
- category_tab.style.display = '' ;
- category_link.innerHTML = 'Hide category' ;
+ category_tab.style.display = '';
+ category_link.innerHTML = 'Hide category';
} else {
- category_tab.style.display = 'none' ;
- category_link.innerHTML = 'Add category' ;
+ category_tab.style.display = 'none';
+ category_link.innerHTML = 'Add category';
}
}
@@ -342,19 +342,19 @@
if not, avoid the road of pain and use AjaxLogin if enabled
*/
if ((wgEnableAjaxLogin == 1) && (typeof wgUserName != 'string')) {
- wgAjaxLoginSkipSuccess = true ;
+ wgAjaxLoginSkipSuccess = true;
if ( ! YAHOO.Wikia.AjaxLoginApp.loginPanel ) {
YAHOO.Wikia.AjaxLoginApp.buildLoginPanel();
}
YAHOO.Wikia.AjaxLoginApp.loginPanel.show();
- return ;
+ return;
}
/* add a guard for Ajax login disabled and reload in this window, as done before */
if (typeof wgUserName == 'string') {
imageUploadDialog = window.open("http://" + domain + "/wiki/Special:MiniUpload?type=image", "upload_file", "height=520,width=500,toolbar=no,location=no,resizable=no,top=0,left=0,menubar=0");
} else {
- window.location.replace ("http://" + domain + "/wiki/Special:Userlogin?returnto=" + wgPageName) ;
+ window.location.replace ("http://" + domain + "/wiki/Special:Userlogin?returnto=" + wgPageName);
}
}
@@ -362,7 +362,7 @@
div.style.display = 'none';
if (! div.iframe_hack) {
if (this.div.parentNode.lastchild == this.div) {
- this.div.parentNode.appendChild (div) ;
+ this.div.parentNode.appendChild (div);
} else {
this.div.parentNode.insertBefore (div, this.div.nextSibling);
}
@@ -376,22 +376,22 @@
/* indicate action */
proto.toggleThrobber = function (section) {
- return ;
- var Throbber = document.getElementById ('ajaxProgressIcon_' + section) ;
+ return;
+ var Throbber = document.getElementById ('ajaxProgressIcon_' + section);
if (Throbber.style.visibility == 'hidden') {
- Throbber.style.visibility = 'visible' ;
+ Throbber.style.visibility = 'visible';
} else {
- Throbber.style.visibility = 'hidden' ;
+ Throbber.style.visibility = 'hidden';
}
- return true ;
+ return true;
}
proto.editMode = function() { // See IE, below
- currentWikiwyg = this ;
+ currentWikiwyg = this;
this.current_mode = this.first_mode;
this.current_mode.initHtml(this.div.innerHTML);
- this.toolbarObject.resetModeSelector() ;
- this.current_mode.enableThis() ;
+ this.toolbarObject.resetModeSelector();
+ this.current_mode.enableThis();
}
proto.displayMode = function() {
@@ -433,7 +433,7 @@
}
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml (html);
}
proto.fromHtml = function(html) {
@@ -445,7 +445,7 @@
}
proto.placeLowerToolbar = function (div) {
- this.insert_div_after(div) ;
+ this.insert_div_after(div);
}
proto.setFirstModeByName = function(mode_name) {
@@ -507,8 +507,8 @@
}
proto.showChanges = function () {
- wikitext = this.current_mode.toWikitext () ;
- var self = this ;
+ wikitext = this.current_mode.toWikitext();
+ var self = this;
WKWAjax.post(
fixupRelativeUrl('index.php/' + wgSpecialPrefix + ':PocketDiff') + "&rtitle=" + wgPageName + "&rsection=" + this.section_number ,
"text=" + encodeURIComponent(wikitext),
@@ -516,15 +516,15 @@
/* hide the textbox, make return to editing links, allow save and all that stuff
remove all pre-existing wrappers
*/
- self.toolbarObject.rebuildDiffs () ;
- var diff_div_wrapper = document.getElementById ('wikiwyg_diff_wrapper') ;
+ self.toolbarObject.rebuildDiffs ();
+ var diff_div_wrapper = document.getElementById ('wikiwyg_diff_wrapper');
if (!diff_div_wrapper) {
- diff_div_wrapper = Wikiwyg.createElementWithAttrs ('div', {id: 'wikiwyg_diff_wrapper'}) ;
+ diff_div_wrapper = Wikiwyg.createElementWithAttrs ('div', {id: 'wikiwyg_diff_wrapper'});
}
- diff_div_wrapper.innerHTML = html ;
- self.insert_div_before (diff_div_wrapper) ;
- self.current_mode.textarea.style.display = 'none' ;
- diff_div_wrapper.style.display = '' ;
+ diff_div_wrapper.innerHTML = html;
+ self.insert_div_before(diff_div_wrapper);
+ self.current_mode.textarea.style.display = 'none';
+ diff_div_wrapper.style.display = '';
}
);
}
@@ -614,8 +614,8 @@
this.wikiwyg.toolbarObject.enableThis();
this.wikiwyg.div.style.display = 'none';
if (!wgFullPageEditing && (wgCanonicalSpecialPageName != 'Createpage')) {
- this.wikiwyg.toolbarObject.summaryDiv.style.display = 'block' ;
- this.wikiwyg.toolbarObject.linksDiv.style.display = 'block' ;
+ this.wikiwyg.toolbarObject.summaryDiv.style.display = 'block';
+ this.wikiwyg.toolbarObject.linksDiv.style.display = 'block';
}
}
@@ -651,8 +651,8 @@
this.display_unsupported_toolbar_buttons('inline');
this.div.style.display = 'none';
if (!wgFullPageEditing) {
- this.wikiwyg.toolbarObject.summaryDiv.style.display = 'none' ;
- this.wikiwyg.toolbarObject.linksDiv.style.display = 'none' ;
+ this.wikiwyg.toolbarObject.summaryDiv.style.display = 'none';
+ this.wikiwyg.toolbarObject.linksDiv.style.display = 'none';
}
}
@@ -699,7 +699,7 @@
);
var min = this.config.editHeightMinimum;
if (this.config.overrideHeightMinimum) {
- return min ;
+ return min;
}
return height < min
? min
@@ -789,16 +789,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -1096,7 +1096,7 @@
var gotDate = false;
var gotExpiration = false;
var gotLastModified = false;
- for (var i = 0; ; i++) {
+ for (var i = 0;; i++) {
var hdrName = conn.getHeaderFieldKey(i);
var hdrValue = conn.getHeaderField(i);
if (hdrName == null && hdrValue == null) {
@@ -1188,7 +1188,7 @@
//------------------------------------------------------------------------------
/*
-Copyright (c) 2005 JSON.org
+Copyright © 2005 JSON.org
*/
var JSON = function () {
var m = {
@@ -1269,7 +1269,7 @@
}
};
return {
- copyright: '(c)2005 JSON.org',
+ copyright: '© 2005 JSON.org',
license: 'http://www.crockford.com/JSON/license.html',
stringify: function (v) {
var f = s[typeof v];
@@ -1298,16 +1298,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -1379,16 +1379,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -1470,9 +1470,9 @@
'class': 'wikiwyg_toolbar',
id: 'wikiwyg_toolbar_' + section_number
}
- ) ;
+ );
}
- this.section_number = section_number ;
+ this.section_number = section_number;
var config = this.config;
/* add two containers for two sets of controls */
@@ -1480,18 +1480,18 @@
'div', {
id: 'wikiwyg_toolbar_left' + section_number
}
- ) ;
+ );
var right_div = Wikiwyg.createElementWithAttrs(
'div', {
id: 'wikiwyg_toolbar_right' + section_number ,
'style': 'float: right'
}
- ) ;
+ );
- this.div.appendChild (right_div) ;
- this.div.appendChild (left_div) ;
- this.addControls (config, left_div, right_div) ;
+ this.div.appendChild (right_div);
+ this.div.appendChild (left_div);
+ this.addControls (config, left_div, right_div);
}
proto.addControls = function (config, left_div, right_div) {
@@ -1510,42 +1510,42 @@
}
else if (action == 'mode_selector') {
if (right_div != '') {
- this.addFixedModeSelector ('', right_div, 'Wikitext', '') ;
+ this.addFixedModeSelector ('', right_div, 'Wikitext', '');
}
}
else if (action == 'insertimage')
- this.addControlItem(label, "imageUpload('[[Image:',']]')", left_div, '') ;
+ this.addControlItem(label, "imageUpload('[[Image:',']]')", left_div, '');
else if (action == 'selector')
this.add_styles();
else if (action == 'help')
this.addHelpItem (left_div);
else if (action == '|l')
- this.add_separator (left_div) ;
+ this.add_separator (left_div);
else if (action == '|r') {
if (right_div != '') {
- this.add_separator (right_div) ;
+ this.add_separator (right_div);
}
}
else if (action == '/')
- this.add_break (left_div) ;
+ this.add_break (left_div);
else if (action == '[') {
if (right_div != '') {
- this.add_text ('[', right_div) ;
+ this.add_text ('[', right_div) ;
}
}
else if (action == ']') {
if (right_div != '') {
- this.add_text (']', right_div) ;
+ this.add_text (']', right_div);
}
}
else
- this.add_button (action, label, left_div) ;
+ this.add_button (action, label, left_div);
}
}
/* rebuild the toolbar for preview mode mostly */
proto.changeMode = function () {
- this.rebuild () ;
+ this.rebuild ();
}
/* divided for more convenience */
@@ -1557,26 +1557,26 @@
'style': 'clear'
}
- ) ;
+ );
/* place bowels of the summary here */
var summaryInput = Wikiwyg.createElementWithAttrs(
- 'input', {
- 'type': 'text' ,
+ 'input', {
+ 'type': 'text' ,
'value': '',
'name': 'wpSummary_' + this.section_number ,
id: 'wpSummary_' + this.section_number ,
'style': 'min-width:300px; max-width:600px'
- }
- ) ;
+ }
+ );
- var edit_table = document.createElement ('table') ;
- var first_row = document.createElement ('tr') ;
- var edit_td1 = Wikiwyg.createElementWithAttrs ('td', {'class': 'editpage-header'} ) ;
- var edit_td2 = document.createElement ('td') ;
+ var edit_table = document.createElement ('table');
+ var first_row = document.createElement ('tr');
+ var edit_td1 = Wikiwyg.createElementWithAttrs ('td', {'class': 'editpage-header'} );
+ var edit_td2 = document.createElement ('td');
- edit_td1.appendChild (document.createTextNode (wgSummaryCaption + ':') ) ;
- edit_td2.appendChild (summaryInput) ;
+ edit_td1.appendChild (document.createTextNode (wgSummaryCaption + ':') );
+ edit_td2.appendChild (summaryInput);
/* for logged in, create two additional checkboxes */
if ((typeof wgUserName == 'string') && (wgCanonicalSpecialPageName != "Createpage") ) {
@@ -1586,16 +1586,16 @@
'type': 'checkbox' ,
'value': '1' ,
'accesskey': 'i'
- }) ;
+ });
var newMinorInputLabel = Wikiwyg.createElementWithAttrs ('label',
{'for': 'wpMinoredit_' + this.section_number ,
'accesskey': 'i' ,
'title': '' ,
'class': 'no-float'
- }) ;
+ });
- newMinorInputLabel.innerHTML = wgMinoreditCaption ;
+ newMinorInputLabel.innerHTML = wgMinoreditCaption;
var newWatchthisInput = Wikiwyg.createElementWithAttrs ('input',
{'id': 'wpWatchthis_' + this.section_number ,
@@ -1604,28 +1604,28 @@
'value': '1' ,
'accesskey': 'w',
'checked': 'checked'
- }) ;
+ });
var newWatchthisInputLabel = Wikiwyg.createElementWithAttrs ('label',
{'for': 'wpWatchthis_' + this.section_number ,
'accesskey': 'w' ,
'title': '' ,
'class': 'no-float'
- }) ;
+ });
- newWatchthisInputLabel.innerHTML = wgWatchthisCaption ;
- edit_td2.appendChild (newMinorInput) ;
- edit_td2.appendChild (newMinorInputLabel) ;
+ newWatchthisInputLabel.innerHTML = wgWatchthisCaption;
+ edit_td2.appendChild (newMinorInput);
+ edit_td2.appendChild (newMinorInputLabel);
- edit_td2.appendChild (newWatchthisInput) ;
- edit_td2.appendChild (newWatchthisInputLabel) ;
+ edit_td2.appendChild (newWatchthisInput);
+ edit_td2.appendChild (newWatchthisInputLabel);
}
- first_row.appendChild (edit_td1) ;
- first_row.appendChild (edit_td2) ;
- edit_table.appendChild (first_row) ;
- this.summaryDiv.appendChild (edit_table) ;
+ first_row.appendChild (edit_td1);
+ first_row.appendChild (edit_td2);
+ edit_table.appendChild (first_row);
+ this.summaryDiv.appendChild (edit_table);
}
proto.placeLowerLinksSection = function () {
@@ -1635,7 +1635,7 @@
'class': 'wikiwyg_toolbar' ,
id: 'wikiwyg_links_' + this.section_number
}
- ) ;
+ );
/* left and right, one floats, one not */
var linksLeft = Wikiwyg.createElementWithAttrs (
@@ -1643,7 +1643,7 @@
'class': '' ,
id: 'wikiwyg_links_l_' + this.section_number
}
- ) ;
+ );
var linksRight = Wikiwyg.createElementWithAttrs (
'div', {
@@ -1651,47 +1651,47 @@
id: 'wikiwyg_links_r_' + this.section_number ,
'style': 'float: right'
}
- ) ;
+ );
- this.linksDiv.appendChild (linksRight) ;
- this.linksDiv.appendChild (linksLeft) ;
+ this.linksDiv.appendChild (linksRight);
+ this.linksDiv.appendChild (linksLeft);
if (wgFullPageEditing == true) {
- this.addCategoryItem (linksLeft) ;
- this.add_separator (linksLeft) ;
+ this.addCategoryItem (linksLeft);
+ this.add_separator (linksLeft);
}
- this.addControlItem ('Show changes', 'showChanges', linksLeft, '') ;
- this.add_separator (linksLeft) ;
- this.addControlItem ('License', 'showLicense', linksLeft, '') ;
+ this.addControlItem ('Show changes', 'showChanges', linksLeft, '');
+ this.add_separator (linksLeft);
+ this.addControlItem ('License', 'showLicense', linksLeft, '');
- this.add_text ('[', linksRight) ;
- this.addFixedModeSelector ('', linksRight, 'Wikitext', 'lower') ;
- this.add_separator (linksRight) ;
- this.addControlItem (wgSaveCaption,'saveChanges', linksRight, 'lower') ;
- this.add_separator (linksRight) ;
- this.addControlItem(wgCancelCaption, 'cancelEdit', linksRight, 'lower') ;
- this.add_text (']', linksRight) ;
+ this.add_text ('[', linksRight);
+ this.addFixedModeSelector ('', linksRight, 'Wikitext', 'lower');
+ this.add_separator (linksRight);
+ this.addControlItem (wgSaveCaption,'saveChanges', linksRight, 'lower');
+ this.add_separator (linksRight);
+ this.addControlItem(wgCancelCaption, 'cancelEdit', linksRight, 'lower');
+ this.add_text (']', linksRight);
}
/* let's do it here, then apply this within the initialization process */
proto.placeLowerToolbar = function () {
- this.placeSummarySection () ;
- this.placeLowerLinksSection () ;
+ this.placeSummarySection();
+ this.placeLowerLinksSection();
}
proto.addCategoryItem = function (div) {
/* if categories are shown, procure a link to hide them, if not,
procure a link to show them
*/
- var cloud_section = document.getElementById ('editpage_cloud_section') ;
+ var cloud_section = document.getElementById ('editpage_cloud_section');
if (!cloud_section) {
/* temporary placeholder to avoid error */
- this.addControlItem ('Add category', 'toggleCategory', div, '') ;
- return ;
+ this.addControlItem ('Add category', 'toggleCategory', div, '');
+ return;
}
if (cloud_section.style.display == 'none' ) {
- this.addControlItem ('Add category', 'toggleCategory', div, '') ;
+ this.addControlItem ('Add category', 'toggleCategory', div, '');
} else {
- this.addControlItem ('Hide category', 'toggleCategory', div, '') ;
+ this.addControlItem ('Hide category', 'toggleCategory', div, '');
}
}
@@ -1705,65 +1705,65 @@
proto.rebuild = function () {
/* depending on current mode, mangle the toolbar or rebuild it */
- var left_links = document.getElementById ('wikiwyg_toolbar_left' + this.section_number) ;
- var lower_left_links = document.getElementById ('wikiwyg_links_l_' + this.section_number) ;
- var right_mode = document.getElementById ('wikiwyg_ctrl_lnk_preview' + this.section_number ) ;
- var right_lower_mode = document.getElementById ('wikiwyg_ctrl_lnk_lower_preview' + this.section_number ) ;
+ var left_links = document.getElementById ('wikiwyg_toolbar_left' + this.section_number);
+ var lower_left_links = document.getElementById ('wikiwyg_links_l_' + this.section_number);
+ var right_mode = document.getElementById ('wikiwyg_ctrl_lnk_preview' + this.section_number );
+ var right_lower_mode = document.getElementById ('wikiwyg_ctrl_lnk_lower_preview' + this.section_number );
- left_links.innerHTML = '' ;
- lower_left_links.innerHTML = '' ;
+ left_links.innerHTML = '';
+ lower_left_links.innerHTML = '';
if (this.wikiwyg.current_mode.classname.match(/(Wikitext)/)) {
- this.addFixedModeSelector ('Return to editing', left_links, 'Preview', '') ;
- this.addFixedModeSelector ('Return to editing', lower_left_links, 'Preview', 'lower') ;
- right_mode.innerHTML = wgEditCaption.toLowerCase () ;
- right_lower_mode.innerHTML = wgEditCaption.toLowerCase () ;
- this.updateModeSelector (right_mode, 'Preview') ;
- this.updateModeSelector (right_lower_mode, 'Preview') ;
+ this.addFixedModeSelector ('Return to editing', left_links, 'Preview', '');
+ this.addFixedModeSelector ('Return to editing', lower_left_links, 'Preview', 'lower');
+ right_mode.innerHTML = wgEditCaption.toLowerCase();
+ right_lower_mode.innerHTML = wgEditCaption.toLowerCase();
+ this.updateModeSelector (right_mode, 'Preview');
+ this.updateModeSelector (right_lower_mode, 'Preview');
} else {
/* rebuild the toolbar */
- this.addControls (this.config, left_links, '') ;
- this.addControlItem ('Show changes', 'showChanges', lower_left_links, '') ;
- this.add_separator (lower_left_links) ;
- this.addControlItem ('License', 'showLicense', lower_left_links, '') ;
- Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + this.section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel) ;
- right_mode.innerHTML = wgPreviewCaption.toLowerCase () ;
- right_lower_mode.innerHTML = wgPreviewCaption.toLowerCase () ;
- this.updateModeSelector (right_mode, 'Wikitext') ;
- this.updateModeSelector (right_lower_mode, 'Wikitext') ;
+ this.addControls (this.config, left_links, '');
+ this.addControlItem ('Show changes', 'showChanges', lower_left_links, '');
+ this.add_separator (lower_left_links);
+ this.addControlItem ('License', 'showLicense', lower_left_links, '');
+ Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + this.section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel);
+ right_mode.innerHTML = wgPreviewCaption.toLowerCase();
+ right_lower_mode.innerHTML = wgPreviewCaption.toLowerCase();
+ this.updateModeSelector (right_mode, 'Wikitext');
+ this.updateModeSelector (right_lower_mode, 'Wikitext');
}
}
proto.rebuildDiffs = function () {
/* depending on showing/not showing Diffs, mangle the toolbar or rebuild it */
- var left_links = document.getElementById ('wikiwyg_toolbar_left' + this.section_number) ;
- var lower_left_links = document.getElementById ('wikiwyg_links_l_' + this.section_number) ;
- var right_mode = document.getElementById ('wikiwyg_ctrl_lnk_preview' + this.section_number ) ;
- var right_lower_mode = document.getElementById ('wikiwyg_ctrl_lnk_lower_preview' + this.section_number ) ;
- var diff_div = document.getElementById ('wikiwyg_diff_wrapper') ;
- left_links.innerHTML = '' ;
- lower_left_links.innerHTML = '' ;
+ var left_links = document.getElementById ('wikiwyg_toolbar_left' + this.section_number);
+ var lower_left_links = document.getElementById ('wikiwyg_links_l_' + this.section_number);
+ var right_mode = document.getElementById ('wikiwyg_ctrl_lnk_preview' + this.section_number );
+ var right_lower_mode = document.getElementById ('wikiwyg_ctrl_lnk_lower_preview' + this.section_number );
+ var diff_div = document.getElementById ('wikiwyg_diff_wrapper');
+ left_links.innerHTML = '';
+ lower_left_links.innerHTML = '';
if (!diff_div) {
- this.addFakeModeSelector ('Return to editing', left_links) ;
- this.addFakeModeSelector ('Return to editing', lower_left_links) ;
+ this.addFakeModeSelector ('Return to editing', left_links);
+ this.addFakeModeSelector ('Return to editing', lower_left_links);
/* todo change caption for Preview button to Edit plus switch functionality */
- right_mode.innerHTML = wgEditCaption.toLowerCase () ;
- right_lower_mode.innerHTML = wgEditCaption.toLowerCase () ;
- this.updateFakeModeSelector (right_mode) ;
- this.updateFakeModeSelector (right_lower_mode) ;
+ right_mode.innerHTML = wgEditCaption.toLowerCase();
+ right_lower_mode.innerHTML = wgEditCaption.toLowerCase();
+ this.updateFakeModeSelector (right_mode);
+ this.updateFakeModeSelector (right_lower_mode);
} else {
/* rebuild the toolbar */
- this.addControls (this.config, left_links, '') ;
- this.addControlItem ('Show changes', 'showChanges', lower_left_links, '') ;
- this.add_separator (lower_left_links) ;
- this.addControlItem ('License', 'showLicense', lower_left_links, '') ;
- Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + this.section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel) ;
- right_mode.innerHTML = wgPreviewCaption.toLowerCase () ;
- right_lower_mode.innerHTML = wgPreviewCaption.toLowerCase () ;
- this.updateModeSelector (right_mode, 'Wikitext') ;
- this.updateModeSelector (right_lower_mode, 'Wikitext') ;
- this.wikiwyg.current_mode.textarea.style.display = '' ;
- diff_div.parentNode.removeChild (diff_div) ;
+ this.addControls (this.config, left_links, '');
+ this.addControlItem ('Show changes', 'showChanges', lower_left_links, '');
+ this.add_separator (lower_left_links);
+ this.addControlItem ('License', 'showLicense', lower_left_links, '');
+ Event.addListener ('wikiwyg_ctrl_lnk_showLicense_' + this.section_number, 'click', YAHOO.Wikia.Wikiwyg.showLicensePanel);
+ right_mode.innerHTML = wgPreviewCaption.toLowerCase();
+ right_lower_mode.innerHTML = wgPreviewCaption.toLowerCase();
+ this.updateModeSelector (right_mode, 'Wikitext');
+ this.updateModeSelector (right_lower_mode, 'Wikitext');
+ this.wikiwyg.current_mode.textarea.style.display = '';
+ diff_div.parentNode.removeChild (diff_div);
}
}
@@ -1814,7 +1814,7 @@
proto.add_text = function (text, div) {
div.appendChild(
document.createTextNode(text)
- ) ;
+ );
}
proto.add_separator = function (div) {
@@ -1835,10 +1835,10 @@
proto.addControlItem = function (text, method, div, place) {
var span = Wikiwyg.createElementWithAttrs(
'span', { 'class': 'wikiwyg_control_link' }
- ) ;
+ );
if (place != '') {
- place = place + '_' ;
+ place = place + '_';
}
var link = Wikiwyg.createElementWithAttrs(
@@ -1851,9 +1851,9 @@
var self = this;
if ( method.match (/\(/) ) {
- var add = '' ;
+ var add = '';
} else {
- var add = '()' ;
+ var add = '()';
}
link.onclick = function() { eval('self.wikiwyg.' + method + add); return false };
@@ -1864,62 +1864,62 @@
var span = Wikiwyg.createElementWithAttrs(
'span', { 'class': 'wikiwyg_control_link' }
);
- var class_name = this.wikiwyg.first_mode.classname ;
- var second_mode_short = '' ;
- var second_mode_full = '' ;
+ var class_name = this.wikiwyg.first_mode.classname;
+ var second_mode_short = '';
+ var second_mode_full = '';
/* for now, extract the _other_ mode classname
in our case, it's preview
but let's not be _too_ sure about it...
- */
- var mode_regex = new RegExp (mode) ;
+ */
+ var mode_regex = new RegExp(mode);
for (var i = 0; i < this.wikiwyg.config.modeClasses.length; i++) {
- var class_name = this.wikiwyg.config.modeClasses[i] ;
+ var class_name = this.wikiwyg.config.modeClasses[i];
if (!class_name.match (mode_regex)) {
- second_mode_short = this.wikiwyg.mode_objects[class_name].modeDescription.toLowerCase () ;
- second_mode_full = class_name ;
+ second_mode_short = this.wikiwyg.mode_objects[class_name].modeDescription.toLowerCase();
+ second_mode_full = class_name;
}
}
if (place != '') {
- place = place + '_' ;
+ place = place + '_';
}
var link = Wikiwyg.createElementWithAttrs(
'a', { href: '#', id: 'wikiwyg_ctrl_lnk_' + place + second_mode_short + this.section_number }
);
if (text == '') {
- link.appendChild (document.createTextNode (second_mode_short)) ;
+ link.appendChild (document.createTextNode (second_mode_short));
} else {
- link.appendChild (document.createTextNode (text)) ;
+ link.appendChild (document.createTextNode (text));
}
- span.appendChild (link) ;
+ span.appendChild(link);
var self = this;
- link.onclick = function() { self.wikiwyg.switchMode (second_mode_full) ; return false };
+ link.onclick = function() { self.wikiwyg.switchMode (second_mode_full); return false };
div.appendChild(span);
}
proto.updateFakeModeSelector = function (link) {
var self = this;
/* todo track this properly */
- link.onclick = function() { self.rebuildDiffs () ; return false };
+ link.onclick = function() { self.rebuildDiffs (); return false };
}
proto.updateModeSelector = function (link, mode) {
- var second_mode_short = '' ;
- var second_mode_full = '' ;
- var mode_regex = new RegExp (mode) ;
+ var second_mode_short = '';
+ var second_mode_full = '';
+ var mode_regex = new RegExp(mode);
for (var i = 0; i < this.wikiwyg.config.modeClasses.length; i++) {
- var class_name = this.wikiwyg.config.modeClasses[i] ;
+ var class_name = this.wikiwyg.config.modeClasses[i];
if (!class_name.match (mode_regex)) {
- second_mode_short = this.wikiwyg.mode_objects[class_name].modeDescription.toLowerCase () ;
- second_mode_full = class_name ;
+ second_mode_short = this.wikiwyg.mode_objects[class_name].modeDescription.toLowerCase();
+ second_mode_full = class_name;
}
}
var self = this;
- link.onclick = function() { self.wikiwyg.switchMode (second_mode_full) ; return false };
+ link.onclick = function() { self.wikiwyg.switchMode (second_mode_full); return false };
}
proto.resetModeSelector = function() {
@@ -1935,23 +1935,23 @@
var span = Wikiwyg.createElementWithAttrs(
'span', { 'class': 'wikiwyg_control_link' }
);
- var class_name = this.wikiwyg.first_mode.classname ;
- var second_mode_short = '' ;
- var second_mode_full = '' ;
+ var class_name = this.wikiwyg.first_mode.classname;
+ var second_mode_short = '';
+ var second_mode_full = '';
/* todo there are *two* buttons - make each have unique div */
var link = Wikiwyg.createElementWithAttrs(
'a', { href: '#', id: 'wikiwyg_ctrl_lnk_ReturnFromDiff'}
);
if (text == '') {
- link.appendChild (document.createTextNode (second_mode_short)) ;
+ link.appendChild (document.createTextNode (second_mode_short));
} else {
- link.appendChild (document.createTextNode (text)) ;
+ link.appendChild (document.createTextNode (text));
}
- span.appendChild (link) ;
+ span.appendChild(link);
var self = this;
- link.onclick = function() { self.rebuildDiffs () ; return false };
+ link.onclick = function() { self.rebuildDiffs (); return false };
div.appendChild(span);
}
@@ -2044,16 +2044,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -2074,7 +2074,7 @@
proto = new Subclass('Wikiwyg.Preview', 'Wikiwyg.Mode');
proto.classtype = 'preview';
-proto.modeDescription = wgPreviewCaption ;
+proto.modeDescription = wgPreviewCaption;
proto.config = {
divId: null
@@ -2086,14 +2086,14 @@
else
this.div = document.createElement('div');
// XXX Make this a config option.
- this.div.id = 'wikiwyg_preview_area' ;
- this.div.style.backgroundColor = 'lightyellow' ;
- this.div.style.padding = '4px 4px 4px 4px' ;
- this.div.style.border = '1px solid #cccccc' ;
+ this.div.id = 'wikiwyg_preview_area';
+ this.div.style.backgroundColor = 'lightyellow';
+ this.div.style.padding = '4px 4px 4px 4px';
+ this.div.style.border = '1px solid #cccccc';
}
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml(html);
}
proto.fromHtml = function(html) {
@@ -2113,16 +2113,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -2218,7 +2218,7 @@
if ( Wikiwyg.is_safari) return area.setAttribute('rows', 25);
- var text = this.getTextArea() ;
+ var text = this.getTextArea();
var rows = text.split(/\n/).length;
var height = parseInt(rows * adjust);
@@ -2245,7 +2245,7 @@
}
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml (html);
}
proto.fromHtml = function(html) {
@@ -2254,51 +2254,51 @@
this.convertHtmlToWikitext(
html,
function(value) {
- value = self.fixDoubleWeightBug (value) ;
- self.setTextArea(value) ;
+ value = self.fixDoubleWeightBug(value);
+ self.setTextArea(value);
}
);
}
/* seven apostrophes' solution */
proto.fixDoubleWeightBug = function (text) {
- text = this.fixBoldItalic (text) ;
- text = this.fixItalicBold (text) ;
- return text ;
+ text = this.fixBoldItalic (text);
+ text = this.fixItalicBold (text);
+ return text;
}
proto.fixBoldItalic = function (text) {
- var found = text.match (/'''''[^']+'''''''[^']+''/gi) ;
- var split = "" ;
- var modtext = "" ;
+ var found = text.match (/'''''[^']+'''''''[^']+''/gi);
+ var split = "";
+ var modtext = "";
if (!found) { /* do not touch otherwise */
- return text ;
+ return text;
}
- var vtext = text ;
- var tofix = "" ;
- split = vtext.split (/'''''[^']+'''''''[^']+''/gi) ;
+ var vtext = text;
+ var tofix = "";
+ split = vtext.split (/'''''[^']+'''''''[^']+''/gi);
for (i=0; i < found.length; i++) {
- tofix = found[i].replace ("'''''''","'''") ;
- modtext = modtext + split[i] + tofix ;
+ tofix = found[i].replace ("'''''''","'''");
+ modtext = modtext + split[i] + tofix;
}
- return modtext + split[found.length] ;
+ return modtext + split[found.length];
}
proto.fixItalicBold = function (text) {
- var found = text.match (/'''''[^']+''''''''[^']+'''/gi) ;
- var split = "" ;
- var modtext = "" ;
+ var found = text.match (/'''''[^']+''''''''[^']+'''/gi);
+ var split = "";
+ var modtext = "";
if (!found) { /* do not touch otherwise */
- return text ;
+ return text;
}
- var vtext = text ;
- var tofix = "" ;
- split = vtext.split (/'''''[^']+''''''''[^']+'''/gi) ;
+ var vtext = text;
+ var tofix = "";
+ split = vtext.split (/'''''[^']+''''''''[^']+'''/gi);
for (i=0; i < found.length; i++) {
- tofix = found[i].replace ("''''''''","''") ;
- modtext = modtext + split[i] + tofix ;
+ tofix = found[i].replace ("''''''''","''");
+ modtext = modtext + split[i] + tofix;
}
- return modtext + split[found.length] ;
+ return modtext + split[found.length];
}
proto.getTextArea = function() {
@@ -2676,13 +2676,13 @@
proto.do_ordered = klass.make_do('ordered');
proto.do_unordered = klass.make_do('unordered');
proto.do_hr = klass.make_do('hr');
-proto.do_timestamp = klass.make_do('timestamp') ;
+proto.do_timestamp = klass.make_do('timestamp');
proto.do_table = klass.make_do('table');
do_wikify = function() {
var selection = this.get_link_selection_text();
- if (!selection) return ;
- var self = this ;
+ if (!selection) return;
+ var self = this;
WKWAjax.post (
fixupRelativeUrl('Special:Createpage') ,
'action=check&to_check=' + selection ,
@@ -2706,7 +2706,7 @@
self.exec_command('underline', selection);
self.exec_command('ForeColor', "#" + link_color);
}
- ) ;
+ );
}
proto.do_youtube = function() {
@@ -2714,12 +2714,12 @@
if (Wikiwyg.is_ie) {
//hack to remember Caret Position in IE
this.ieRange = this.get_edit_document().selection.createRange();
- this.ieRange.moveStart ('character', -this.get_inner_html().length) ;
+ this.ieRange.moveStart ('character', -this.get_inner_html().length);
this.ieCaretPos = this.ieRange.text.length;
}
var url = prompt("Add YouTube Video. Copy and paste the video's URL or Embed code.", "");
- if (url == null) return ;
+ if (url == null) return;
if(Wikiwyg.is_ie){
// Move selection start and end to 0 position
@@ -2730,7 +2730,7 @@
self.ieRange.moveEnd ('character', 0);
self.ieRange.select ();
}
- this.insert_youtube(url) ;
+ this.insert_youtube(url);
}
proto.extract_youtube_id = function(youTubeCode) {
@@ -2761,7 +2761,7 @@
proto.do_www = function() {
var url = prompt("Enter the link or leave blank to link to selected page", "http://");
- if (url == null) return ;
+ if (url == null) return;
var old = this.config.markupRules.www[1];
this.config.markupRules.www[1] += url + " ";
@@ -2879,7 +2879,7 @@
this.list_type = [];
this.indent_level = 0;
this.no_collapse_text = false;
- dom = this.fixChangedStructure (dom) ;
+ dom = this.fixChangedStructure (dom);
this.normalizeDomWhitespace(dom);
this.normalizeDomStructure(dom);
this.walk(dom);
@@ -2890,23 +2890,23 @@
}
proto.fixChangedStructure = function (dom) {
- var divs = this.array_elements_by_tag_name (dom, 'div', false) ;
+ var divs = this.array_elements_by_tag_name (dom, 'div', false);
for (var i = 0; i < divs.length; i++) {
if (divs[i].id == "wikiwyg_toolbar") {
- divs[i].parentNode.removeChild (divs[i]) ;
+ divs[i].parentNode.removeChild (divs[i]);
}
}
- var textareas = this.array_elements_by_tag_name (dom, 'textarea', false) ;
+ var textareas = this.array_elements_by_tag_name (dom, 'textarea', false);
for (var i = 0; i < textareas.length; i++) {
- textareas[i].parentNode.removeChild (textareas[i]) ;
+ textareas[i].parentNode.removeChild (textareas[i]);
}
- var spans = this.array_elements_by_tag_name (dom, 'span', false) ;
+ var spans = this.array_elements_by_tag_name (dom, 'span', false);
for (var i = 0; i < spans.length; i++) {
if (spans[i].className == "editsection") {
- spans[i].parentNode.removeChild (spans[i]) ;
+ spans[i].parentNode.removeChild (spans[i]);
}
}
- return dom ;
+ return dom;
}
proto.normalizeDomStructure = function(dom) {
@@ -3115,7 +3115,7 @@
proto.remove_stops = function(list) {
var clean = [];
- for (var i = 0 ; i < list.length ; i++) {
+ for (var i = 0; i < list.length; i++) {
if (typeof(list[i]) != 'string') continue;
clean.push(list[i]);
}
@@ -3250,7 +3250,7 @@
this.first_indent_line = true;
this.indent_level += indents;
- this.output = defang_last_string (this.output) ;
+ this.output = defang_last_string (this.output);
this.assert_new_line();
this.walk(element);
this.indent_level -= indents;
@@ -3402,8 +3402,8 @@
proto.format_pre = klass.make_formatter('pre');
proto.format_br = function (element) {
- this.insert_new_line () ;
- this.insert_new_line () ;
+ this.insert_new_line ();
+ this.insert_new_line ();
}
proto.format_p = function(element) {
@@ -3423,11 +3423,11 @@
label = label.replace(/\s+/g, ' ');
label = label.replace(/^\s+/, '');
label = label.replace(/\s+$/, '');
- var href = element.getAttribute('href') ;
+ var href = element.getAttribute('href');
/* fix for IE's absolute url */
if (Wikiwyg.is_ie) {
if (href.indexOf(wgServer) != -1) {
- href = href.replace (wgServer, "") ;
+ href = href.replace (wgServer, "");
}
}
if (! href) href = ''; // Necessary for <a name="xyz"></a>'s
@@ -3772,9 +3772,9 @@
this.appendOutput(label);
else {
if (label != href) {
- href = href.replace (/^\/index.php\?title=/i,"?") ;
- href = href.replace (/wiki\//i, "") ;
- href = href.replace (/&action=.*$/i, "") ;
+ href = href.replace (/^\/index.php\?title=/i,"?");
+ href = href.replace (/wiki\//i, "");
+ href = href.replace (/&action=.*$/i, "");
this.appendOutput(before + href.substring(1) + '|' + label + after);
} else {
this.appendOutput(before + label + after);
@@ -3835,16 +3835,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -3865,7 +3865,7 @@
proto = new Subclass('Wikiwyg.Wysiwyg', 'Wikiwyg.Mode');
proto.classtype = 'wysiwyg';
-proto.modeDescription = wgWysiwygCaption ;
+proto.modeDescription = wgWysiwygCaption;
proto.config = {
useParentStyles: true,
@@ -3890,7 +3890,7 @@
}
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml (html);
}
proto.fromHtml = function(html) {
@@ -3915,9 +3915,9 @@
Wikiwyg.Mode.prototype.enableThis.call(this);
this.edit_iframe.style.border = '1px black solid';
if (this.edit_iframe.contentDocument) {
- this.edit_iframe.contentDocument.body.style.background = '#fff' ;
+ this.edit_iframe.contentDocument.body.style.background = '#fff';
} else {
- this.edit_iframe.document.body.style.background = '#fff' ;
+ this.edit_iframe.document.body.style.background = '#fff';
}
this.edit_iframe.width = '100%';
this.setHeightOf(this.edit_iframe);
@@ -4010,7 +4010,7 @@
proto.apply_inline_stylesheet = function(style, head) {
var style_string = "";
- for ( var i = 0 ; i < style.cssRules.length ; i++ ) {
+ for ( var i = 0; i < style.cssRules.length; i++ ) {
if ( style.cssRules[i].type == 3 ) {
// IMPORT_RULE
@@ -4092,11 +4092,11 @@
}
proto.do_bold = function () {
- this.exec_command ('bold') ;
+ this.exec_command ('bold');
}
proto.do_italic = function () {
- this.exec_command ('italic') ;
+ this.exec_command ('italic');
}
proto.do_underline = proto.exec_command;
@@ -4111,7 +4111,7 @@
}
proto.do_timestamp = function () {
- this.exec_command ('inserthtml', '~~~~') ;
+ this.exec_command ('inserthtml', '~~~~');
}
proto.do_unordered = function() {
@@ -4155,7 +4155,7 @@
url = prompt("Enter the link or leave blank to link to selected page", "");
/* if blank, get selection */
if (!url) {
- url = selection ;
+ url = selection;
}
var match = url.match(/(.*?)\b((?:http|https|ftp|irc|file):\/\/\S+)(.*)/);
if (match) {
@@ -4235,16 +4235,16 @@
COPYRIGHT:
- Copyright (c) 2005 Socialtext Corporation
+ Copyright © 2005 Socialtext Corporation
655 High Street
Palo Alto, CA 94301 U.S.A.
All rights reserved.
CHANGES AUTHOR:
- Bartek Lapinski <bartek@wikia.com>
+ Bartek Łapiński <bartek@wikia.com>
- Copyright (c) 2007, Wikia Inc.
+ Copyright © 2007, Wikia Inc.
Wikiwyg is free software.
@@ -4287,7 +4287,7 @@
}
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml (html);
}
proto.fromHtml = function(html) {
@@ -4321,7 +4321,7 @@
var loc = String(location);
if (wgArticlePath.match (/index\.php\?title=/) != '' ) {
- url = url.replace (/index\.php\//, '?title=') ;
+ url = url.replace (/index\.php\//, '?title=');
}
var base = loc.replace(/index\.php.*/, '');
if (base == loc)
@@ -4342,7 +4342,7 @@
// Wikiwyg initialization/startup code
(function() {
addEvent("onload", function() {Wikiwyg.MediaWiki.initialize()});
- window.onbeforeunload = confirmExit ;
+ window.onbeforeunload = confirmExit;
})();
//------------------------------------------------------------------------------
@@ -4363,7 +4363,7 @@
klass.wikiwyg_enabled = function() {
Wikiwyg.MediaWiki.main_edit_button = findEditLink();
- if (!wgIsArticle) return false ;
+ if (!wgIsArticle) return false;
var enabled = Cookie.get('wikiwyg_enabled');
if (! enabled) enabled = "false";
enabled = eval(enabled);
@@ -4382,7 +4382,7 @@
var wikiwyg_divs = Wikiwyg.MediaWiki.wikiwyg_divs;
for (var i = 0; i < wikiwyg_divs.length; i++) {
var div = wikiwyg_divs[i];
- var section_number = div.id.replace(/.*?(\d+)$/, '$1') ;
+ var section_number = div.id.replace(/.*?(\d+)$/, '$1');
var success = Wikiwyg.MediaWiki.enable_wikiwyg_section(
div, section_number
);
@@ -4451,15 +4451,15 @@
document.getElementById('wikiwyg_edit_' + section_number);
var edit_button = edit_button_span.getElementsByTagName('a')[0];
- edit_button.edit_button_text = wgEditCaption ;
+ edit_button.edit_button_text = wgEditCaption;
edit_button.innerHTML = edit_button.edit_button_text;
edit_button.onclick = function() {
if ((Wikiwyg.MediaWiki.sectionEdited == myWikiwyg.section_number) && Wikiwyg.MediaWiki.editInProgress) {
- myWikiwyg.cancelEdit () ;
- return false ;
+ myWikiwyg.cancelEdit ();
+ return false;
} else {
- myWikiwyg.editMode() ;
- return false ;
+ myWikiwyg.editMode();
+ return false;
}
}
Wikiwyg.MediaWiki.edit_buttons.push(edit_button);
@@ -4472,7 +4472,7 @@
var edit_button_span =
document.getElementById('wikiwyg_edit_' + section_number);
var edit_button = edit_button_span.getElementsByTagName('a')[0];
- edit_button.innerHTML = wgEditCaption ;
+ edit_button.innerHTML = wgEditCaption;
edit_button.onclick = null;
}
@@ -4501,8 +4501,8 @@
}
}
}
-// return true ;
- try {check_walk(div)} catch(e) { return false ; }
+// return true;
+ try {check_walk(div)} catch(e) { return false; }
return true;
}
@@ -4510,50 +4510,50 @@
if (Wikiwyg.MediaWiki.editInProgress) {
/* an open section exists, ask whether to abandon it or not */
/* todo check if we have any changes */
- var c = confirm ("Another section is already opened. Do you wish to discard changes and open a new one?") ;
+ var c = confirm ("Another section is already opened. Do you wish to discard changes and open a new one?");
if (c) {
- Wikiwyg.MediaWiki.instance.cancelEdit () ;
+ Wikiwyg.MediaWiki.instance.cancelEdit ();
} else {
- return ;
+ return;
}
}
- needToConfirm = true ;
+ needToConfirm = true;
Wikiwyg.MediaWiki.editInProgress = true;
- Wikiwyg.MediaWiki.sectionEdited = this.section_number ;
- Wikiwyg.MediaWiki.instance = this ;
- this.disableEditButtons (this.section_number) ;
+ Wikiwyg.MediaWiki.sectionEdited = this.section_number;
+ Wikiwyg.MediaWiki.instance = this;
+ this.disableEditButtons (this.section_number);
if ( !this.getRawPage() ) {
- Wikiwyg.MediaWiki.editInProgress = false ;
- this.enableEditButtons () ;
- return ;
+ Wikiwyg.MediaWiki.editInProgress = false;
+ this.enableEditButtons ();
+ return;
}
this.disableDoubleClicks();
if ( Wikiwyg.MediaWiki.canSupportWysiwyg(this.div) ) {
if (wgFullPageEditing == true) {
- var cookieName = "WikiwygFPEditMode" ;
+ var cookieName = "WikiwygFPEditMode";
} else {
- var cookieName = "WikiwygEditMode" ;
+ var cookieName = "WikiwygEditMode";
}
if (wgUseWysiwyg == 0) {
- var modeName = "Wikiwyg.Wikitext.MediaWiki" ;
+ var modeName = "Wikiwyg.Wikitext.MediaWiki" ;
} else {
/* change that to correspond */
if (wgDefaultMode == 'wysiwyg') {
- var modeName = 'Wikiwyg.Wysiwyg.MediaWiki' ;
+ var modeName = 'Wikiwyg.Wysiwyg.MediaWiki';
} else {
- var modeName = 'Wikiwyg.Wikitext.MediaWiki' ;
+ var modeName = 'Wikiwyg.Wikitext.MediaWiki';
}
- //var modeName = Cookie.get (cookieName) ;
+ //var modeName = Cookie.get (cookieName);
}
if ( modeName ) {
- this.first_mode = this.modeByName(modeName) ;
+ this.first_mode = this.modeByName(modeName);
} else {
- Cookie.set (cookieName, this.first_mode.classname) ;
+ Cookie.set (cookieName, this.first_mode.classname);
}
// Fake click on mode radio.
var modeRadios = this.toolbarObject.div.getElementsByTagName("input");
- for ( var i = 0; i < modeRadios.length ; i++ ) {
+ for ( var i = 0; i < modeRadios.length; i++ ) {
if( modeRadios[i].value == modeName ) {
this.toolbarObject.firstModeRadio = modeRadios[i];
break;
@@ -4561,7 +4561,7 @@
}
}
Wikiwyg.prototype.editMode.call(this);
- needToConfirm = true ;
+ needToConfirm = true;
}
proto.switchMode = function(new_mode_key) {
@@ -4571,7 +4571,7 @@
}
}
var new_mode = this.modeByName(new_mode_key);
- this.toolbarObject.changeMode () ;
+ this.toolbarObject.changeMode ();
Wikiwyg.prototype.switchMode.call(this, new_mode_key);
}
@@ -4591,8 +4591,8 @@
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
if ((i+1) == section_number) {
- button.innerHTML = wgCancelCaption ;
- button.parentNode.style.display = 'none' ;
+ button.innerHTML = wgCancelCaption;
+ button.parentNode.style.display = 'none';
}
}
}
@@ -4609,37 +4609,37 @@
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
button.innerHTML = button.edit_button_text;
- button.parentNode.style.display = 'inline' ;
+ button.parentNode.style.display = 'inline';
}
}
proto.getRawPage = function() {
-// if (this.config.modeClasses[0].match(/Wysiwyg/)) return true ;
+// if (this.config.modeClasses[0].match(/Wysiwyg/)) return true;
if (! this.raw_section_orig) {
this.raw_section_orig = this.get_raw_section();
}
this.raw_section = this.raw_section_orig;
if (!this.raw_section) {
- return false ;
+ return false;
}
- return true ;
+ return true;
}
proto.get_raw_section = function() {
var url = location.toString().replace(/#.*/, '');
/* look out for titles already containing title... */
if (url.match ('/title/') != '') {
- var correctPath = '' ;
+ var correctPath = '';
if (wgArticlePath.match (/\/\$1/) != '') {
- correctPath = wgArticlePath.replace (/\$1/, '') ;
+ correctPath = wgArticlePath.replace (/\$1/, '');
if(wgArticlePath.indexOf('?') > 0) {
- url = wgServer + correctPath + encodeURI(wgPageName) + "&action=edit" + "§ion=" + this.section_number ;
+ url = wgServer + correctPath + encodeURI(wgPageName) + "&action=edit" + "§ion=" + this.section_number;
} else {
- url = wgServer + correctPath + encodeURI(wgPageName) + "?action=edit" + "§ion=" + this.section_number ;
+ url = wgServer + correctPath + encodeURI(wgPageName) + "?action=edit" + "§ion=" + this.section_number;
}
} else {
- correctPath = wgArticlePath.replace (/\?title=\$1/, '') ;
- url = wgServer + correctPath + "?title=" + encodeURI(wgPageName) + "&action=edit" + "§ion=" + this.section_number ;
+ correctPath = wgArticlePath.replace (/\?title=\$1/, '');
+ url = wgServer + correctPath + "?title=" + encodeURI(wgPageName) + "&action=edit" + "§ion=" + this.section_number;
}
} else {
var page_title = url.replace(/.*index\.php\/(\w+).*/, '$1');
@@ -4656,7 +4656,7 @@
it won't actually save, but will it look nice?
*/
if (html.match (/<textarea[^>]*?readonly=\"readonly\"[^>]*?>/) ) {
- return false ;
+ return false;
}
/* fetch things like wpStarttime and wpEdittime _here_
@@ -4664,26 +4664,26 @@
var matched_sttime = html.match(
/<input[^>]*? name=\"wpStarttime\" \/>/
- ) ;
+ );
var matched_edtime = html.match(
/<input[^>]*? name=\"wpEdittime\" \/>/
- ) ;
+ );
if (matched_sttime && matched_edtime) {
- var starttime = matched_sttime[0] ;
- var edittime = matched_edtime[0] ;
+ var starttime = matched_sttime[0];
+ var edittime = matched_edtime[0];
starttime = starttime.match (
/[0-9]+/
- ) ;
+ );
edittime = edittime.match (
/[0-9]+/
- ) ;
- var starttime = starttime[0] ;
- var edittime = edittime[0] ;
- Wikiwyg.MediaWiki.starttime = starttime ;
- Wikiwyg.MediaWiki.edittime = edittime ;
+ );
+ var starttime = starttime[0];
+ var edittime = edittime[0];
+ Wikiwyg.MediaWiki.starttime = starttime;
+ Wikiwyg.MediaWiki.edittime = edittime;
}
var raw_text = html.replace(
@@ -4695,7 +4695,7 @@
.replace(/\</g, '<')
.replace(/\>/g, '>')
.replace(/\&/g, '&')
- .replace(/\"/g,'"') ;
+ .replace(/\"/g,'"');
return raw_text;
// XXX Use code like this when action=raw is fixed in 1.7a
@@ -4710,7 +4710,7 @@
function(e) { return e.id.match(/^wikiwyg_section_\d+$/) }
);
this.wikiwyg_divs_ondblclick = new Array();
- for ( var i = 0 ; i < wikiwyg_divs.length ; i++ ) {
+ for ( var i = 0; i < wikiwyg_divs.length; i++ ) {
this.wikiwyg_divs_ondblclick[i] = wikiwyg_divs[i].ondblclick;
wikiwyg_divs[i].ondblclick = function() {return false; };
}
@@ -4731,23 +4731,23 @@
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
button.innerHTML = button.edit_button_text;
- button.parentNode.style.display = 'inline' ;
+ button.parentNode.style.display = 'inline';
}
var wikiwyg_divs = grepElementsByTag('span',
function(e) { return e.id.match(/^wikiwyg_section_\d+$/) }
);
- for ( var i = 0 ; i < wikiwyg_divs.length ; i++ ) {
+ for ( var i = 0; i < wikiwyg_divs.length; i++ ) {
wikiwyg_divs[i].ondblclick = this.wikiwyg_divs_ondblclick[i];
}
/* if show diff, disable it */
- var diff_div = document.getElementById ('wikiwyg_diff_wrapper') ;
+ var diff_div = document.getElementById ('wikiwyg_diff_wrapper');
if (diff_div) {
- this.toolbarObject.rebuildDiffs () ;
+ this.toolbarObject.rebuildDiffs ();
}
if (this.current_mode.classname.match(/Preview/)) {
- this.toolbarObject.rebuild () ;
+ this.toolbarObject.rebuild ();
}
- needToConfirm = false ;
+ needToConfirm = false;
}
proto.get_page_title = function() {
@@ -4757,7 +4757,7 @@
// XXX This all seems so fragile and crufty...
proto.submit_action_form = function(action, value) {
var self = this;
- var page_title = wgPageName ;
+ var page_title = wgPageName;
var url = fixupRelativeUrl(
'index.php?title=' + page_title + '&action=edit§ion=' + this.section_number
);
@@ -4794,17 +4794,17 @@
? IFrameObj.contentWindow.document
: IFrameObj.contentDocument;
form.wpTextbox1.value = value.wpTextbox1;
- form.wpSummary.value = value.wpSummary ;
+ form.wpSummary.value = value.wpSummary;
if (typeof wgUserName == 'string') {
- form.wpMinoredit.value = 1 ;
- form.wpWatchthis.value = 1 ;
+ form.wpMinoredit.value = 1;
+ form.wpWatchthis.value = 1;
/* checkboxes, ah */
- form.wpMinoredit.checked = value.wpMinoredit ;
- form.wpWatchthis.checked = value.wpWatchthis ;
+ form.wpMinoredit.checked = value.wpMinoredit;
+ form.wpWatchthis.checked = value.wpWatchthis;
}
/* also give variables needed for edit conflicts... */
- form.wpEdittime.value = Wikiwyg.MediaWiki.edittime ;
- form.wpStarttime.value = Wikiwyg.MediaWiki.starttime ;
+ form.wpEdittime.value = Wikiwyg.MediaWiki.edittime;
+ form.wpStarttime.value = Wikiwyg.MediaWiki.starttime;
form.submit();
wait(function() {
// fix this up to *always* write
@@ -4813,16 +4813,16 @@
// Without remove tempIFrame here, the page scrolls down
// to the bottom, where the tempIFrame is located.
// document.body.removeChild(tempIFrame);
- self.cancelEdit () ;
+ self.cancelEdit ();
// XXX CrappyHack for save until we figure out how
// to submit without iframe.
setTimeout(function() {
// With this setTimeout it avoids page for being cached.
// Without this setTimeout the reloaded page is usually
// a cached one, weird.
- document.body.removeChild(tempIFrame) ;
- form.reset() ;
- location.reload() ;
+ document.body.removeChild(tempIFrame);
+ form.reset();
+ location.reload();
}, 400);
});
}
@@ -4830,16 +4830,16 @@
}
proto.imageUpload = function (tagOpen, tagClose, sampleText) {
- Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText) ;
+ Wikiwyg.prototype.imageUpload.call (this, tagOpen, tagClose, sampleText);
}
proto.saveChanges = function() {
- var page_title = encodeURI(wgPageName) ;
- var summary = document.getElementById ('wpSummary_'+ this.section_number).value ;
+ var page_title = encodeURI(wgPageName);
+ var summary = document.getElementById ('wpSummary_'+ this.section_number).value;
var self = this;
if (typeof wgUserName == 'string') {
- var minoredit = document.getElementById ('wpMinoredit_'+ this.section_number).checked ;
- var watchthis = document.getElementById ('wpWatchthis_'+ this.section_number).checked ;
+ var minoredit = document.getElementById ('wpMinoredit_'+ this.section_number).checked;
+ var watchthis = document.getElementById ('wpWatchthis_'+ this.section_number).checked;
var submit_changes = function(wikitext) {
self.submit_action_form(
fixupRelativeUrl('index.php'),
@@ -4975,7 +4975,7 @@
style.textDecoration = "blink";
style.color = "green";
style.background = "#fff";
- style.fontWeight = "bold" ;
+ style.fontWeight = "bold";
style.width = WKWgetStyle(this.div, "width");
style.height = WKWgetStyle(this.div, "height");
style.marginTop = WKWgetStyle(this.div, "margin-top")
@@ -4997,7 +4997,7 @@
proto.getButtons = function() {
var buttons = new Array();
var b = this.div.childNodes;
- for ( var i = 0 ; i < b.length ; i++ ) {
+ for ( var i = 0; i < b.length; i++ ) {
if ( b[i].className && b[i].className.match(/wikiwyg_button/) ) {
buttons.push(b[i]);
}
@@ -5008,7 +5008,7 @@
proto.disableButtons = function (section_number) {
var buttons = this.getButtons();
this.button_handlers = new Array();
- for ( var i = 0 ; i < buttons.length ; i++ ) {
+ for ( var i = 0; i < buttons.length; i++ ) {
buttons[i].className = "wikiwyg_button_disabled";
this.button_handlers.push(buttons[i].onclick);
buttons[i].onclick = function() { return false;};
@@ -5018,7 +5018,7 @@
proto.enableButtons = function() {
if ( !this.button_handlers ) { return; }
var buttons = this.getButtons();
- for ( var i = 0 ; i < buttons.length ; i++ ) {
+ for ( var i = 0; i < buttons.length; i++ ) {
buttons[i].className = "wikiwyg_button";
buttons[i].onclick = this.button_handlers[i];
}
@@ -5051,34 +5051,34 @@
proto.initHtml = function(html) {
var dom = document.createElement('div');
dom.innerHTML = html;
- var myInstance = Wikiwyg.MediaWiki.instance ;
- var wikitext_mode = myInstance.mode_objects['Wikiwyg.Wikitext.MediaWiki'] ;
- wikitext_mode.fixChangedStructure (dom) ;
- var fixed_content = myInstance.raw_section ;
+ var myInstance = Wikiwyg.MediaWiki.instance;
+ var wikitext_mode = myInstance.mode_objects['Wikiwyg.Wikitext.MediaWiki'];
+ wikitext_mode.fixChangedStructure (dom);
+ var fixed_content = myInstance.raw_section;
// do things with stuff here
- fixed_content = this.disableTemplates (fixed_content) ;
- var self = this ;
+ fixed_content = this.disableTemplates (fixed_content);
+ var self = this;
wikitext_mode.convertWikitextToHtml (
fixed_content,
function (html) {
- self.set_inner_html (self.sanitize_html (html) ) ;
+ self.set_inner_html (self.sanitize_html (html) );
}
- ) ;
+ );
}
// for future use
proto.disableTemplates = function (wikitext) {
- wikitext = wikitext.replace (/\{\{.+\}\}/gi, '') ;
- return wikitext ;
+ wikitext = wikitext.replace (/\{\{.+\}\}/gi, '');
+ return wikitext;
}
proto.fromHtml = function(html) {
var dom = document.createElement('div');
dom.innerHTML = html;
- var myInstance = Wikiwyg.MediaWiki.instance ;
- var wikitext_mode = myInstance.mode_objects['Wikiwyg.Wikitext.MediaWiki'] ;
- wikitext_mode.fixChangedStructure (dom) ;
- html = dom.innerHTML ;
+ var myInstance = Wikiwyg.MediaWiki.instance;
+ var wikitext_mode = myInstance.mode_objects['Wikiwyg.Wikitext.MediaWiki'];
+ wikitext_mode.fixChangedStructure (dom);
+ html = dom.innerHTML;
this.set_inner_html(this.sanitize_html(html));
}
@@ -5087,11 +5087,11 @@
proto = new Subclass('Wikiwyg.Wikitext.MediaWiki', 'Wikiwyg.Wikitext');
proto.initHtml = function (html) {
- this.fromHtml (html) ;
+ this.fromHtml (html);
}
proto.fromHtml = function(html) {
-// this.wikiwyg.previous_mode.classname ;
+// this.wikiwyg.previous_mode.classname;
if (!this.wikiwyg.previous_mode) {
this.setTextArea(this.wikiwyg.raw_section);
delete this.wikiwyg.raw_section;