├── bower.json
├── test
├── SilverlightBalls
│ ├── css
│ │ └── style.css
│ ├── assets
│ │ └── ball_n.xaml
│ ├── js
│ │ ├── wpfe.ball.js
│ │ ├── ball.js
│ │ └── Silverlight.js
│ └── wpfe.htm
└── test.html
├── ChangeLog.markdown
├── bgiframe.jquery.json
├── package.json
├── LICENSE.txt
├── jquery.bgiframe.js
└── README.markdown
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-bgiframe",
3 | "version": "3.0.1",
4 | "main": "./jquery.bgiframe.js",
5 | "ignore": [
6 | ".*",
7 | "*.txt",
8 | "*.markdown",
9 | "*.json",
10 | "test"
11 | ],
12 | "dependencies": {
13 | "jquery": ">=1.2.6"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/css/style.css:
--------------------------------------------------------------------------------
1 | body {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 80%; color: #333333; margin:0;}
2 | .host {border: thin black solid; width: 500px; height: 300px;}
3 | h2 {color: black; border-bottom: thin #999999 solid; padding-bottom: 15px;}
4 | img { behavior: url(assets/iepngfix.htc); }
5 | div {position: relative; overflow: hidden;}
6 | /*#wpfeHost {display: none;}
7 | #flashHost {display: none;}*/
8 | #dhtml_fps {width: 50px; padding: 5px; z-index: 1000;}
9 | #dhtml_ball_0 {z-index: 0;}
10 | span {cursor: hand; padding: 8px; margin: 2px; background-color: #ddddff; vertical-align:middle; display: block; float: left;}
11 |
12 | #subject {
13 | position: absolute;
14 | width: 52px;
15 | height: 52px;
16 | top: 124px;
17 | left: 224px;
18 | }
19 | #demoControls {
20 | margin-top: 10px;
21 | margin-bottom: 20px;
22 | }
--------------------------------------------------------------------------------
/ChangeLog.markdown:
--------------------------------------------------------------------------------
1 | # bgiframe Change Log
2 |
3 | ## 3.0.1
4 |
5 | * Fix default IE 6 regex
6 | * Add support for more package managers
7 |
8 | ## 3.0.0
9 |
10 | * Rewrite of the plugin
11 | * New conditional option (no longer restricted to IE6 only)
12 | * No longer uses CSS Expressions
13 | * Supports AMD loaders
14 |
15 | ## 2.1.2
16 |
17 | * Fixed visual test (test.html)
18 | * Small optimization to only check for IE once
19 |
20 | ## 2.1.1
21 |
22 | * Removed $.browser.version for jQuery < 1.1.3
23 |
24 | ## 2.1
25 |
26 | * Updated to work with jQuery 1.1.3
27 | * Added $.browser.version for jQuery < 1.1.3
28 | * Optimized duplication check by using child selector and using .length test
29 |
30 | ## 2.0
31 |
32 | * Added ability change settings like width, height, src and more.
33 |
34 | ## 1.0
35 |
36 | * Only adds iframe once per an element
37 | * Works with SSL enabled pages
38 |
--------------------------------------------------------------------------------
/bgiframe.jquery.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bgiframe",
3 | "title": "bgiframe",
4 | "description": "A jQuery plugin that helps ease the pain when having to deal with IE z-index issues.",
5 | "keywords": [
6 | "z-index",
7 | "iframe",
8 | "ie6",
9 | "silverlight",
10 | "issues",
11 | "bgiframe",
12 | "background"
13 | ],
14 | "version": "3.0.1",
15 | "author": {
16 | "name": "Brandon Aaron",
17 | "url": "http://brandonaaron.net"
18 | },
19 | "licenses": [
20 | {
21 | "type": "MIT",
22 | "url": "https://raw.github.com/brandonaaron/bgiframe/master/LICENSE.txt"
23 | }
24 | ],
25 | "bugs": "https://github.com/brandonaaron/bgiframe/issues",
26 | "homepage": "https://github.com/brandonaaron/bgiframe",
27 | "download": "https://github.com/brandonaaron/bgiframe/tags",
28 | "dependencies": {
29 | "jquery": ">=1.2.6"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-bgiframe",
3 | "version": "3.0.1",
4 | "author": "Brandon Aaron (http://brandon.aaron.sh)",
5 | "description": "A jQuery plugin that helps ease the pain when having to deal with IE z-index issues.",
6 | "main": "./jquery.bgiframe.js",
7 | "repository": {
8 | "type": "git",
9 | "url": "https://github.com/brandonaaron/bgiframe.git"
10 | },
11 | "bugs": {
12 | "url": "https://github.com/brandonaaron/bgiframe/issues"
13 | },
14 | "keywords": [
15 | "jquery",
16 | "plugin",
17 | "browser",
18 | "z-index",
19 | "iframe",
20 | "ie6",
21 | "silverlight",
22 | "issues",
23 | "bgiframe",
24 | "background"
25 | ],
26 | "licenses": [
27 | {
28 | "type": "MIT",
29 | "url": "https://raw.github.com/brandonaaron/bgiframe/master/LICENSE.txt"
30 | }
31 | ],
32 | "readmeFilename": "README.markdown",
33 | "directories": {
34 | "test": "test"
35 | },
36 | "jam": {
37 | "dependencies": {
38 | "jquery": ">=1.2.6"
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2013, Brandon Aaron (http://brandonaaron.net/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/assets/ball_n.xaml:
--------------------------------------------------------------------------------
1 |
2 |
30 |
--------------------------------------------------------------------------------
/jquery.bgiframe.js:
--------------------------------------------------------------------------------
1 | /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2 | * Licensed under the MIT License (LICENSE.txt).
3 | *
4 | * Version 3.0.1
5 | *
6 | * Requires jQuery >= 1.2.6
7 | */
8 |
9 | (function (factory) {
10 | if ( typeof define === 'function' && define.amd ) {
11 | // AMD. Register as an anonymous module.
12 | define(['jquery'], factory);
13 | } else if ( typeof exports === 'object' ) {
14 | // Node/CommonJS style for Browserify
15 | module.exports = factory;
16 | } else {
17 | // Browser globals
18 | factory(jQuery);
19 | }
20 | }(function ($) {
21 | $.fn.bgiframe = function(s) {
22 | s = $.extend({
23 | top : 'auto', // auto == borderTopWidth
24 | left : 'auto', // auto == borderLeftWidth
25 | width : 'auto', // auto == offsetWidth
26 | height : 'auto', // auto == offsetHeight
27 | opacity : true,
28 | src : 'javascript:false;',
29 | conditional : /MSIE 6\.0/.test(navigator.userAgent) // expression or function. return false to prevent iframe insertion
30 | }, s);
31 |
32 | // wrap conditional in a function if it isn't already
33 | if ( !$.isFunction(s.conditional) ) {
34 | var condition = s.conditional;
35 | s.conditional = function() { return condition; };
36 | }
37 |
38 | var $iframe = $('');
40 |
41 | return this.each(function() {
42 | var $this = $(this);
43 | if ( s.conditional(this) === false ) { return; }
44 | var existing = $this.children('iframe.bgiframe');
45 | var $el = existing.length === 0 ? $iframe.clone() : existing;
46 | $el.css({
47 | 'top': s.top == 'auto' ?
48 | ((parseInt($this.css('borderTopWidth'),10)||0)*-1)+'px' : prop(s.top),
49 | 'left': s.left == 'auto' ?
50 | ((parseInt($this.css('borderLeftWidth'),10)||0)*-1)+'px' : prop(s.left),
51 | 'width': s.width == 'auto' ? (this.offsetWidth + 'px') : prop(s.width),
52 | 'height': s.height == 'auto' ? (this.offsetHeight + 'px') : prop(s.height),
53 | 'opacity': s.opacity === true ? 0 : undefined
54 | });
55 |
56 | if ( existing.length === 0 ) {
57 | $this.prepend($el);
58 | }
59 | });
60 | };
61 |
62 | // old alias
63 | $.fn.bgIframe = $.fn.bgiframe;
64 |
65 | function prop(n) {
66 | return n && n.constructor === Number ? n + 'px' : n;
67 | }
68 |
69 | }));
70 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/js/wpfe.ball.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alex
3 | * @requires ball.js
4 | */
5 |
6 | /**
7 | * WPF/e-specific implementation
8 | *
9 | * @param {Object} name
10 | * @param {Object} x
11 | * @param {Object} y
12 | * @param {Object} vx
13 | * @param {Object} vy
14 | */
15 | function WPFEBall(host, name, x, y, vx, vy) {
16 | WPFEBall.baseConstructor.call(this, x, y, vx, vy);
17 | this._host = host;
18 | this._name = name;
19 | this._elem = host.content.findName(name);
20 | this.move();
21 | }
22 | extend(WPFEBall, Ball);
23 |
24 | WPFEBall.prototype.move = function(){
25 | WPFEBall.base.move.call(this);
26 | this._elem["canvas.left"] = this._x;
27 | this._elem["canvas.top"] = this._y;
28 | }
29 |
30 | WPFEBall.prototype.clone = function(newName, is_bmp) {
31 | // oops, wpf/e doesn't support objects cloning nor getting their XAML source!
32 | // it's just too bad -- I had to paste all XAML right here
33 | //
34 | var newXAML = "";
35 | if (this._is_bmp && this._is_bmp != undefined) {
36 | newXAML = '';
37 | } else {
38 | newXAML = ' ';
39 | }
40 |
41 | var newNode = this._host.content.createFromXaml(newXAML);
42 | this._elem.getParent().children.add(newNode);
43 | return new WPFEBall(this._host, newName);
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | # bgiframe
2 |
3 | Plugin has been rewritten to remove the use of CSS Expressions and to lift the restriction to IE6 only. The IE6 limitation is on by default but is now configurable by passing the `conditional` option. You may want to do this for instance if you are trying to layer on top of Silverlight in later IE versions. As a result of removing the CSS Expressions, you'll now need to re-run the bgiframe on elements that change their width, height, and/or borders after they are changed.
4 |
5 | The bgiframe plugin is chainable and applies the iframe hack to get around zIndex issues. It will only apply itself in IE6 (by default) and adds a class to the iframe called 'bgiframe'. The iframe is appended as the first child of the matched element(s) with a tabIndex and zIndex of -1.
6 |
7 | By default the plugin will take borders, sized with pixel units, into account. If a different unit is used for the border's width, then you will need to use the top and left settings as explained below.
8 |
9 |
10 | ## How do I use it?
11 |
12 | The usage is simple. Just call bgiframe on a jQuery collection of elements.
13 |
14 | $('.fix-z-index').bgiframe();
15 |
16 | If your element changes width, height, or border widths then you'll need to call bgiframe on those elements after the change.
17 |
18 | Here is an example of using a different conditional and recalling `bgiframe` on the manipulated element.
19 |
20 | var settings = { conditional: /MSIE/.test(navigator.userAgent) },
21 | $testing = $('#testing');
22 | $testing
23 | .bgiframe(settings)
24 | .bind('click', function(e) {
25 | $testing
26 | .width( $testing.width() + 10 )
27 | .height( $testing.height() + 10 )
28 | .bgiframe(settings);
29 | });
30 |
31 | ### Settings
32 |
33 | The plugin tries its best to handle most situations but sometimes some configuration is necessary. The following is a list of available settings.
34 |
35 | * `top` *(String|Number)*: The iframe must be offset to the top by the width of the top border. This should be a negative number representing the border-top-width. If a number is used here, pixels will be assumed. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use the elements border top width as calculated by jQuery.
36 | * `left` *(String|Number)*: The iframe must be offset to the left by the width of the left border. This should be a negative number representing the border-left-width. If a number is is used here, pixels will be assumed. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use the elements border left width as calculated by jQuery.
37 | * `width` *(String|Number)*: This is the width of the iframe. If a number is used here, pixels will be assume. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will the offsetWidth of the element.
38 | * `height` *(String|Number)*: This is the height of the iframe. If a number is used here, pixels will be assume. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use the offsetHeight of the element.
39 | * `opacity` *(Boolean)*: This is a boolean representing whether or not to use opacity. If set to true, the opacity of 0 is applied. If set to false, the opacity filter is not applied. Default: true.
40 | * `src` *(String)*: This setting is provided so that one could change the src of the iframe to whatever they need. Default: "javascript:false;"
41 | * `conditional` *(Boolean|Function)*: Turn on or off the injection of the iFrame. `true` to turn on the iFrame and `false` to turn it off. Default is IE6 only conditional.
42 |
43 | ## License
44 |
45 | The bgiframe plugin is licensed under the MIT License (LICENSE.txt).
46 |
47 | Copyright (c) 2013 [Brandon Aaron](http://brandon.aaron.sh)
48 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/js/ball.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @author alex
3 | */
4 | var model = {
5 | "walls" : {"left":0, "top":0, "right": 500, "bottom": 300},
6 | "elastity" : -0.2,
7 | "ballRadius" : 26,
8 | "maxSpeed" : 3.0
9 | };
10 |
11 | // helper
12 | var extend = function(subClass, baseClass)
13 | {
14 | // Create a new class that has an empty constructor
15 | // with the members of the baseClass
16 | function inheritance() {};
17 | inheritance.prototype = baseClass.prototype;
18 |
19 | // set prototype to new instance of baseClass
20 | // _without_ the constructor
21 | subClass.prototype = new inheritance();
22 | subClass.prototype.constructor = subClass;
23 | subClass.baseConstructor = baseClass;
24 |
25 | // enable multiple inheritance
26 | if (baseClass.base)
27 | {
28 | baseClass.prototype.base = baseClass.base;
29 | }
30 | subClass.base = baseClass.prototype;
31 | }
32 |
33 | /**
34 | * Base "platform-independent" class representing ball
35 | *
36 | * @param {Object} x
37 | * @param {Object} y
38 | * @param {Object} vx
39 | * @param {Object} vy
40 | */
41 | function Ball(x, y, vx, vy) {
42 | // default provisioning
43 | if (x == undefined) {
44 | x = (model.walls.right - model.walls.left - 2*model.ballRadius)*Math.random();
45 | y = (model.walls.bottom - model.walls.top - 2*model.ballRadius)*Math.random();
46 | vx = 2*model.maxSpeed*Math.random() - model.maxSpeed;
47 | vy = 2*model.maxSpeed*Math.random() - model.maxSpeed;
48 | }
49 | this._x = x;
50 | this._y = y;
51 | this._vx = vx;
52 | this._vy = vy;
53 | this._r = model.ballRadius; // d = 52 px
54 | this._d = 2*this._r;
55 | this._d2 = this._d*this._d;
56 | }
57 |
58 | Ball.prototype.move = function() {
59 | this._x += this._vx;
60 | this._y += this._vy;
61 | // walls collisons
62 |
63 | // left
64 | if (this._x < model.walls.left && this._vx<0) {
65 | //this._vx += (this._x - walls.left)*elastity;
66 | this._vx = -this._vx;
67 | }
68 | // top
69 | if (this._y < model.walls.top && this._vy<0) {
70 | //this._vy += (this._y - walls.top)*elastity;
71 | this._vy = -this._vy;
72 | }
73 | // left
74 | if (this._x > model.walls.right - this._d && this._vx>0) {
75 | //this._vx += (this._x - walls.right + this._d)*elastity;
76 | this._vx = -this._vx;
77 | }
78 | // top
79 | if (this._y > model.walls.bottom - this._d && this._vy>0) {
80 | //this._vy += (this._y - walls.bottom + this._d)*elastity;
81 | this._vy = -this._vy;
82 | }
83 | }
84 |
85 | Ball.prototype.doCollide = function(b) {
86 | // calculate some vectors
87 | var dx = this._x - b._x;
88 | var dy = this._y - b._y;
89 | var dvx = this._vx - b._vx;
90 | var dvy = this._vy - b._vy;
91 | var distance2 = dx*dx + dy*dy;
92 |
93 | if (Math.abs(dx) > this._d || Math.abs(dy) > this._d)
94 | return false;
95 | if (distance2 > this._d2)
96 | return false;
97 |
98 | // make absolutely elastic collision
99 | var mag = dvx*dx + dvy*dy;
100 |
101 | // test that balls move towards each other
102 | if (mag > 0)
103 | return false;
104 |
105 | mag /= distance2;
106 |
107 | var delta_vx = dx*mag;
108 | var delta_vy = dy*mag;
109 |
110 | this._vx -= delta_vx;
111 | this._vy -= delta_vy;
112 |
113 | b._vx += delta_vx;
114 | b._vy += delta_vy;
115 |
116 | return true;
117 | }
118 |
119 | /**
120 | * Abstract test class
121 | *
122 | * @param {Object} N
123 | */
124 | function BallsTest(N) {
125 | this._N = N; // number of objects
126 | this._ballsO = new Array();
127 | this._isRunning = false;
128 | }
129 |
130 | BallsTest.prototype._showFPS = null;
131 |
132 | BallsTest.prototype.start = function(N) {
133 | if (this._isRunning) return false;
134 | this._isRunning = true;
135 |
136 | if (N != undefined) {
137 | this._N = N;
138 | }
139 |
140 | this._F = 0; // frames counter for FPS
141 | this._lastF = 0;
142 | this._lastTime = new Date();
143 | var _this = this;
144 |
145 | var moveBalls = function() {
146 | if (_this._N > _this._ballsO.length)
147 | return;
148 | _this._F++;
149 | // move balls
150 | for (var i=0; i<_this._N; i++) {
151 | _this._ballsO[i].move();
152 | }
153 | // process collisions
154 | for (i=0; i<_this._N; i++) {
155 | for (j=i+1; j<_this._N; j++) {
156 | _this._ballsO[i].doCollide(_this._ballsO[j]);
157 | }
158 | }
159 | }
160 | var showFps = function() {
161 | if (_this._F - _this._lastF < 10) return;
162 | var currTime = new Date();
163 | var delta_t = (currTime.getMinutes() - _this._lastTime.getMinutes())*60 + currTime.getSeconds() - _this._lastTime.getSeconds() + (currTime.getMilliseconds() - _this._lastTime.getMilliseconds())/1000.0;
164 |
165 | delete currTime;
166 |
167 | var fps = (_this._F - _this._lastF)/delta_t;
168 |
169 | _this._lastF = _this._F;
170 | _this._lastTime = currTime;
171 |
172 | if (_this._showFPS)
173 | _this._showFPS.call(_this, Math.round(fps));
174 | }
175 |
176 | this._int1 = setInterval(moveBalls, 5);
177 | this._int2 = setInterval(showFps, 3000);
178 | return true;
179 | }
180 | BallsTest.prototype.stop = function(){
181 | if (!this._isRunning) return false;
182 | this._isRunning = false;
183 | clearInterval(this._int1);
184 | clearInterval(this._int2);
185 | return true;
186 | }
187 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/wpfe.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Balls animation test: Silverlight (WPF/e) vs DHTML vs Flash (Flex) vs WPF vs Apollo vs Java (Swing)
6 |
7 |
8 |
9 |
10 |
22 |
23 |
37 |
42 |
43 |
44 | Testing. Click to enlarge by 10px.
45 |
74 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/test/SilverlightBalls/js/Silverlight.js:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Silverlight.js (1.1 Preview) version 1.0
4 | //
5 | // This file is provided by Microsoft as a helper file for websites that
6 | // incorporate Silverlight Objects. This file is provided under the Silverlight
7 | // SDK 1.1 license available at http://go.microsoft.com/fwlink/?linkid=94243.
8 | // You may not use or distribute this file or the code in this file except as
9 | // expressly permitted under that license.
10 | //
11 | // Copyright (c) 2007 Microsoft Corporation. All rights reserved.
12 | //
13 | ///////////////////////////////////////////////////////////////////////////////
14 |
15 | if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.ua=null;Silverlight.available=false;Silverlight.fwlinkRoot="http://go.microsoft.com/fwlink/?LinkID=";Silverlight.StatusText="Get Microsoft Silverlight";Silverlight.EmptyText="";Silverlight.detectUserAgent=function(){var a=window.navigator.userAgent;Silverlight.ua={OS:"Unsupported",Browser:"Unsupported"};if(a.indexOf("Windows NT")>=0)Silverlight.ua.OS="Windows";else if(a.indexOf("PPC Mac OS X")>=0)Silverlight.ua.OS="MacPPC";else if(a.indexOf("Intel Mac OS X")>=0)Silverlight.ua.OS="MacIntel";if(Silverlight.ua.OS!="Unsupported")if(a.indexOf("MSIE")>=0){if(navigator.userAgent.indexOf("Win64")==-1)if(parseInt(a.split("MSIE")[1])>=6)Silverlight.ua.Browser="MSIE"}else if(a.indexOf("Firefox")>=0){var b=a.split("Firefox/")[1].split("."),c=parseInt(b[0]);if(c>=2)Silverlight.ua.Browser="Firefox";else{var d=parseInt(b[1]);if(c==1&&d>=5)Silverlight.ua.Browser="Firefox"}}else if(a.indexOf("Safari")>=0)Silverlight.ua.Browser="Safari"};Silverlight.detectUserAgent();Silverlight.isInstalled=function(d){var c=false,a=null;try{var b=null;if(Silverlight.ua.Browser=="MSIE")b=new ActiveXObject("AgControl.AgControl");else if(navigator.plugins["Silverlight Plug-In"]){a=document.createElement("div");document.body.appendChild(a);a.innerHTML='';b=a.childNodes[0]}if(b.IsVersionSupported(d))c=true;b=null;Silverlight.available=true}catch(e){c=false}if(a)document.body.removeChild(a);return c};Silverlight.createObject=function(l,g,m,j,k,i,h){var b={},a=j,c=k;a.source=l;b.parentElement=g;b.id=Silverlight.HtmlAttributeEncode(m);b.width=Silverlight.HtmlAttributeEncode(a.width);b.height=Silverlight.HtmlAttributeEncode(a.height);b.ignoreBrowserVer=Boolean(a.ignoreBrowserVer);b.inplaceInstallPrompt=Boolean(a.inplaceInstallPrompt);var e=a.version.split(".");b.shortVer=e[0]+"."+e[1];b.version=a.version;a.initParams=i;a.windowless=a.isWindowless;a.maxFramerate=a.framerate;for(var d in c)if(c[d]&&d!="onLoad"&&d!="onError"){a[d]=c[d];c[d]=null}delete a.width;delete a.height;delete a.id;delete a.onLoad;delete a.onError;delete a.ignoreBrowserVer;delete a.inplaceInstallPrompt;delete a.version;delete a.isWindowless;delete a.framerate;if(Silverlight.isInstalled(b.version)){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var f=Silverlight._silverlightCount++;a.onLoad="__slLoad"+f;a.onError="__slError"+f;window[a.onLoad]=function(a){if(c.onLoad)c.onLoad(document.getElementById(b.id),h,a)};window[a.onError]=function(a,b){if(c.onError)c.onError(a,b);else Silverlight.default_error_handler(a,b)};slPluginHTML=Silverlight.buildHTML(b,a)}else slPluginHTML=Silverlight.buildPromptHTML(b);if(b.parentElement)b.parentElement.innerHTML=slPluginHTML;else return slPluginHTML};Silverlight.supportedUserAgent=function(c){var a=Silverlight.ua,b=a.OS=="Unsupported"||a.Browser=="Unsupported"||a.OS=="Windows"&&a.Browser=="Safari"||a.OS.indexOf("Mac")>=0&&a.Browser=="IE";if(c=="1.1")return !(b||a.OS=="MacPPC");else return !b};Silverlight.buildHTML=function(c,d){var a=[],e,i,g,f,h;if(Silverlight.ua.Browser=="Safari"){a.push("'+""}else{a.push('"}a.push(' id="'+c.id+'" width="'+c.width+'" height="'+c.height+'" '+e);for(var b in d)if(d[b])a.push(i+Silverlight.HtmlAttributeEncode(b)+g+Silverlight.HtmlAttributeEncode(d[b])+f);a.push(h);return a.join("")};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(e){var a=null,g=Silverlight.fwlinkRoot,c=Silverlight.ua.OS,b="92822",d;if(e.shortVer=="1.1")e.inplaceInstallPrompt=false;if(e.inplaceInstallPrompt){var i;if(Silverlight.available){d="94376";i="94382"}else{d="92802";i="94381"}var h="93481",f="93483";if(c=="Windows"){b="92799";h="92803";f="92805"}else if(c=="MacIntel"){b="92808";h="92804";f="92806"}else if(c=="MacPPC"){b="92807";h="92815";f="92816"}a='';a=a.replace("{2}",g+h);a=a.replace("{3}",g+f);a=a.replace("{4}",g+i)}else{if(e.shortVer=="1.1"){b="92821";if(Silverlight.available)d="94378";else d="92810";if(c=="Windows")b="92809";else if(c=="MacIntel")b="92813"}else{if(Silverlight.available)d="94377";else d="92801";if(c=="Windows")b="92800";else if(c=="MacIntel")b="92812";else if(c=="MacPPC")b="92811"}a='
'}a=a.replace("{0}",b);a=a.replace("{1}",g+d);return a};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--){window["__slLoad"+a]=null;window["__slError"+a]=null}if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+""+a+";"}return b}
--------------------------------------------------------------------------------
/test/test.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | jQuery bgiframe Visual Test
7 |
19 |
20 |
21 |
33 |
34 |
45 |
46 |
47 | jQuery bgiframe - Visual Test
48 |
49 |
73 |
74 |
nothing
75 |
76 |
77 | - top:
78 | - 'auto'
79 |
80 | - left:
81 | - 'auto'
82 |
83 | - width:
84 | - 'auto'
85 |
86 | - height:
87 | - 'auto'
88 |
89 |
90 |
91 |
92 | - top:
93 | - 0
94 |
95 | - left:
96 | - 0
97 |
98 | - width:
99 | - 'auto'
100 |
101 | - height:
102 | - 'auto'
103 |
104 |
105 |
106 |
107 | - top:
108 | - -5
109 |
110 | - left:
111 | - -5
112 |
113 | - width:
114 | - 270
115 |
116 | - height:
117 | - 120
118 |
119 |
120 |
121 |
122 | - top:
123 | - 0
124 |
125 | - left:
126 | - 0
127 |
128 | - width:
129 | - 260
130 |
131 | - height:
132 | - 110
133 |
134 |
135 |
136 |
137 | - top:
138 | - '-5px'
139 |
140 | - left:
141 | - '-5px'
142 |
143 | - width:
144 | - '270px'
145 |
146 | - height:
147 | - '120px'
148 |
149 |
150 |
151 |
152 | - top:
153 | - '-.5em'
154 |
155 | - left:
156 | - '-.5em'
157 |
158 | - width:
159 | - '17em'
160 |
161 | - height:
162 | - '12em'
163 |
164 |
165 |
166 |
167 | - top:
168 | - '-.5em'
169 |
170 | - left:
171 | - '-.5em'
172 |
173 | - width:
174 | - 'auto'
175 |
176 | - height:
177 | - 'auto'
178 |
179 |
180 |
181 |
182 | - top:
183 | - 'auto'
184 |
185 | - left:
186 | - 'auto'
187 |
188 | - width:
189 | - 'auto'
190 |
191 | - height:
192 | - 'auto'
193 |
194 | - opacity:
195 | - false
196 |
197 |
198 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------