r61556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61555‎ | r61556 | r61557 >
Date:03:19, 27 January 2010
Author:tstarling
Status:ok
Tags:
Comment:
Removed the nasty-looking JS-based position:fixed simulation, used by the "standard" (MW 1.0) skin for non-default "floating" quickbar settings in IE 6 and below. Appears to be broken anyway and nobody cares enough to fix it. To resolve r61071.
Modified paths:
  • /trunk/phase3/skins/Standard.php (modified) (history)
  • /trunk/phase3/skins/common/sticky.js (deleted) (history)

Diff [purge]

Index: trunk/phase3/skins/Standard.php
@@ -19,9 +19,6 @@
2020 */
2121 function outputPage( OutputPage $out ) {
2222 global $wgStylePath;
23 - if ( 3 == $this->qbSetting() ) { # Floating left
24 - $out->addScriptFile ( "{$wgStylePath}/common/sticky.js" );
25 - }
2623 parent::outputPage( $out );
2724 }
2825
Index: trunk/phase3/skins/common/sticky.js
@@ -1,128 +0,0 @@
2 -// Make a layer that stays in the same place on screen when scrolling the browser window.
3 -// Version 1.2
4 -// See http://www.mark.ac/help for browser support.
5 -
6 -var mySticky;
7 -var theLayer;
8 -
9 -// Setup variables for sliding.
10 -// lastY and staticYOffset should match your CSS top definition.
11 -
12 -lastY = 10;
13 -YOffset = 0;
14 -staticYOffset = 10;
15 -refreshMS = 25;
16 -
17 -// Setup function that runs when the page loads.
18 -function setup( eID ) {
19 - bw = new checkBrowser;
20 - if ( bw.ns4 || bw.opera ) { MM_reloadPage( true ); }
21 - var noFix = bw.ie4 || bw.ns4 || ( bw.macie50 ) ? true : false;
22 - if ( window.attachEvent ) { fix_bind() }
23 - else if ( noFix ) {
24 - if ( bw.ns6 ) { document.getElementById( eID ).style.position = "absolute"; }
25 - if ( bw.macie50 ) { document.getElementById( eID ).style.position = "absolute"; document.getElementById( eID ).style.backgroundColor = "#ccffcc"; }
26 - if ( bw.ns6 && YOffset == 0 ) { YOffset = -15 }
27 - mySticky = new makeLayerObj( eID );
28 - layerSlide( eID ) }
29 - else {
30 - mySticky = new makeLayerObj( eID );
31 - mySticky.css.position = "fixed"; }
32 -
33 - if ( !mySticky ) { mySticky = new makeLayerObj( eID ); }
34 - // mySticky.css.visibility = "visible";
35 -}
36 -
37 -hookEvent( 'load', function() { setup( 'quickbar' ); } );
38 -
39 -
40 -// -------------------------
41 -// emulate css 'position: fixed' in IE5+ Win
42 -// code by aclover@1value.com
43 -fix_elements = new Array();
44 -
45 -function fix_event() {
46 - var i;
47 - for ( i = 0; i < fix_elements.length; i++ ) {
48 - fix_elements[i].style.left = parseInt( fix_elements[i].fix_left ) + document.getElementsByTagName( 'html' )[0].scrollLeft + document.getElementsByTagName( 'body' )[0].scrollLeft + 'px';
49 - fix_elements[i].style.top = parseInt( fix_elements[i].fix_top ) + document.getElementsByTagName( 'html' )[0].scrollTop + document.getElementsByTagName( 'body' )[0].scrollTop + 'px';
50 - }
51 -}
52 -
53 -function fix_bind() {
54 - var i;
55 - for ( i = 0; i < document.all.length; i++ ) {
56 - if ( document.all[i].currentStyle.position == 'fixed' ) {
57 - document.all[i].fix_left = document.all[i].currentStyle.left;
58 - document.all[i].fix_top = document.all[i].currentStyle.top;
59 - document.all[i].style.position = 'absolute';
60 - fix_elements[fix_elements.length] = document.all[i];
61 - window.attachEvent( 'onscroll', fix_event );
62 - window.attachEvent( 'onresize', fix_event );
63 - }
64 - }
65 -}
66 -// -------------------------
67 -
68 -
69 -// -------------------------
70 -// DHTML menu sliding. Requires checkBrowser()
71 -// Based on source at http://www.simplythebest.net/
72 -function layerSlide( layerID ) {
73 - if ( bw.dhtml ) {
74 - if ( !mySticky ) { mySticky = new makeLayerObj( layerID ); }
75 - if ( bw.ns ) { winY = window.pageYOffset; }
76 - else if ( bw.ie ) { winY = document.body.scrollTop; }
77 - if ( bw.ie || bw.ns ) {
78 - if ( winY != lastY && winY > YOffset - staticYOffset ) { smooth = .3 * ( winY - lastY - YOffset + staticYOffset ); }
79 - else if ( YOffset - staticYOffset + lastY > YOffset - staticYOffset ) { smooth = .3 * ( winY - lastY - ( YOffset - ( YOffset - winY ) ) ); }
80 - else { smooth = 0 }
81 - if ( smooth > 0 ) { smooth = Math.ceil( smooth ); }
82 - else { smooth = Math.floor( smooth ); }
83 - if ( bw.ie ) { mySticky.css.pixelTop += smooth; }
84 - else if ( bw.ns ) { mySticky.css.top = parseInt( mySticky.css.top ) + smooth; }
85 - lastY = lastY + smooth;
86 - top.window.status = new Date()
87 - setTimeout( 'layerSlide( "' + layerID + '")', refreshMS ) } } }
88 -// -------------------------
89 -
90 -// Netscape 4.x browser resize fix
91 -function MM_reloadPage( init ) {
92 -if ( init == true ) with ( navigator ) { if ( ( appName == "Netscape" ) && ( parseInt( appVersion ) == 4 ) ) {
93 - document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; top.onresize = MM_reloadPage; } }
94 -else if ( innerWidth != document.MM_pgW || innerHeight != document.MM_pgH ) { location.reload(); } }
95 -
96 -// Create browser-independent layer and browser objects
97 -function makeLayerObj( eID ) {
98 - if ( document.getElementById ) { this.css = document.getElementById( eID ).style }
99 - else if ( document.layers ) { this.css = document.layers[eID]; }
100 - else if ( document.all ) { this.css = document.all[eID].style; }
101 - return this;
102 -}
103 -
104 -function checkBrowser() {
105 - this.ver = navigator.appVersion;
106 - this.name = navigator.appName;
107 - this.mac = ( navigator.platform.toLowerCase().indexOf( 'mac' ) > -1 );
108 - this.opera = ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1 );
109 - this.dom = document.getElementById;
110 - this.ns = ( this.name == 'Netscape' );
111 - this.ie4 = ( document.all && !this.dom );
112 - this.ie = ( this.name == 'Microsoft Internet Explorer' && !this.opera );
113 - this.ie5 = ( this.ie && ( navigator.userAgent.indexOf( "MSIE 5" ) != -1 ) );
114 - this.macie50 = ( this.mac && this.ie5 && ( navigator.userAgent.indexOf( "MSIE 5.0" ) != -1 ) );
115 - this.ns4 = ( this.ns && parseInt( this.ver ) == 4 );
116 - this.ns6 = ( ( this.name == "Netscape" ) && ( parseInt( this.ver ) == 5 ) );
117 - this.standards = document.getElementById;
118 - this.dhtml = this.standards || this.ie4 || this.ns4;
119 -}
120 -
121 -function showMe( eID ) {
122 - myFloater = new makeLayerObj( eID );
123 - myFloater.css.visibility = "visible";
124 -}
125 -
126 -function hideMe( eID ) {
127 - myFloater = new makeLayerObj( eID );
128 - myFloater.css.visibility = "hidden";
129 -}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61071Merge all skins' output of opening <body> tag...simetrical01:16, 15 January 2010

Status & tagging log