mirror of
https://bitbucket.org/vertlach/iusethis.git
synced 2024-06-17 07:30:50 +03:00
The extension works now
This commit is contained in:
parent
46057f1427
commit
da278d02c2
7
IUT.js
7
IUT.js
|
@ -28,13 +28,12 @@ var IUT = function IUT() {
|
|||
action: 'iusethis',
|
||||
format: 'json',
|
||||
what: 'vote',
|
||||
pageId: PageID,
|
||||
voteValue: TheVote
|
||||
pageId: PageID
|
||||
} ).done( function( data ) {
|
||||
$( '#PollVotes' ).html( data.iusethis.result );
|
||||
$( '#Answer' ).html(
|
||||
'<a href="javascript:void(0);" class="vote-unvote-link">' +
|
||||
mediaWiki.msg( 'iusethis-unvote-link' ) + '</a>'
|
||||
mw.msg( 'iusethis-unvote-link' ) + '</a>'
|
||||
);
|
||||
} );
|
||||
};
|
||||
|
@ -54,7 +53,7 @@ var IUT = function IUT() {
|
|||
$( '#PollVotes' ).html( data.iusethis.result );
|
||||
$( '#Answer' ).html(
|
||||
'<a href="javascript:void(0);" class="vote-vote-link">' +
|
||||
mediaWiki.msg( 'iusethis-link' ) + '</a>'
|
||||
mw.msg( 'iusethis-link' ) + '</a>'
|
||||
);
|
||||
} );
|
||||
};
|
||||
|
|
15
IUTClass.php
15
IUTClass.php
|
@ -136,13 +136,14 @@ class IUT {
|
|||
$dbr = wfGetDB( DB_SLAVE );
|
||||
$s = $dbr->selectRow(
|
||||
'IUseThis',
|
||||
'COUNT(*) as count',
|
||||
array(
|
||||
'vote_page_id' => $this->PageID,
|
||||
'username' => $this->Username
|
||||
),
|
||||
__METHOD__
|
||||
);
|
||||
if ( $s === false ) {
|
||||
if ( $s->count === "0" ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -159,12 +160,12 @@ class IUT {
|
|||
$voted = $this->UserAlreadyVoted();
|
||||
|
||||
$make_vote_box_clickable = '';
|
||||
if ( $voted == false ) {
|
||||
if ( $voted === false ) {
|
||||
$make_vote_box_clickable = ' vote-clickable';
|
||||
}
|
||||
|
||||
$output = "<div class=\"vote-box{$make_vote_box_clickable}\" id=\"votebox\">";
|
||||
$output .= '<span id="PollVotes" class="vote-number">' . $this->count() . ' people use this joke </span>';
|
||||
$output .= '<span id="PollVotes" class="vote-number">' . $this->count() . ' ' . wfMessage('people-count')->parse() . ' </span>';
|
||||
$output .= '<span id="Answer" class="vote-action">';
|
||||
|
||||
if ( !$wgUser->isAllowed( 'iusethis' ) ) {
|
||||
|
@ -174,15 +175,15 @@ class IUT {
|
|||
$login = SpecialPage::getTitleFor( 'Userlogin' );
|
||||
$output .= '<a class="votebutton" href="' .
|
||||
htmlspecialchars( $login->getFullURL() ) . '" rel="nofollow">' .
|
||||
"I use this" . '</a>';
|
||||
wfMessage('iusethis-link')->parse() . '</a>';
|
||||
} else {
|
||||
if ( !wfReadOnly() ) {
|
||||
if ( $voted == false ) {
|
||||
if ( $voted === false ) {
|
||||
$output .= '<a href="javascript:void(0);" class="vote-vote-link">' .
|
||||
"I use this" . '</a>';
|
||||
wfMessage('iusethis-link')->parse() . '</a>';
|
||||
} else {
|
||||
$output .= '<a href="javascript:void(0);" class="vote-unvote-link">' .
|
||||
"I don't use this" . '</a>';
|
||||
wfMessage('iusethis-unvote-link')->parse() . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
"David Pean <david.pean@gmail.com>"
|
||||
]
|
||||
},
|
||||
"iusethis-link": "I use this",
|
||||
"iusethis-unvote-link": "I don't use this",
|
||||
"iusethis-link": "I do",
|
||||
"iusethis-unvote-link": "I don't",
|
||||
"iusethis-remove": "remove",
|
||||
"right-iusethis": "Vote for 'I use this'"
|
||||
"right-iusethis": "Vote for 'I use this'",
|
||||
"people-count": "people use this joke."
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue