Difference between revisions of "User:Philip J. Rayment/Welcome script (debugging)"
Jump to navigation
Jump to search
(Edit debugging alerts) |
(Remove alerts (testing for which skin(s) is/are loading)) |
||
| Line 38: | Line 38: | ||
//<pre> | //<pre> | ||
function AddWelcome() { | function AddWelcome() { | ||
| − | + | // alert('3 (entering AddWelcome)') | |
var PageTitle = document.title.slice(0,17); | var PageTitle = document.title.slice(0,17); | ||
| − | + | // alert('4: '&&PageTitle); | |
if (PageTitle == 'Editing User talk') { | if (PageTitle == 'Editing User talk') { | ||
| − | + | // alert('5 (Adding tab)'); | |
addTab("javascript:DoWelcome()", "WELCOME", "ca-Welcome", "Add welcome notice", ""); | addTab("javascript:DoWelcome()", "WELCOME", "ca-Welcome", "Add welcome notice", ""); | ||
} | } | ||
| − | + | // alert('6 (exiting AddWelcome)'); | |
} | } | ||
//</pre> | //</pre> | ||
| Line 51: | Line 51: | ||
//<pre> | //<pre> | ||
// Welcome | // Welcome | ||
| − | alert('1 (before addOnloadHook)'); | + | //alert('1 (before addOnloadHook)'); |
addOnloadHook(AddWelcome); | addOnloadHook(AddWelcome); | ||
| − | alert('2 (addOnloadHook done)'); | + | //alert('2 (addOnloadHook done)'); |
function DoWelcome() { | function DoWelcome() { | ||
Revision as of 10:18, November 14, 2007
//
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
////
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key)
};
////
function AddWelcome() {
// alert('3 (entering AddWelcome)')
var PageTitle = document.title.slice(0,17);
// alert('4: '&&PageTitle);
if (PageTitle == 'Editing User talk') {
// alert('5 (Adding tab)');
addTab("javascript:DoWelcome()", "WELCOME", "ca-Welcome", "Add welcome notice", "");
}
// alert('6 (exiting AddWelcome)');
}
////
// Welcome
//alert('1 (before addOnloadHook)');
addOnloadHook(AddWelcome);
//alert('2 (addOnloadHook done)');
function DoWelcome() {
var txt = document.editform.wpTextbox1;
txt.value = txt.value+'{{welcome|sig=~~~~}}';
// var TxtRange = document.selection.createRange();
// var sel = TxtRange.text;
// sel='{{welcome|sig=~~~~}}';
// TxtRange.text=sel;
txt = document.editform.wpSummary;
txt.value = 'welcome';
}
//