pref-feeds tweaks

This commit is contained in:
Andrew Dolgov 2008-03-20 06:34:43 +01:00
parent d757a83ff5
commit e635d56a00
6 changed files with 87 additions and 8 deletions

View File

@ -1750,3 +1750,48 @@ function displayHelpInfobox(topic_id) {
return false;
}
// http://www.dynamic-tools.net/toolbox/copyToClipboard/
/*
function copyToClipboard(s)
{
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("Text", s);
}
else
{
// You have to sign the code to enable this or allow the action in about:config by changing
user_pref("signed.applets.codebase_principal_support", true);
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
if (!clip) return;
// create a transferable
var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;
// specify the data we wish to handle. Plaintext in this case.
trans.addDataFlavor('text/unicode');
// To get the data from the transferable we need two new objects
var str = new Object();
var len = new Object();
var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);
var copytext=meintext;
str.data=copytext;
trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);
var clipid=Components.interfaces.nsIClipboard;
if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);
}
} */

View File

@ -1073,7 +1073,7 @@
print "<h3>" . __("Firefox Integration") . "</h3>";
print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.');
print "</p><p class=\"small\"> <a href='javascript:window.navigator.registerContentHandler(" .
print "</p><p> <a class='visibleLink' href='javascript:window.navigator.registerContentHandler(" .
"\"application/vnd.mozilla.maybe.feed\", " .
"\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
__('Click here to register this site as a feed reader.') . "</a></p>";
@ -1085,14 +1085,17 @@
set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key());
}
print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the address specified below.')."</p>";
print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>";
$url_path = article_publish_url($link);
print "<p class=\"small\"><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>";
print "<p><a class=\"visibleLink\" id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">Link to published articles feed.</a></p>";
print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\" class=\"button\"
value=\"".__('Generate another address')."\"></p>";
value=\"".__('Generate another link')."\">";
/* print " <input type=\"submit\" onclick=\"return pubToClipboard()\" class=\"button\"
value=\"".__('Copy link to clipboard')."\">"; */
print "</p>";
}
?>

View File

@ -37,17 +37,17 @@ function replace_pubkey_callback() {
if (new_link) {
link.href = new_link.firstChild.nodeValue;
link.innerHTML = new_link.firstChild.nodeValue;
//link.innerHTML = new_link.firstChild.nodeValue;
new Effect.Highlight(link);
notify_info("Address changed.");
notify_info("Published feed URL changed.");
} else {
notify_error("Could not change address.");
notify_error("Could not change feed URL.");
}
} else {
notify_error("Could not change address.");
notify_error("Could not change feed URL.");
}
} catch (e) {
exception_error("replace_pubkey_callback", e);
@ -1815,6 +1815,25 @@ function pubRegenKey() {
return false;
}
function pubToClipboard() {
try {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return false;
}
var link = document.getElementById("pubGenAddress");
alert(link.href);
} catch (e) {
exception_error("pubToClipboard", e);
}
return false;
}
function validatePrefsSave() {
try {

View File

@ -950,3 +950,6 @@ div.infoBoxContents a {
color : #5050aa;
}
a.visibleLink {
color : gray;
}

View File

@ -466,3 +466,7 @@ div.topLinks a {
div.topLinks a:hover {
color : gray;
}
a.visibleLink {
color : gray;
}

View File

@ -1737,3 +1737,8 @@ div.topLinks a.feedback {
div.dashboard {
margin-left : 3px;
}
a.visibleLink {
color : #4684ff;
}