r62162 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62161‎ | r62162 | r62163 >
Date:03:28, 9 February 2010
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads JS updates:
* Fix link-to dialog.
* Refactor link-to dialog to be generic.
* Use link-to dialog for summaries, too.
* Move a bunch of thread-setup binds into live binds instead.
Modified paths:
  • /trunk/extensions/LiquidThreads/api/ApiFeedLQTThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.css
@@ -79,7 +79,7 @@
8080 font-weight: bold;
8181 }
8282
83 -.lqt_thread_permalink_summary_edit {
 83+.lqt_thread_permalink_summary_actions {
8484 float: right;
8585 margin-right: 1em;
8686 font-weight: normal;
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -1673,12 +1673,14 @@
16741674 $label
16751675 );
16761676
1677 - $link = $sk->link( $t->summary()->getTitle(), $link_text );
 1677+ $link = $sk->link( $t->summary()->getTitle(), $link_text,
 1678+ array( 'class' => 'lqt-summary-link' ) );
 1679+ $link .= Xml::hidden( 'summary-title', $t->summary()->getTitle()->getPrefixedText() );
16781680 $edit_link = self::permalink( $t, $edit_text, 'summarize', $t->id() );
16791681 $links = "[$link]\n[$edit_link]";
16801682 $html .= Xml::tags(
16811683 'span',
1682 - array( 'class' => 'lqt_thread_permalink_summary_edit' ),
 1684+ array( 'class' => 'lqt_thread_permalink_summary_actions' ),
16831685 $links
16841686 );
16851687
Index: trunk/extensions/LiquidThreads/api/ApiFeedLQTThreads.php
@@ -41,7 +41,7 @@
4242 }
4343
4444 /**
45 - * Make a nested call to the API to request watchlist items in the last $hours.
 45+ * Make a nested call to the API to request items in the last $hours.
4646 * Wrap the result as an RSS/Atom feed.
4747 */
4848 public function execute() {
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -284,20 +284,6 @@
285285 return false;
286286 },
287287
288 - 'addQuoteButton' : function( toolbar ) {
289 - var quoteButton = $j('<li/>' );
290 - quoteButton.addClass('lqt-command');
291 - quoteButton.addClass('lqt-command-quote');
292 -
293 - var link = $j('<a href="#"/>');
294 - link.append( wgLqtMessages['lqt-quote'] );
295 - quoteButton.append( link );
296 -
297 - quoteButton.click( liquidThreads.doQuote );
298 -
299 - $j(toolbar).prepend( quoteButton );
300 - },
301 -
302288 'cancelEdit' : function( e ) {
303289 if ( typeof e != 'undefined' && typeof e.preventDefault == 'function' ) {
304290 e.preventDefault();
@@ -326,10 +312,6 @@
327313 var menuContainer = post.find( '.lqt-thread-toolbar-menu' );
328314 menu.remove().appendTo( menuContainer );
329315 menuContainer.find('.lqt-thread-toolbar-command-list').hide();
330 -
331 - // Add handler for edit link -- Disabled for further tweaking
332 -// var editLink = menu.find('.lqt-command-edit > a');
333 -// editLink.click( liquidThreads.handleEditLink );
334316
335317 // Add handler for reply link
336318 var replyLink = menu.find('.lqt-command-reply > a');
@@ -687,15 +669,6 @@
688670
689671 liquidThreads.setupThreadMenu( menu, threadId );
690672 }
691 -
692 - // Check for a "show replies" button
693 - $j(threadContainer).find('a.lqt-show-replies').click( liquidThreads.showReplies );
694 -
695 - // "Show more posts" link
696 - $j(threadContainer).find('a.lqt-show-more-posts').click( liquidThreads.showMore );
697 -
698 - // Handler for "Link to this" button
699 - $j(threadContainer).find('.lqt-command-link').click( liquidThreads.showLinkWindow );
700673 },
701674
702675 'showReplies' : function(e) {
@@ -829,19 +802,33 @@
830803 e.preventDefault();
831804 },
832805
833 - 'showLinkWindow' : function(e) {
 806+ 'showThreadLinkWindow' : function(e) {
 807+ e.preventDefault();
834808 var linkURL = $j(this).find('a').attr('href');
835809 var thread = $j(this).closest('.lqt_thread');
836810 var linkTitle = thread.find('.lqt-thread-title-metadata').val();
837 - linkTitle = '[[' + linkTitle + ']]';
 811+ liquidThreads.showLinkWindow( linkTitle, linkURL );
 812+ },
 813+
 814+ 'showSummaryLinkWindow' : function(e) {
 815+ e.preventDefault();
 816+ var linkURL = $j(this).attr('href');
 817+ var linkTitle = $j(this).parent().find('input[name=summary-title]').val();
 818+ liquidThreads.showLinkWindow( linkTitle, linkURL );
 819+ },
 820+
 821+ 'showLinkWindow' : function(linkTitle, linkURL) {
 822+ linkTitle = '[['+linkTitle+']]';
838823
839824 // Build dialog
840825 var urlLabel = $j('<th/>').text(wgLqtMessages['lqt-thread-link-url']);
841 - var urlField = $j('<tr/>').text(linkURL).addClass( 'lqt-thread-link-url' );
 826+ var urlField = $j('<td/>').addClass( 'lqt-thread-link-url' );
 827+ urlField.text(linkURL);
842828 var urlRow = $j('<tr/>').append(urlLabel).append(urlField );
843829
844830 var titleLabel = $j('<th/>').text(wgLqtMessages['lqt-thread-link-title']);
845 - var titleField = $j('<tr/>').text(linkTitle).addClass( 'lqt-thread-link-title' );
 831+ var titleField = $j('<td/>').addClass( 'lqt-thread-link-title' );
 832+ titleField.text(linkTitle);
846833 var titleRow = $j('<tr/>').append(titleLabel).append(titleField );
847834
848835 var table = $j('<table><tbody></tbody></table>');
@@ -849,7 +836,7 @@
850837
851838 var dialog = $j('<div/>').append(table);
852839
853 - $j(this).prepend(dialog);
 840+ $j('body').prepend(dialog);
854841
855842 var dialogOptions = {
856843 'AutoOpen' : true,
@@ -857,8 +844,6 @@
858845 };
859846
860847 dialog.dialog( dialogOptions );
861 -
862 - e.preventDefault();
863848 },
864849
865850 'getToken' : function( callback ) {
@@ -1624,14 +1609,26 @@
16251610 $j('.lqt-command-watch').live( 'click', liquidThreads.asyncWatch );
16261611 $j('.lqt-command-unwatch').live( 'click', liquidThreads.asyncWatch );
16271612
1628 - // Set up periodic update checking
1629 - setInterval( liquidThreads.checkForUpdates, 60000 );
 1613+ // Live bind for link window
 1614+ $j('.lqt-command-link').live( 'click', liquidThreads.showThreadLinkWindow );
16301615
1631 - // Autogrowing textarea - this only affects the new-topic page
1632 -// $j('#wpTextbox1')//.autogrow();
1633 -
 1616+ // Live bind for summary links
 1617+ $j('.lqt-summary-link').live( 'click', liquidThreads.showSummaryLinkWindow );
 1618+
 1619+ // For "show replies"
 1620+ $j('a.lqt-show-replies').live( 'click', liquidThreads.showReplies );
 1621+
 1622+ // "Show more posts" link
 1623+ $j('a.lqt-show-more-posts').live( 'click', liquidThreads.showMore );
 1624+
 1625+ // Save handlers
16341626 $j('#wpSave').live( 'click', liquidThreads.handleAJAXSave );
16351627 $j('#wpTextbox1').live( 'keyup', liquidThreads.onTextboxKeyUp );
 1628+
 1629+ // Hide menus when a click happens outside them
16361630 $j(document).click( liquidThreads.handleDocumentClick );
 1631+
 1632+ // Set up periodic update checking
 1633+ setInterval( liquidThreads.checkForUpdates, 60000 );
16371634 } );
16381635

Status & tagging log