Basics edit

The following is a simplfied depiction of the HTML for a typical mainspace work found on en.WS. The proposed changes that follow refer to the line numbers on the extreme left (1 thru 39) as well as the info outlined in the Facts and/or Findings sub-sections.

 1.<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-TITLE skin-vector action-...">
 2.	<div id="mw-page-base" class="noprint"></div>
 3.	<div id="mw-head-base" class="noprint"></div>
 4.	<!-- content -->
 5.	<div id="content" class="mw-body">
 6.		<a id="top"></a>
 7.		<div id="mw-js-message" style="display:none;"></div>
 8.		<!-- sitenotice -->
 9.		<div id="siteNotice"><!-- centralNotice loads here --></div>
10.		<!-- /sitenotice -->
11.		<!-- firstHeading -->
12.		<h1 id="firstHeading" class="firstHeading"><span dir="auto">TITLE</span></h1>
13.		<!-- /firstHeading -->
14.		<!-- bodyContent -->
15.		<div id="bodyContent">
16.			<!-- tagline -->
17.			<div id="siteSub">From Wikisource</div>
18.			<!-- /tagline -->
19.			<!-- subtitle -->
20.			<div id="contentSub"></div>
21.			<!-- /subtitle -->
22.			<!-- bodycontent -->
23.			<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
			
24.			<!--  This  represents  textarea / wpTextbox1  in  edit  mode  -->
			
25.			</div>
26.			<!-- /bodycontent -->
27.			<!-- printfooter -->
28.			<div class="printfooter"></div>
29.			<!-- /printfooter -->
30.			<!-- catlinks -->
31.			<div id='catlinks' class='catlinks'></div>
32.			<!-- /catlinks -->
33.			<div class="visualClear"></div>
34.			<!-- debughtml -->
35.			<!-- /debughtml -->
36.		</div>
37.		<!-- /bodyContent -->
38.	</div>
39.	<!-- /content -->

<!--   SNIP   SNIP   SNIP -->

Facts


lines 14 & 15 and 36 & 37

14.		<!-- bodyContent -->
15.		<div id="bodyContent">
36.		</div>
37.		<!-- /bodyContent -->
  • hidden description text reads as 'bodyContent' (note capital 'C' in 'bodyContent' )
  • element identifier reads as 'bodyContent' ( <div id="bodyContent" ... )
  • no class assigned
  • in vector (action= view, read) wraps "everything" appearing on the pure white background ( from just below the vector menu tabs down to the bottom & including category bar(s) (not depicted)


lines 22 & 23 and 25 & 26

22.			<!-- bodycontent -->
23.			<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
25.			</div>
26.			<!-- /bodycontent -->
  • hidden description text reads as bodycontent (note lowercase 'c' in 'bodycontent' )
  • no element identifier present element identifier reads as 'mw-content-text' ( <div id="mw-content-text" ... )
    • Patched into 1.19wmf release - March 15, 2012, pm.
  • assigned class reads as 'mw-content-ltr' ( <div class="mw-content-ltr" [lang. direction; mediawiki-content-left-to-right] )
  • in vector (action= view, read) wraps everything added manually by Users in the textarea box (line 24) when saved (action= edit, submit).


lines 19 to 21

19.			<!-- subtitle -->
20.			<div id="contentSub"></div>
21.			<!-- /subtitle -->
  • hidden description text reads as 'subtitle'
  • element identifier reads as 'contentSub' ( <div id="contentSub" note capital 'S' in 'contentSub' )
  • no class assigned
  • in vector (action= view, read) handles various items depending on the circumstances at hand for any given moment or action (examples: wraps mini-color coded proofreading status bar when applicable or nests the span showing the up-level linkage if we are on a sub-page).


30.			<!-- catlinks -->
31.			<div id='catlinks' class='catlinks'></div>
32.			<!-- /catlinks -->
  • hidden description text reads as 'catlinks'
  • element identifier reads as 'catlinks' ( <div id='catlinks' )
  • assigned class reads as 'catlinks' ( <div class='catlinks' )
  • in vector (action= view, read) handles wrapping of the category bar and it's contents.

Findings



Proposed changes edit

  1. Cosmetic more than functional in nature. Currently, the hidden description text for lines 14 & 37 is almost the same as lines 22 & 26 save the capitalization of the letter "c". If it is not too much trouble and will not disrupt normal functionality, could we change the hidden description text for lines lines 22 & 26 to something else?

    My suggestion would be contentTextbody but anything along that theme will do.


  2. Based on the Findings above and on... https://wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=view shown in the box below...
    function add_page_container(){
            if(wgNamespaceNumber!=0 && wgNamespaceNumber!=2 ) return; 
            var id = null;
            if(wgAction=="view"||wgAction=="purge") id = "#bodyContent"; 
            if(wgAction=="submit") id = "#wikiPreview"; 
            if (!id) return;
            if( document.getElementById("text-wrap") ) return;
    
            if( !self.proofreadpage_source_href && get_elements_by_classname("pagenum","span").length==0 ) return;
    
    	var t = get_elements_by_classname("text","div"); 
            for(var i=0; i<t.length; i++)  t[i].className =""; 
            t = get_elements_by_classname("lefttext","div"); 
            for(var i=0; i<t.length; i++)  t[i].className =""; 
            t = get_elements_by_classname("centertext","div"); 
            for(var i=0; i<t.length; i++)  t[i].className =""; 
            t = get_elements_by_classname("indented-page","div"); 
            for(var i=0; i<t.length; i++)  t[i].className =""; 
            t = get_elements_by_classname("prose","div"); 
            for(var i=0; i<t.length; i++)  t[i].className ="";
    
            $(id).prepend($('#contentSub'));
            $('#contentSub').nextUntil('#catlinks').wrapAll("<div id='text-wrap'><div id='text-container'><div id='text'></div></div></div><div style='clear:both'></div>");
    }
    
    ... the current dynamic layout scheme is intruding into div tags that it does not need to at some stage of rendering.

    Instead of prepending any of those 4 or 5 div elements being detected if present to #contentSub (line 20) and then wrapping everything from #contentSub to #catlinks (line 32) before final display, is it possible to still detect the existance of those 4 or 5 div elements and, if so, have them wrapped by the same 3 additional div container elements, then have all of them remain between the start and end div tags of #mw-content-text (lines 22 & 26) upon final rendering instead?


  3. If #2 is not possible or feasible, could we modify SkinTemplate.php to generate 2 additional place-holder div tags by default immediately before and after the start and end div tags of #mw-content-text (lines 22 & 26), denoted by "new" in the following,
    19.			<!-- subtitle -->
    20.			<div id="contentSub"></div>
    21.			<!-- /subtitle -->
    
    New			<!-- contentTextheader -->
    New			<div id="contentTextheader"></div>
    New			<!-- /contentTextheader -->
    
    22.			<!-- contentTextbody -->
    23.			<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
    			
    24.			<!--  This  represents  textarea / wpTextbox1  in  edit  mode  -->
    			
    25.			</div>
    26.			<!-- /contentTextbody -->
    
    New			<!-- contentTextfooter -->
    New			<div id="contentTextfooter"></div>
    New			<!-- /contentTextfooter -->
    
    27.			<!-- printfooter -->
    28.			<div class="printfooter"></div>
    29.			<!-- /printfooter -->
    30.			<!-- catlinks -->
    31.			<div id='catlinks' class='catlinks'></div>
    32.			<!-- /catlinks -->
    <!--   SNIP   SNIP   SNIP -->
    

    ... and then modify the .js cited in #2 to utilize these new elements instead of the ones currently being intruded upon?


Thanks for any attention in these matters in advance -- George Orwell III (talk) 13:18, 20 July 2012 (UTC)