User:Magnus Manske/less edit clutter.js: Difference between revisions

Content deleted Content added
Created page with 'if ( ( wgAction == "submit" || wgAction == "edit" ) && wgNamespaceNumber == 0 ) { addOnloadHook ( less_edit_clutter_init ) ; } var lec_paren...'
 
mNo edit summary
Line 92:
 
lec_bottom_table = document.createElement ( 'table' ) ;
lec_bottom_tbody = document.createElement ( 'tabletbody' ) ;
lec_bottom_tr = document.createElement ( 'tabletr' ) ;
lec_bottom_td1 = document.createElement ( 'td' ) ;
lec_bottom_td2 = document.createElement ( 'td' ) ;
lec_bottom_td3 = document.createElement ( 'td' ) ;
 
lec_bottom_td1.style.width = '40%' ;
lec_bottom_td2.style.width = '30%' ;
lec_bottom_td3.style.width = '30%' ;
 
lec_bottom_td1.appendChild ( document.createTextNode ( 'End templates and magic words' ) ) ;
lec_bottom_td1.appendChild ( document.createElement ( 'br' ) ) ;
lec_bottom_td1.appendChild ( lec_tb_bt ) ;
 
lec_bottom_td2.appendChild ( document.createTextNode ( 'Categories' ) ) ;
lec_bottom_td2.appendChild ( document.createElement ( 'br' ) ) ;
lec_bottom_td2.appendChild ( lec_tb_cat ) ;
 
lec_bottom_td3.appendChild ( document.createTextNode ( 'Interlanguage links' ) ) ;
lec_bottom_td3.appendChild ( document.createElement ( 'br' ) ) ;
lec_bottom_td3.appendChild ( lec_tb_ill ) ;
 
Line 196 ⟶ 203:
if ( lc == "" ) {
lines.shift() ;
if ( begin_templates != '' ) begin_templates += "\n" ;
} else if ( lc.match(/^\{\{[^\{\}]*\}\}$/) ) {
lines.shift() ;
Line 213 ⟶ 221:
} else break ;
}
 
begin_templates = begin_templates.replace(/^\s+|\s+$/g,"") ;
 
 
Line 220 ⟶ 230:
// End of text
in_template = 0 ;
end_templates_append = "" ;
while ( lines.length > 0 ) {
var lp = lines.length - 1 ;
Line 226 ⟶ 238:
if ( lc == "" ) {
lines.pop() ;
if ( end_templates +!= no_ws'' +) end_templates = "\n" + end_templates ;
} else if ( lc.substr ( 0 , 11 ) == "[[category:" ) {
lines.pop() ;
Line 236 ⟶ 249:
s = s.replace ( /\]\]$/ , "" ) ;
languages.push ( s ) ;
} else if ( lc.match(/^\{\{defaultsort\s*[\|\:].*\}\}$/) ) {
end_templates_append += "\n\n" + lines.pop() ;
} else if ( lc.match(/^\{\{.*\}\}$/) ) {
end_templates = lines.pop() + "\n" + end_templates ;
} else if ( lc.match(/^[^\{\}]*\}\}$/) ) {
end_templates += no_ws + "\n" ;
end_templates = lines.pop() + "\n" + end_templates ;
in_template++ ;
} else if ( lc.match(/^\{\{[^\{\}]*$/) ) {
end_templates = lines.pop() + "\n" + end_templates ;
in_template-- ;
} else if ( in_template > 0 ) {
end_templates = lines.pop() + "\n" + end_templates ;
} else break ;
}
 
var oet ;
do {
oet = end_templates ;
end_templates = end_templates.split("\n\n\n").join("\n\n") ;
} while ( end_templates != oet ) ;
end_templates = end_templates.replace(/^\s+|\s+$/g,"") ;
end_templates_append = end_templates_append.replace(/^\s+|\s+$/g,"") ;
if ( end_templates != '' && end_templates_append != '' ) end_templates += "\n\n" ;
end_templates += end_templates_append ;
 
// Set boxes