Skip to content

Commit 41becd3

Browse files
committed
skins: Add common skins files
1 parent 3516a96 commit 41becd3

File tree

122 files changed

+4476
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+4476
-0
lines changed

skins/common/IE80Fixes.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Fixes textarea scrolling bug (bug #19334). The bug only occurs when a
3+
* percentage width is given, so instead of width: 100%, use min-width: 100%;
4+
* max-width: 100%. We also need to give a fixed width for the actual width
5+
* property for the hack to work, although the actual value (500px here) ends
6+
* up being ignored; min/max-width take precedence.
7+
*
8+
* More info: http://grantovich.net/posts/2009/06/that-weird-ie8-textarea-bug/
9+
*/
10+
#wpTextbox1 {
11+
height: 390px;
12+
width: 500px;
13+
min-width: 100%;
14+
max-width: 100%;
15+
}

skins/common/IEFixes.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
// IE fixes javascript
2+
3+
window.isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup );
4+
window.doneIETransform = undefined;
5+
window.doneIEAlphaFix = undefined;
6+
7+
window.hookit = function() {
8+
if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) {
9+
doneIETransform = true;
10+
relativeforfloats();
11+
fixalpha();
12+
}
13+
};
14+
15+
if ( document.attachEvent ) {
16+
document.attachEvent( 'onreadystatechange', window.hookit );
17+
}
18+
19+
// png alpha transparency fixes
20+
window.fixalpha = function( logoId ) {
21+
// bg
22+
if ( isMSIE55 && !doneIEAlphaFix ) {
23+
var plogo = document.getElementById( logoId || 'p-logo' );
24+
if ( !plogo ) {
25+
return;
26+
}
27+
28+
var logoa = plogo.getElementsByTagName('a')[0];
29+
if ( !logoa ) {
30+
return;
31+
}
32+
33+
var bg = logoa.currentStyle.backgroundImage;
34+
var imageUrl = bg.substring( 5, bg.length - 2 );
35+
36+
doneIEAlphaFix = true;
37+
38+
if ( imageUrl.substr( imageUrl.length - 4 ).toLowerCase() == '.png' ) {
39+
var logospan = logoa.appendChild( document.createElement( 'span' ) );
40+
41+
logoa.style.backgroundImage = 'none';
42+
logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')';
43+
logospan.style.height = '100%';
44+
logospan.style.position = 'absolute';
45+
logospan.style.width = logoa.currentStyle.width;
46+
logospan.style.cursor = 'hand';
47+
// Center image with hack for IE5.5
48+
if ( document.documentElement.dir == 'rtl' ) {
49+
logospan.style.right = '50%';
50+
logospan.style.setExpression( 'marginRight', '"-" + (this.offsetWidth / 2) + "px"' );
51+
} else {
52+
logospan.style.left = '50%';
53+
logospan.style.setExpression( 'marginLeft', '"-" + (this.offsetWidth / 2) + "px"' );
54+
}
55+
logospan.style.top = '50%';
56+
logospan.style.setExpression( 'marginTop', '"-" + (this.offsetHeight / 2) + "px"' );
57+
58+
var linkFix = logoa.appendChild( logoa.cloneNode() );
59+
linkFix.style.position = 'absolute';
60+
linkFix.style.height = '100%';
61+
linkFix.style.width = '100%';
62+
}
63+
}
64+
};
65+
66+
if ( isMSIE55 ) {
67+
// ondomready
68+
$( fixalpha );
69+
}
70+
71+
// fix ie6 disappering float bug
72+
window.relativeforfloats = function() {
73+
var bc = document.getElementById( 'bodyContent' );
74+
if ( bc ) {
75+
var tables = bc.getElementsByTagName( 'table' );
76+
var divs = bc.getElementsByTagName( 'div' );
77+
setrelative( tables );
78+
setrelative( divs );
79+
}
80+
};
81+
82+
window.setrelative = function( nodes ) {
83+
var i = 0;
84+
while ( i < nodes.length ) {
85+
if( ( ( nodes[i].style.float && nodes[i].style.float != ( 'none' ) ||
86+
( nodes[i].align && nodes[i].align != ( 'none' ) ) ) &&
87+
( !nodes[i].style.position || nodes[i].style.position != 'relative' ) ) )
88+
{
89+
nodes[i].style.position = 'relative';
90+
}
91+
i++;
92+
}
93+
};
94+
95+
// Expand links for printing
96+
String.prototype.hasClass = function( classWanted ) {
97+
var classArr = this.split(/\s/);
98+
for ( var i = 0; i < classArr.length; i++ ) {
99+
if ( classArr[i].toLowerCase() == classWanted.toLowerCase() ) {
100+
return true;
101+
}
102+
}
103+
return false;
104+
};
105+
106+
window.expandedURLs = undefined;
107+
108+
window.onbeforeprint = function() {
109+
expandedURLs = [];
110+
111+
var contentEl = document.getElementById( 'content' );
112+
113+
if ( contentEl ) {
114+
var allLinks = contentEl.getElementsByTagName( 'a' );
115+
116+
for ( var i = 0; i < allLinks.length; i++ ) {
117+
if ( allLinks[i].className.hasClass( 'external' ) && !allLinks[i].className.hasClass( 'free' ) ) {
118+
var expandedLink = document.createElement( 'span' );
119+
var expandedText = document.createTextNode( ' (' + allLinks[i].href + ')' );
120+
expandedLink.appendChild( expandedText );
121+
allLinks[i].parentNode.insertBefore( expandedLink, allLinks[i].nextSibling );
122+
expandedURLs[i] = expandedLink;
123+
}
124+
}
125+
}
126+
};
127+
128+
window.onafterprint = function() {
129+
for ( var i = 0; i < expandedURLs.length; i++ ) {
130+
if ( expandedURLs[i] ) {
131+
expandedURLs[i].removeNode( true );
132+
}
133+
}
134+
};

skins/common/ajax.js

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
// remote scripting library
2+
// (c) copyright 2005 modernmethod, inc
3+
window.sajax_debug_mode = false;
4+
window.sajax_request_type = 'GET';
5+
6+
/**
7+
* if sajax_debug_mode is true, this function outputs given the message into
8+
* the element with id = sajax_debug; if no such element exists in the document,
9+
* it is injected.
10+
*/
11+
window.sajax_debug = function(text) {
12+
if (!sajax_debug_mode) return false;
13+
14+
var e = document.getElementById( 'sajax_debug' );
15+
16+
if ( !e ) {
17+
e = document.createElement( 'p' );
18+
e.className = 'sajax_debug';
19+
e.id = 'sajax_debug';
20+
21+
var b = document.getElementsByTagName( 'body' )[0];
22+
23+
if ( b.firstChild ) {
24+
b.insertBefore( e, b.firstChild );
25+
} else {
26+
b.appendChild( e );
27+
}
28+
}
29+
30+
var m = document.createElement( 'div' );
31+
m.appendChild( document.createTextNode( text ) );
32+
33+
e.appendChild( m );
34+
35+
return true;
36+
};
37+
38+
/**
39+
* Compatibility wrapper for creating a new XMLHttpRequest object.
40+
*/
41+
window.sajax_init_object = function() {
42+
sajax_debug( 'sajax_init_object() called..' );
43+
var A;
44+
try {
45+
// Try the new style before ActiveX so we don't
46+
// unnecessarily trigger warnings in IE 7 when
47+
// set to prompt about ActiveX usage
48+
A = new XMLHttpRequest();
49+
} catch ( e ) {
50+
try {
51+
A = new ActiveXObject( 'Msxml2.XMLHTTP' );
52+
} catch ( e ) {
53+
try {
54+
A = new ActiveXObject( 'Microsoft.XMLHTTP' );
55+
} catch ( oc ) {
56+
A = null;
57+
}
58+
}
59+
}
60+
if ( !A ) {
61+
sajax_debug( 'Could not create connection object.' );
62+
}
63+
64+
return A;
65+
};
66+
67+
/**
68+
* Perform an AJAX call to MediaWiki. Calls are handled by AjaxDispatcher.php
69+
* func_name - the name of the function to call. Must be registered in $wgAjaxExportList
70+
* args - an array of arguments to that function
71+
* target - the target that will handle the result of the call. If this is a function,
72+
* if will be called with the XMLHttpRequest as a parameter; if it's an input
73+
* element, its value will be set to the resultText; if it's another type of
74+
* element, its innerHTML will be set to the resultText.
75+
*
76+
* Example:
77+
* sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) );
78+
*
79+
* This will call the doFoo function via MediaWiki's AjaxDispatcher, with
80+
* (1, 2, 3) as the parameter list, and will show the result in the element
81+
* with id = showFoo
82+
*/
83+
window.sajax_do_call = function(func_name, args, target) {
84+
var i, x, n;
85+
var uri;
86+
var post_data;
87+
uri = mw.util.wikiScript() + '?action=ajax';
88+
if ( sajax_request_type == 'GET' ) {
89+
if ( uri.indexOf( '?' ) == -1 ) {
90+
uri = uri + '?rs=' + encodeURIComponent( func_name );
91+
} else {
92+
uri = uri + '&rs=' + encodeURIComponent( func_name );
93+
}
94+
for ( i = 0; i < args.length; i++ ) {
95+
uri = uri + '&rsargs[]=' + encodeURIComponent( args[i] );
96+
}
97+
//uri = uri + '&rsrnd=' + new Date().getTime();
98+
post_data = null;
99+
} else {
100+
post_data = 'rs=' + encodeURIComponent( func_name );
101+
for ( i = 0; i < args.length; i++ ) {
102+
post_data = post_data + '&rsargs[]=' + encodeURIComponent( args[i] );
103+
}
104+
}
105+
x = sajax_init_object();
106+
if ( !x ) {
107+
alert( 'AJAX not supported' );
108+
return false;
109+
}
110+
111+
try {
112+
x.open( sajax_request_type, uri, true );
113+
} catch ( e ) {
114+
if ( window.location.hostname == 'localhost' ) {
115+
alert( "Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing." );
116+
}
117+
throw e;
118+
}
119+
if ( sajax_request_type == 'POST' ) {
120+
x.setRequestHeader( 'Method', 'POST ' + uri + ' HTTP/1.1' );
121+
x.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
122+
}
123+
x.setRequestHeader( 'Pragma', 'cache=yes' );
124+
x.setRequestHeader( 'Cache-Control', 'no-transform' );
125+
x.onreadystatechange = function() {
126+
if ( x.readyState != 4 ) {
127+
return;
128+
}
129+
130+
sajax_debug( 'received (' + x.status + ' ' + x.statusText + ') ' + x.responseText );
131+
132+
//if ( x.status != 200 )
133+
// alert( 'Error: ' + x.status + ' ' + x.statusText + ': ' + x.responseText );
134+
//else
135+
136+
if ( typeof( target ) == 'function' ) {
137+
target( x );
138+
} else if ( typeof( target ) == 'object' ) {
139+
if ( target.tagName == 'INPUT' ) {
140+
if ( x.status == 200 ) {
141+
target.value= x.responseText;
142+
}
143+
//else alert( 'Error: ' + x.status + ' ' + x.statusText + ' (' + x.responseText + ')' );
144+
} else {
145+
if ( x.status == 200 ) {
146+
target.innerHTML = x.responseText;
147+
} else {
148+
target.innerHTML = '<div class="error">Error: ' + x.status +
149+
' ' + x.statusText + ' (' + x.responseText + ')</div>';
150+
}
151+
}
152+
} else {
153+
alert( 'bad target for sajax_do_call: not a function or object: ' + target );
154+
}
155+
};
156+
157+
sajax_debug( func_name + ' uri = ' + uri + ' / post = ' + post_data );
158+
x.send( post_data );
159+
sajax_debug( func_name + ' waiting..' );
160+
delete x;
161+
162+
return true;
163+
};
164+
165+
/**
166+
* @return boolean whether the browser supports XMLHttpRequest
167+
*/
168+
window.wfSupportsAjax = function() {
169+
var request = sajax_init_object();
170+
var supportsAjax = request ? true : false;
171+
delete request;
172+
return supportsAjax;
173+
};

0 commit comments

Comments
 (0)