Difference between revisions of "WikiBookmarks/Usage"

From Wiki4Intranet
Jump to: navigation, search
(Новая страница: «'''WikiBookmarks''' is a '''MediaWiki''' extension which lets you to manage shared bookmark lists inside a Wiki article. The extension is written by [http://yourcmc....»)
 
(WikiBookmarks: load help page)
Line 16: Line 16:
 
<!-- The following is Wikitext/HTML+JavaScript code for creating bookmarklet. It is localized using &lt;msgid&gt; templates and substituted into Wikitext help files. -->
 
<!-- The following is Wikitext/HTML+JavaScript code for creating bookmarklet. It is localized using &lt;msgid&gt; templates and substituted into Wikitext help files. -->
 
<html><div style="display:inline-block"><label for="wb_page"><b></html>Article title:<html></b></label><br/>
 
<html><div style="display:inline-block"><label for="wb_page"><b></html>Article title:<html></b></label><br/>
<input type="text" id="wb_page" size="20" value="</html>{{ns:User}}:{{USERNAME}}/Bookmarks<html>" /></div>
+
<input type="text" id="wb_page" size="40" value="" /></div>
 
<div style="display:inline-block"><label for="wb_text"><b></html>Button text:<html></b></label><br/>
 
<div style="display:inline-block"><label for="wb_text"><b></html>Button text:<html></b></label><br/>
 
<input type="text" id="wb_text" size="20" value="</html>WikiBookmark it<html>" /></div>
 
<input type="text" id="wb_text" size="20" value="</html>WikiBookmark it<html>" /></div>
 
<input type="button" value="</html>Make bookmarklet for me<html>" onclick="wb_make_link()" />
 
<input type="button" value="</html>Make bookmarklet for me<html>" onclick="wb_make_link()" />
 
<div id="wb_link_div" style="font-weight: bold"></div>
 
<div id="wb_link_div" style="font-weight: bold"></div>
 +
<script language="JavaScript" type="text/javascript" src="http://</html>{{SERVERNAME}}{{SCRIPTPATH}}/extensions/WikiBookmarks/WikiBookmarks.js<html>"></script>
 
<script language="JavaScript">
 
<script language="JavaScript">
 
function wb_make_link()
 
function wb_make_link()
Line 26: Line 27:
 
  var pg = document.getElementById("wb_page").value;
 
  var pg = document.getElementById("wb_page").value;
 
  var t = document.getElementById("wb_text").value;
 
  var t = document.getElementById("wb_text").value;
 +
if (!t)
 +
  t = "</html>WikiBookmark it<html>";
 
  if (pg == "")
 
  if (pg == "")
 
  {
 
  {
Line 37: Line 40:
 
  d.appendChild(document.createTextNode("[[ "));
 
  d.appendChild(document.createTextNode("[[ "));
 
  var a = document.createElement('a');
 
  var a = document.createElement('a');
  a.href = "javascript:(function(){\
+
  a.href = wb_bookmarklet(pg);
var p=location.protocol;\
+
if(p=='chrome:'||p=='about:'||p=='javascript:'){return '<meta http-equiv=%22Refresh%22 content=%220; http://</html>{{SERVERNAME}}{{SCRIPTPATH}}<html>/index.php?title="+encodeURI(encodeURI(pg))+"%22 />';}\
+
var w = window.open('about:blank','WikiBookmarks','width=400,height=150,menubar=no,location=no,resizable=yes,scrollbars=no');\
+
var f = w.document.createElement('form');\
+
f.method = 'POST';\
+
f.acceptCharset = 'UTF-8';\
+
f.action = 'http://</html>{{SERVERNAME}}{{SCRIPTPATH}}<html>/index.php?title=Special:Bookmarks';\
+
var inf = function(k,v){var i=w.document.createElement('input');i.type='hidden';i.name=k;i.value=v;f.appendChild(i)};\
+
inf('page','"+encodeURI(pg)+"');\
+
inf('url',''+location.href);\
+
inf('urltitle',''+document.title);\
+
inf('selection',(function(){var u;if(window.getSelection){u=window.getSelection()}else if(document.selection){u=document.selection.createRange()}else{return ''}if(u.getRangeAt){u=u.getRangeAt(0)}if(u.cloneContents){u=u.cloneContents();d=document.createElement('div');d.appendChild(u);if(d.innerHTML==''){u=''}else{u='%3Chtml>'+d.innerHTML+'%3C/html>'}}else if(u.text){u=u.text}return ''+u}()));\
+
w.document.body.appendChild(f);\
+
f.submit();\
+
return;\
+
}())";
+
 
  a.innerHTML = t;
 
  a.innerHTML = t;
 
  d.appendChild(a);
 
  d.appendChild(a);
 
  d.appendChild(document.createTextNode(" ]]"));
 
  d.appendChild(document.createTextNode(" ]]"));
 +
}
 +
if (wgUserName)
 +
{
 +
var defp = "</html>{{ns:User}}<html>:" + wgUserName + "/</html>Bookmarks<html>";
 +
document.getElementById("wb_page").value = defp;
 +
document.getElementById("wb_default").innerHTML = "</html> (<b>$1</b> by default)<html>".replace("$1", defp);
 
}
 
}
 
</script>
 
</script>
Line 64: Line 57:
 
When you click the newly added button when viewing some interesting Web page,
 
When you click the newly added button when viewing some interesting Web page,
 
'''WikiBookmarks''' will remember current page's URL, title and selected text (if any),
 
'''WikiBookmarks''' will remember current page's URL, title and selected text (if any),
on MediaWiki article you selected for bookmarks ([[{{ns:User}}:{{USERNAME}}/Bookmarks]] by default).
+
on MediaWiki article you selected for bookmarks<span id="wb_default"></span>.
  
 
The new bookmarks are added into beginning of an article, under certain count of headings.
 
The new bookmarks are added into beginning of an article, under certain count of headings.
Line 85: Line 78:
  
 
[[Category:Help]]
 
[[Category:Help]]
[[ru:ВикиЗакладки/Справка]]
 

Revision as of 02:52, 10 July 2011

WikiBookmarks is a MediaWiki extension which lets you to manage shared bookmark lists inside a Wiki article. The extension is written by Vitaliy Filippov and is distributed under the terms of GNU GPL license version 3 or later. Also, here is a link to extension homepage.

You always can find a fresh version of the WikiBookmarks documentation on the Special:Bookmarks page. Actually, you've already found it :-).

WikiBookmarks are used in the form of a tiny bookmarklet (what is a bookmarklet?). To install such a bookmarklet in your browser, you need to enter the title of Wiki Article which you want to maintain as your bookmark list, click Make bookmarklet and drag-and-drop displayed link onto your browser's panel or add it into your browser's bookmarks.



When you click the newly added button when viewing some interesting Web page, WikiBookmarks will remember current page's URL, title and selected text (if any), on MediaWiki article you selected for bookmarks.

The new bookmarks are added into beginning of an article, under certain count of headings. By default the first-level headings are named == Year == and the second-level headings are named === Month Year === ("%Y" "%B %Y"). This meant to be used for bookmark classification by date. If you want to change heading count and/or heading date format, you must add a line similar to the following one into the beginning of your bookmarks article:

<!--BookmarkHeadings:"%Y" "%Y-%m" "%Y-%m-%d"-->

WikiBookmarks extracts all present quoted strings from such a comment and use them as the date dependent headings. The format of formatting strings is the same as in PHP function strftime() (as you know, actually it's libc's, but it doesn't matter).

You also have the option of changing format of the date-time string appended to list item before each bookmark. To do this, you must add a line similar to the following one into the beginning of your bookmarks article:

<!--BookmarkDate:"%d %H:%M:%S"-->

If such a comment is present, WikiBookmarks will take the quoted string from it and use it as date and time format.