From: Brion Vibber Date: Fri, 9 May 2008 20:51:32 +0000 (+0000) Subject: Split page history radio button tweaks out from wikibits.js to history.js X-Git-Tag: 1.31.0-rc.0~47767 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=df8b5502bcacb067cbf4026294d1c0e0712d76a5;p=lhc%2Fweb%2Fwiklou.git Split page history radio button tweaks out from wikibits.js to history.js Only include it when it's needed -- don't force it on every reader! --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5992757577..81a71491c3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1347,7 +1347,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '142'; +$wgStyleVersion = '143'; # Server-side caching: diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 1002d7b574..13b021c71d 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -81,6 +81,7 @@ class PageHistory { $wgOut->setRobotpolicy( 'noindex,nofollow' ); $wgOut->setSyndicated( true ); $wgOut->setFeedAppendQuery( 'action=history' ); + $wgOut->addScriptFile( 'history.js' ); $logPage = SpecialPage::getTitleFor( 'Log' ); $logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() ); diff --git a/skins/common/history.js b/skins/common/history.js new file mode 100644 index 0000000000..57e6184918 --- /dev/null +++ b/skins/common/history.js @@ -0,0 +1,83 @@ +function historyRadios(parent) { + var inputs = parent.getElementsByTagName('input'); + var radios = []; + for (var i = 0; i < inputs.length; i++) { + if (inputs[i].name == "diff" || inputs[i].name == "oldid") { + radios[radios.length] = inputs[i]; + } + } + return radios; +} + +// check selection and tweak visibility/class onclick +function diffcheck() { + var dli = false; // the li where the diff radio is checked + var oli = false; // the li where the oldid radio is checked + var hf = document.getElementById('pagehistory'); + if (!hf) { + return true; + } + var lis = hf.getElementsByTagName('li'); + for (var i=0;i