Luis Felipe Schenone has submitted this change and it was merged.
Change subject: Submitting the basic extension files
......................................................................
Submitting the basic extension files
Change-Id: Ibe34b71d66a5f6e21d0ffd288f5d9487ae4ca22b
---
A SectionDisqus.body.php
A SectionDisqus.css
A SectionDisqus.i18n.php
A SectionDisqus.js
A SectionDisqus.php
5 files changed, 124 insertions(+), 0 deletions(-)
Approvals:
Luis Felipe Schenone: Verified; Looks good to me, approved
diff --git a/SectionDisqus.body.php b/SectionDisqus.body.php
new file mode 100644
index 0000000..e46f604
--- /dev/null
+++ b/SectionDisqus.body.php
@@ -0,0 +1,32 @@
+<?php
+
+class SectionDisqus {
+
+ static function addResources( &$out ) {
+ $out->addModules( 'ext.SectionDisqus' );
+ return true;
+ }
+
+ static function addDisqusButton( $skin, $title, $section, $tooltip,
&$result ) {
+ $result .= ' <span class="disqus_button">[ <a
onclick="window.showDisqusDialog(\'' . $tooltip . '\');">disqus</a> ]</span>';
+ return true;
+ }
+
+ static function addDisqusDialog( &$data ) {
+ global $wgSectionDisqusShortname;
+ $data .= '<div id="disqus_dialog" title="Discuss this
section"><div id="disqus_thread"></div></div>';
+ $data .= '<script type="text/javascript">
+
+ var disqus_shortname = "' . $wgSectionDisqusShortname .
'";
+
+ (function() {
+ var dsq = document.createElement("script");
+ dsq.type = "text/javascript";
+ dsq.async = true;
+ dsq.src = "//" + disqus_shortname +
".disqus.com/embed.js";
+
document.getElementsByTagName("body")[0].appendChild(dsq);
+ })();
+ </script>';
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/SectionDisqus.css b/SectionDisqus.css
new file mode 100644
index 0000000..5ee6210
--- /dev/null
+++ b/SectionDisqus.css
@@ -0,0 +1,9 @@
+.disqus_button {
+ cursor: pointer;
+ font-size: small;
+ font-weight: normal;
+}
+
+#disqus_dialog {
+ display: none;
+}
\ No newline at end of file
diff --git a/SectionDisqus.i18n.php b/SectionDisqus.i18n.php
new file mode 100644
index 0000000..509e78f
--- /dev/null
+++ b/SectionDisqus.i18n.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Internationalisation for SectionDisqus extension
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+$messages = array();
+
+/** English
+ * @author Luis Felipe Schenone
+ */
+$messages['en'] = array(
+ 'sectiondisqus-desc' => 'Adds a "Discuss" button next to the "Edit"
button of every section, that when clicked, opens a Disqus lightbox for that
section.',
+);
+
+/** Message documentation (Message documentation)
+ * @author Raimond Spekking
+ * @author Shirayuki
+ */
+$messages['qqq'] = array(
+ 'sectiondisqus-desc' =>
'{{desc|name=SectionDisqus|url=http://www.mediawiki.org/wiki/Extension:HoverGallery}}',
+);
+
+/** Spanish (español)
+ * @author Luis Felipe Schenone
+ */
+$messages['es'] = array(
+ 'sectiondisqus-desc' => 'Añade un botón "Discutir" junto al botón
"Editar" de cada sección, que al clickearlo, abre una ventana de discusión para
esa sección.',
+);
diff --git a/SectionDisqus.js b/SectionDisqus.js
new file mode 100644
index 0000000..2b11644
--- /dev/null
+++ b/SectionDisqus.js
@@ -0,0 +1,15 @@
+window.showDisqusDialog = function( tooltip ) {
+
+ $( '#disqus_dialog' ).dialog({'width':800,'position':'top'});
+
+ //Use the URL (without parameters) plus the section tooltip as
identifier
+ var identifier = location.protocol + '//' + location.hostname +
location.pathname + '#!' + tooltip;
+
+ //Reset Disqus to show the thread corresponding to the clicked section
+ DISQUS.reset({
+ reload: true,
+ config: function () {
+ this.page.identifier = identifier;
+ }
+ });
+}
\ No newline at end of file
diff --git a/SectionDisqus.php b/SectionDisqus.php
new file mode 100644
index 0000000..ff28796
--- /dev/null
+++ b/SectionDisqus.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * SectionDisqus extension
+ *
+ * @file
+ * @ingroup Extensions
+ *
+ * @author Luis Felipe Schenone <[email protected]>
+ * @license GPL v2 or later
+ * @version 0.1
+ */
+
+$wgExtensionCredits['specialpage'][] = array(
+ 'path' => __FILE__,
+ 'name' => 'SectionDisqus',
+ 'description' => 'Adds a "disqus" button next to the "edit" button
of every section, that when clicked, opens a Disqus dialog for that section.',
+ 'descriptionmsg' => 'sectiondisqus-desc',
+ 'version' => '0.1',
+ 'author' => 'Luis Felipe Schenone',
+ 'url' =>
'http://www.mediawiki.org/wiki/Extension:SectionDisqus'
+);
+
+$wgResourceModules['ext.SectionDisqus'] = array(
+ 'scripts' => 'SectionDisqus.js',
+ 'styles' => 'SectionDisqus.css',
+ 'position' => 'top',
+ 'dependencies' => array( 'jquery.ui.dialog' ),
+ 'localBasePath' => __DIR__,
+ 'remoteExtPath' => 'SectionDisqus',
+);
+
+$wgExtensionMessagesFiles['SectionDisqus'] = __DIR__ .
'/SectionDisqus.i18n.php';
+$wgAutoloadClasses['SectionDisqus'] = __DIR__ . '/SectionDisqus.body.php';
+
+$wgHooks['BeforePageDisplay'][] = 'SectionDisqus::addResources';
+$wgHooks['DoEditSectionLink'][] = 'SectionDisqus::addDisqusButton';
+$wgHooks['SkinAfterContent'][] = 'SectionDisqus::addDisqusDialog';
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/79760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe34b71d66a5f6e21d0ffd288f5d9487ae4ca22b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SectionDisqus
Gerrit-Branch: master
Gerrit-Owner: Luis Felipe Schenone <[email protected]>
Gerrit-Reviewer: Luis Felipe Schenone <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits