diff --git a/AppKit/CPFlashView.j b/AppKit/CPFlashView.j index 5d3f983a4..d1c0a9ba0 100644 --- a/AppKit/CPFlashView.j +++ b/AppKit/CPFlashView.j @@ -30,6 +30,10 @@ @implementation CPFlashView : CPView { CPFlashMovie _flashMovie; + CPDictionary _flashVars; + + CPDictionary _params; + CPDictionary _paramElements; DOMElement _DOMEmbedElement; DOMElement _DOMMParamElement; @@ -61,12 +65,12 @@ _DOMObjectElement.appendChild(param); _DOMEmbedElement = document.createElement("embed"); - + _DOMEmbedElement.type = "application/x-shockwave-flash"; _DOMEmbedElement.setAttribute("wmode", "transparent"); _DOMEmbedElement.width = "100%"; _DOMEmbedElement.height = "100%"; - + // IE requires this thing to be in the _DOMElement and not the _DOMObjectElement. _DOMElement.appendChild(_DOMEmbedElement); @@ -94,6 +98,66 @@ return _flashMovie; } +- (void)setFlashVars:(CPDictionary)aDictionary +{ + _flashVars = aDictionary; + + var varString = @"", + enumerator = [_flashVars keyEnumerator]; + + var key; + while (key = [enumerator nextObject]) + varString = [varString stringByAppendingFormat:@"&%@=%@", key, [_flashVars objectForKey:key]]; + + var param = document.createElement(@"param"); + param.name = @"flashvars"; + param.value = varString; + + _DOMObjectElement.appendChild(param); + + if (_DOMEmbedElement) + _DOMEmbedElement.setAttribute(@"flashvars", varString); +} + +- (CPDictionary)flashVars +{ + return _flashVars; +} + +- (void)setParameters:(CPDictionary)aDictionary +{ + if (_paramElements) + { + var elements = [_paramElements allValues], + count = [elements count]; + + for (var i = 0; i < count; i++) + _DOMObjectElement.removeChild([elements objectAtIndex:i]); + } + + _params = aDictionary; + _paramElements = [CPDictionary dictionary]; + + var enumerator = [_params keyEnumerator], + key; + + while (key = [enumerator nextObject]) + { + var param = document.createElement(@"param"); + param.name = key; + param.value = [_params objectForKey:key]; + + _DOMObjectElement.appendChild(param); + + [_paramElements setObject:param forKey:key]; + } +} + +- (CPDictionary)parameters +{ + return _params; +} + - (void)mouseDragged:(CPEvent)anEvent { [[[self window] platformWindow] _propagateCurrentDOMEvent:YES]; diff --git a/AppKit/Resources/GenericFile.png b/AppKit/Resources/GenericFile.png new file mode 100644 index 000000000..f6147a176 Binary files /dev/null and b/AppKit/Resources/GenericFile.png differ diff --git a/Objective-J/Runtime/bootstrap.js b/Objective-J/Runtime/bootstrap.js index 42d4767e6..e7024f607 100644 --- a/Objective-J/Runtime/bootstrap.js +++ b/Objective-J/Runtime/bootstrap.js @@ -21,4 +21,28 @@ */ if (window.OBJJ_MAIN_FILE) - objj_import(OBJJ_MAIN_FILE, YES, function() { main(); }); +{ + var addOnload = function(handler) + { + if (window.addEventListener) + window.addEventListener("load", handler, false); + else if (window.attachEvent) + window.attachEvent("onload", handler); + } + + var documentLoaded = NO; + var defaultHandler = function() + { + documentLoaded = YES; + } + + addOnload(defaultHandler); + + objj_import(OBJJ_MAIN_FILE, YES, function() + { + if (documentLoaded) + main(); + else + addOnload(main); + }); +} diff --git a/Objective-J/Runtime/file.js b/Objective-J/Runtime/file.js index 50f356451..6be59a575 100644 --- a/Objective-J/Runtime/file.js +++ b/Objective-J/Runtime/file.js @@ -32,10 +32,13 @@ var OBJJ_ENVIRONMENTS = ENVIRONMENTS; #ifdef PLATFORM_USERAGENT var userAgent = window.navigator.userAgent; -if (userAgent.indexOf("MSIE 7") !== -1) - OBJJ_ENVIRONMENTS.unshift("IE7"); -else if (userAgent.indexOf("MSIE 8") !== -1) - OBJJ_ENVIRONMENTS.unshift("IE8"); +if (userAgent.indexOf("MSIE") !== -1) +{ + if (userAgent.indexOf("MSIE 8") !== -1) + OBJJ_ENVIRONMENTS.unshift("IE8"); + else + OBJJ_ENVIRONMENTS.unshift("IE7"); +} else OBJJ_ENVIRONMENTS.unshift("W3C"); #endif diff --git a/common.jake b/common.jake index 60872c14f..bd1ec004d 100644 --- a/common.jake +++ b/common.jake @@ -31,7 +31,7 @@ function ensurePackageUpToDate(packageName, requiredVersion) } // UPDATE THESE TO PICK UP CORRESPONDING CHANGES IN DEPENDENCIES -ensurePackageUpToDate("jake", "0.1.1"); +ensurePackageUpToDate("jake", "0.1.2"); ensurePackageUpToDate("browserjs", "0.1.1"); var Jake = require("jake");