FastLizard4 has submitted this change and it was merged.
Change subject: Minor edits, obsessing over whitespace
......................................................................
Minor edits, obsessing over whitespace
A minor edit to the JavaScript for updating the character count residing at
js/ext.CommunityTwitter.updatecount.js that gets to the point and attaches the
updateCount function
to the onkeyup event without function declaring/calling convoluting. This
commit also adds more whitespace
in and also includes some comments to aid in reading the JavaScript function.
Additionally,
a braceless if-statement in CommunityTwitter.php was rewritten with braces for
safety.
Furthermore, whitespace has been converted to tabs where appropriate in the
extension and
extraneous spaces have been removed. Tldr: To-may-to, to-mah-to.
Change-Id: I8b51ba617508d4303cfa12d0d5e8a1ae86144d16
---
M CommunityTwitter.i18n.php
M CommunityTwitter.php
M CommunityTwitter_body.php
M css/ext.CommunityTwitter.css
M js/ext.CommunityTwitter.updatecount.js
5 files changed, 65 insertions(+), 51 deletions(-)
Approvals:
FastLizard4: Verified; Looks good to me, approved
diff --git a/CommunityTwitter.i18n.php b/CommunityTwitter.i18n.php
index 0e145ae..e60dbde 100755
--- a/CommunityTwitter.i18n.php
+++ b/CommunityTwitter.i18n.php
@@ -11,18 +11,18 @@
*
* Integration in personal Menu by Yaron Koren ("Admin Links",
* http://www.mediawiki.org/wiki/Extension:Admin_Links).
- *
+ *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
diff --git a/CommunityTwitter.php b/CommunityTwitter.php
index d42265b..a3fa3e3 100755
--- a/CommunityTwitter.php
+++ b/CommunityTwitter.php
@@ -11,18 +11,18 @@
*
* Integration in personal Menu by Yaron Koren ("Admin Links",
* http://www.mediawiki.org/wiki/Extension:Admin_Links).
- *
+ *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
@@ -71,7 +71,8 @@
$wgHooks['PersonalUrls'][] = 'CommunityTwitter::addURLToUserLinks';
$wgAvailableRights[] = 'twitter';
// Only members of defined group see the link to the twitter special page
-if(isset($ctAllowedGroup) === false)
+if(isset($ctAllowedGroup) === false) {
$ctAllowedGroup = 'sysop';
+}
$wgGroupPermissions[$ctAllowedGroup]['twitter'] = true;
$wgAutoloadClasses['CommunityTwitter'] = $wgtwitterIP .
'CommunityTwitter_body.php';
diff --git a/CommunityTwitter_body.php b/CommunityTwitter_body.php
index 7b6b1ce..3b9a9d0 100755
--- a/CommunityTwitter_body.php
+++ b/CommunityTwitter_body.php
@@ -11,18 +11,18 @@
*
* Integration in personal Menu by Yaron Koren ("Admin Links",
* http://www.mediawiki.org/wiki/Extension:Admin_Links).
- *
+ *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
@@ -92,7 +92,7 @@
// Load ResourceLoader modules, CSS with
addModuleStyles since functionality will work without JS
$wgOut->addModuleStyles(
'ext.CommunityTwitter.styles' );
- $wgOut->addModules(
'ext.CommunityTwitter.updatecount' );
+ $wgOut->addModules(
'ext.CommunityTwitter.updatecount' );
// Establish Twitter-connections
$connections = array();
@@ -241,7 +241,7 @@
}
}
- // Add a link to the special 'AdminLinks' page among the user's
"personal URLs" at the top
+ // Add a link to the special 'AdminLinks' page among the user's
"personal URLs" at the top
// Source: "Admin Links" by Yaron Koren
(http://www.mediawiki.org/wiki/Extension:Admin_Links) (customized)
public static function addURLToUserLinks( &$personal_urls, &$title ) {
global $wgUser;
diff --git a/css/ext.CommunityTwitter.css b/css/ext.CommunityTwitter.css
index b4540b6..e097144 100644
--- a/css/ext.CommunityTwitter.css
+++ b/css/ext.CommunityTwitter.css
@@ -1,58 +1,58 @@
/*
-Start: Community Twitter Extension CSS
+Start: Special:CommunityTwitter Extension CSS
*/
/* Style submit button like a normal link by Dan Schulz
(http://forums.digitalpoint.com/showthread.php?t=403667#post3882723) */
.submit {
- background: transparent;
- border-top: 0;
- border-right: 0;
- border-bottom: 1px solid #00F;
- border-left: 0;
- color: #00F;
- display: inline;
- margin: 0;
- padding: 0;
+ background: transparent;
+ border-top: 0;
+ border-right: 0;
+ border-bottom: 1px solid #00F;
+ border-left: 0;
+ color: #00F;
+ display: inline;
+ margin: 0;
+ padding: 0;
}
/* hack needed for IE 7 */
*:first-child+html .submit {
- border-bottom: 0;
- text-decoration: underline;
+ border-bottom: 0;
+ text-decoration: underline;
}
/* hack needed for IE 5/6 */
* html .submit {
- border-bottom: 0;
- text-decoration: underline;
+ border-bottom: 0;
+ text-decoration: underline;
}
.ct-error {
- color: #FF0000;
+ color: #FF0000;
}
.ct-info {
- color: #B3B3B3;
+ color: #B3B3B3;
}
.ct-success {
- color: #006600;
+ color: #006600;
}
span.ct-tweet {
- text-align: right;
- margin: 10px 25px 10px 25px;
- float: right;
+ text-align: right;
+ margin: 10px 25px 10px 25px;
+ float: right;
}
table.ct-tweet-section {
- width: 550px;
- height: 100px;
+ width: 550px;
+ height: 100px;
}
td.ct-tweet-section {
- text-align: center;
+ text-align: center;
}
textarea.ct-tweet-input{
- width: 490px;
- height: 50px;
+ width: 490px;
+ height: 50px;
}
table.ct-last-tweets {
- width: 550px;
+ width: 550px;
}
-
+
/*
-End: Community Twitter Extension CSS
-*/
\ No newline at end of file
+End: Special:CommunityTwitter Extension CSS
+*/
diff --git a/js/ext.CommunityTwitter.updatecount.js
b/js/ext.CommunityTwitter.updatecount.js
index 0eb70dc..2d1e8d2 100644
--- a/js/ext.CommunityTwitter.updatecount.js
+++ b/js/ext.CommunityTwitter.updatecount.js
@@ -1,21 +1,34 @@
-document.getElementById('status').onkeyup=function(){updateCount()};
+/**
+ * A simple function that updates the characters remaining count for tweeters
+ * so that they don't end up going over the 140-character limit.
+ * Adds some colors to grab the user's attention too.
+ * Notes for ids: 'status' refers to the textarea element for status
+ * update box, 'stringlength' refers to a strong element enclosing the default
+ * 140 characters remaining output on initial load, and 'tweetbutton' is mostly
+ * self-explanatory (for reference, an input element of type submit).
+**/
+document.getElementById('status').onkeyup = function () {
-function updateCount() {
+ // get the text box, count output, and tweet button via DOM and store
as variables
+
var ctStatusInput = document.getElementById('status');
var ctCountOutput = document.getElementById('stringlength');
var ctTweetButton = document.getElementById('tweetbutton');
- var ctCharsLeft = 140 - ctStatusInput.value.length;
+ var ctCharsLeft = 140 - ctStatusInput.value.length; // get the numbmer
of characters left from the text box
+
+ // using the number of chars, change count output color and
disable/enable tweet button as needed
+
if ( ctCharsLeft < 0 ) {
- ctCountOutput.style.color = 'red';
- ctTweetButton.setAttribute( 'disabled', 'disabled' );
+ ctCountOutput.style.color = 'red'; // red means bad
+ ctTweetButton.setAttribute( 'disabled', 'disabled' ); //
disables Tweet button
} else {
- ctTweetButton.removeAttribute( 'disabled' );
+ ctTweetButton.removeAttribute( 'disabled' ); // enables Tweet
button
if ( ctCharsLeft < 25 ) {
- ctCountOutput.style.color = '#CC0';
+ ctCountOutput.style.color = '#CC0'; // yellow
} else {
- ctCountOutput.style.color = 'inherit';
+ ctCountOutput.style.color = 'inherit'; // default
}
}
- ctCountOutput.innerHTML = ctCharsLeft;
-};
+ ctCountOutput.innerHTML = ctCharsLeft; // output the count
+}
--
To view, visit https://gerrit.wikimedia.org/r/65119
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8b51ba617508d4303cfa12d0d5e8a1ae86144d16
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CommunityTwitter
Gerrit-Branch: master
Gerrit-Owner: RAN1 <[email protected]>
Gerrit-Reviewer: FastLizard4 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits