Extension talk:QuickLink

From mediawiki.org

JS errors & Search problems[edit]

Console log:

QuickLink.initSearchBox = function() {
QuickLink.searchBox.style.visibility = 'visible';
QuickLink.lastSelectedItem = -1;
//console.log('init');
}

Please change the method for IE & Opera supporting:

QuickLink.delayedSearch = function(e) {
	var evt = (e) ? e : window.event;
	var code = evt.keyCode ? evt.keyCode : evt.charCode ? evt.charCode : evt.which ? evt.which : void 0; 
	if(code == 27) {
		QuickLink.resetSearchBox();
		QuickLink.textarea.focus();
	}
	else if(code == 13) {
		QuickLink.insertSelectedResult();
	}
	else if(code == 38) {
		QuickLink.selectPreviousResult();
	}
	else if(code == 40) {
		QuickLink.selectNextResult();
	}
	else{

		if(QuickLink.counting)
			clearTimeout(QuickLink.timer);

		QuickLink.timer = setTimeout("QuickLink.inputFieldSearch()",QuickLink.searchTimeout);
		QuickLink.counting = true;
	}
}

Search in non-standard encoding still not working. See my comment in the Link Suggest discussion. Simon Litt 05 December 2009.

The PrefixSearch::titleSearch method only finds pages starting with the term, not containing the term. The current search method is more powerful. What do you mean exactly with non-standard enconding? That you can't search using russian characters, for instance? Spanish special characters work, as far as I know. --Kanor 20:12, 5 December 2009 (UTC)[reply]
By the way, the code with the IE support is now in the source and will be published with the next release. The references to the console item have also been removed. Thanks Simon =) --Kanor 22:40, 5 December 2009 (UTC)[reply]

modified QuickLink.js[edit]

Hi, I modiefied the file QuickLink.js a little bit. I have testet it with mediawiki 1.16 on:

  • FF 3 on WinXP - works
  • FF 3 on MacOS - works
  • IE 6 on WinXP - works
  • IE 7 on WinXP - works
  • IE 8 on WinXP - works

Look here for the file: Extension talk:QuickLink/QuickLink.js -- JBE 18:22, 11 September 2010 (UTC)[reply]

Not working[edit]

Hi there, first let me thank you for the extension! I've been years searching for it. Unfortunately, the extension is not working for me (I've got MediaWiki 1.15.0 and Firefox 3.6): when I type "[[", a box comes out on the top-right corner, but when I add some letters it remains blank (refer to this image); also, if I open the Error Console I have a "console is not defined" error (refer to this image). What am I doing wrong? Thank you again! Cheers

PS I don't know if this can help, but when I try the extension on subtrama.net it acts the same way. Also, the 0.5 version of QuickLink is working, 0.6 is not. --DerfelLink 21:44, 14 February 2010 (UTC)[reply]

I can confirm this (not working) with MediaWiki 1.15.4 & Firefox 3.6 and IE7. Works OK with Chrome. Any ideas? --Robinson Weijman 12:02, 27 September 2010 (UTC)[reply]
FIX: you need to use this file for js: Extension talk:QuickLink/QuickLink.js. Shame that it is in a separate location but, OK, it works. --Robinson Weijman 12:12, 27 September 2010 (UTC)[reply]

Great, thanks![edit]

Thanks for making this extension. It's great! I've been using a customized version of LinkSuggest for a while myself now. This is even better.

@DerfelLink: Comment out the console.log('init'); line in the .js file as the first commenter states (by putting "//" in front of it). -- Matsch 21:40, 21 February 2010 (UTC)[reply]

Thanks Matsch, it's working now! Cheers --DerfelLink 22:38, 21 February 2010 (UTC)[reply]

not-existing JS file included[edit]

In QuickLink.php (version 0.6) line 98 (of 102) a file called vegui.sk.formtools.js is included which does not exist. What is it? Is it necessary? -- Matsch 20:25, 13 April 2010 (UTC)[reply]

You're right, its obsolete code. It has been removed in 0.7.

--Kanor 10:49, 20 January 2011 (UTC)[reply]

Problems with SMW Halo[edit]

Nice extension works fine as long you don't activate SMW Halo extension. The QuickLinks and Halo display interfere each other and the result list is not displayed properly.

We are testing QuickLinks 0.6 on MediaWiki 1.15.1 / PHP 5.2.9-1 / MySQL 5.0.77-community-nt / LightTPD 1.4.22 / SphinxSearch (Version 0.7.0) / Semantic MediaWiki (Version 1.5) --MWJames 18:56, 16 May 2010 (UTC)[reply]

What do you mean with interfere? Could you upload a screenshot somewhere?

--Kanor 10:49, 20 January 2011 (UTC)[reply]

Feature request: add categories[edit]

Hi - this is indeed a great feature, thanks! Any chance of adding categories to the search, so e.g. if someone types [[Category:Extension]] the search will also pick that up? Also for other name spaces e.g. Template and User. --Robinson Weijman 12:54, 28 September 2010 (UTC)[reply]

One of my colleagues solved this. Replace the wfAjaxQuickLink function with this one:
function wfAjaxQuickLink( $term ) {
 
	//configure the following to change settings
	$limit = 8; //number of results to spit back
	$location = 1; //set to 1 to search anywhere in the article name, set to 0 to search only at the begining
 
 
	global $wgContLang, $wgOut;
	global $wgCanonicalNamespaceNames;
	$response = new AjaxResponse();
	$db = wfGetDB( DB_SLAVE );
	$l = new Linker;
 
	$term = str_replace(' ', '_', $term);
 
	if($location == 1){
 		$res = $db->select( 'page', array('page_namespace', 'page_title'),
			array(  "UPPER(CONVERT(page_title USING utf8)) LIKE '%" .$db->strencode( strtoupper ($term)). "%'" ),
				"wfSajaxSearch",
				array( 'LIMIT' => $limit )
			);
	}else{
		$res = $db->select( 'page', array('page_namespace', 'page_title'),
			array(  "UPPER(CONVERT(page_title USING utf8)) LIKE '". $db->strencode( strtoupper ($term)) ."%'" ),
				"wfSajaxSearch",
				array( 'LIMIT' => $limit )
			);
	}
 
	$r = "";
	$i = 0;

	while ($row = $db->fetchObject( $res ) ){

		if($row->page_namespace > 0)
			// For all namespaces except main, add 'namespace:' to link.
			$tmp_link = $wgCanonicalNamespaceNames[$row->page_namespace].":";
		else
			// For main namespace, just add page name.
			$tmp_link = "";
		$r .= '<li><a name="QuickLinkResult'.$i.'" class="unselected" onmouseover="QuickLink.selectResult('.$i.')"  onclick="javascript:QuickLink.insertLink(\''.$tmp_link.addslashes(str_replace('_', ' ', $row->page_title)).'\')">'.$tmp_link.str_replace('_', ' ', $row->page_title). "</a></li>\n";
 		$i++;
	}
	
	if ($r == "")
		$html = "<p>No results found with the term '$term'</p><p>Edit to search again | Esc: cancel</p>";
	else
		$html = "<ul>$r</ul><p>Click to insert link | Esc: cancel</p>";
  
	return $html;
}

--Robinson Weijman 14:32, 28 September 2010 (UTC)[reply]

Annoyances[edit]

I've noticed some small annoyances in the javascript, which I've fixed on our copy:

  • Typing ]] should abort the suggestion.
  • Cursor keys should abort the suggestion.
  • Escape key should never delete anything, because people will be annoyed something they typed is gone.
  • Searching in different namespaces also considers namespace aliases. (QuickLink.php)
  • Redirect pages are shown in different style.

--Paxed 13:54, 13 November 2010 (UTC)[reply]

Thanks Paxed for your modifications! Works very well on my installtion with MW 1.15.3. A tip for anyone running MW on PHP < 5.3 like me: you may have make a small adustment in Paxed's version of Quicklink.php, since he used an additional argument to php function strstr() which will break extension if your mediawiki is running on PHP older than 5.3 .
I made a change in my QuickLink.php, around row 60, and replaced:
$use_ns = strstr($term, ':', true);
with
$use_ns =substr($term, 0, strpos($term, ":")-0);
which works fine for me. --Ovoned 14:25, 2 January 2011 (UTC)[reply]

LinkSuggest[edit]

LinkSuggest, Wikia's version of this extension used on all wikias, requires YUI (Yahoo User Interface JS Framework) to work. Superior in that a new edit box is not required, wikilinks are automatically changed in the edit box. Requires YUI? Does that mean someone has got it working? Could you provide any help? Thanks! Multiple Protection LevelsTalk 01:43, 15 January 2011 (UTC)[reply]

Version 0.7 released[edit]

I've just released version 0.7. I tried to integrate all your suggestions and snippets - which was sort of hard because there where many. Thanks to all who tested and published patches for the extension, for helping making it better. --Kanor 01:43, 17 January 2011 (UTC)[reply]

Internet Explorer bug - version 0.7[edit]

Tested 0.7 with MW 1.15.4. Firefox & Chrome work very well, big improvement. Internet Explorer, however, moves the edit cursor back to the start (top left) of the edit field when the desired link is listed (in the suggest field) and Enter is pressed. --Robinson weijman 08:43, 4 February 2011 (UTC)[reply]

P.S. This is IE7! --Robinson weijman 08:59, 4 February 2011 (UTC)[reply]

Internet Explorer is driving me crazy ^^U For some reason the function setCaretIE (proposed by JBE) was not working when I released 0.7. It might be my fault, since I had to integrate the different patches in my current working copy. I have to dive in the IE topic a little more, I'd like to see it working properly in 0.8 - which should be out in a pair of months, probably supporting the new editor UI. --Kanor 11:53, 4 February 2011 (UTC)[reply]
Thx Kanor. We're looking into it as well. But may I suggest that, if you solve it, you release a 0.7a version asap? That would then make this a killer extension. --Robinson weijman 12:16, 4 February 2011 (UTC)[reply]

It doesn't work. need help[edit]

Hi.

I added the extension as mentioned in the instructions and the extension doesn't appear. I added the localsettings code to the localsettings file and my wiki launches as normal, but the extension simply isn't apparent or listed in the (special page) version information. It's really weird. I should get an error if it wasn't calling the contents of the extension.

Edit*

Actually it is listed in the version menu, but the field doesn't appear in the editor.

Yes I have the same problem. Is there any solution? Mediawiki 1.16 + FF 3.6.9 + QuickLink 0.7--85.232.7.145 14:19, 29 June 2011 (UTC)[reply]

Usability Initiative support[edit]

Hello, can you make this extension compatible with usability initiative? thanks.

Demo not working[edit]

The live demo of the extension requires a person to be in the editor to be in the group "Users" which appears to be inaccessible.