kamiwiki
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
* 文字列をセレクトした後の新しい紙作成でタイトルがうまく...
** command表示部分に以下のonmouseover文を挿入 [#i9678b11]
<a href="javascript:newTiddler(this)" onmouseover="getSe...
** function newTiddler(e)を以下のものに入れ替える [#sc2b0...
// Get selected text and put it into curSelText
var curSelText = "";
function getSelectedText()
{
//Yatsuさん
//Safariにも対応 (05/06/14)
var selText = "";
if (window.getSelection) {
// Safari, Mozilla
// Safariは + "" が必要
selText = window.getSelection() + "";
} else if (document.getSelection) {
// Mozilla
selText = document.getSelection();
} else if (document.selection) {
// IE, Opera
selText = document.selection.createRange().text;
}
curSelText = selText;
return selText;
}
// PMC
function newTiddler(e)
{
//Rakusai
//選択中の文字をタイトルにする
var selText = curSelText;
if (selText != null){
selText = selText.replace(/(¶|\r|\n|\t| | )/ig,"");
selText = selText.substr(0,40);
}
if (selText != null && selText != ""){
createTiddler(selText,2);
}else{
var now = new Date();
var curdate = ConvertToYYYYMMDD(now);
newTitle = "新しい紙";
var i = 2;
while (document.getElementById("store" + newTitle)){
newTitle = "新しい紙_" + i;
i++;
}
createTiddler(newTitle,2);
}
playSound("KASHA",50);
}
// end PMC
終了行:
* 文字列をセレクトした後の新しい紙作成でタイトルがうまく...
** command表示部分に以下のonmouseover文を挿入 [#i9678b11]
<a href="javascript:newTiddler(this)" onmouseover="getSe...
** function newTiddler(e)を以下のものに入れ替える [#sc2b0...
// Get selected text and put it into curSelText
var curSelText = "";
function getSelectedText()
{
//Yatsuさん
//Safariにも対応 (05/06/14)
var selText = "";
if (window.getSelection) {
// Safari, Mozilla
// Safariは + "" が必要
selText = window.getSelection() + "";
} else if (document.getSelection) {
// Mozilla
selText = document.getSelection();
} else if (document.selection) {
// IE, Opera
selText = document.selection.createRange().text;
}
curSelText = selText;
return selText;
}
// PMC
function newTiddler(e)
{
//Rakusai
//選択中の文字をタイトルにする
var selText = curSelText;
if (selText != null){
selText = selText.replace(/(¶|\r|\n|\t| | )/ig,"");
selText = selText.substr(0,40);
}
if (selText != null && selText != ""){
createTiddler(selText,2);
}else{
var now = new Date();
var curdate = ConvertToYYYYMMDD(now);
newTitle = "新しい紙";
var i = 2;
while (document.getElementById("store" + newTitle)){
newTitle = "新しい紙_" + i;
i++;
}
createTiddler(newTitle,2);
}
playSound("KASHA",50);
}
// end PMC
ページ名: