diff --git a/.gitignore b/.gitignore index 352fb6e21..5489f4321 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ obj/ *.cache *.trx Scripts/ +packages/ +TestResults/ diff --git a/docs/History.txt b/History.txt similarity index 76% rename from docs/History.txt rename to History.txt index cfd331f94..d93d10faa 100644 --- a/docs/History.txt +++ b/History.txt @@ -1,7 +1,40 @@ Changelog =============================================================================== -v0.7.5.0 [in progress] +v0.7.6 + - Removed script loading APIs from Script class in mscorlib + (moved them to Loader class in Script.Web) + - Removed script startup functionality from mscorlib.js ... all script + loading is now in ssloader.js (and included into the Runtime nuget + package) + - Removed Script.Alert/Confirm/Prompt from mscorlib and moved them to + Window in Script.Web + - Moved SetTimeout, SetInterval and ClearTimeout, ClearInterval from + Window object to Script object in mscorlib. + - Removed some methods from Type as part of cleanup (AddHandler, + GetProperty, RemoveHandler, SetProperty, IsEnum, IsFlags, IsNamespace, + GetInterfaces, Parse) + - Removed window dependency in mscorlib.js + - Debug class now maps directly to console + - Moved GetField, HasField, DeleteField, HasMethod, InvokeMethod, + CreateInstance, GetScriptType off Type and onto Script while + HasProperty, GetProperty, SetProperty, AddHandler, RemoveHandler are gone + - Optimize generation of static ctors to use a function scope only when + static ctors have a local variable reference. + Should help optimize generation of jQuery scripts, by reducing one extra + function scope. + - Removed Aggregate method from Array, ArrayList and List. Use Reduce instead. + Removed the corresponding custom implementation from mscorlib.js. + - [git #131] Correctly detect member references within array initializers + - [git #161] Add Slice, Splice, Shift, Unshift, Reduce, ReduceRight to + Array, ArrayList and List. + - [git #228] Restore ability to generate public resource classes + (Change Custom Tool property of resx file to + ResxPublicScriptGenerator) + - [git #230] Add String.IsNullOrWhitespace + - [git #234] Knockout API update - added CompareResult status enum + +v0.7.5.0 - DOM metadata update (readyState property on Document, plugins on Navigator) - jQuery API update (on/off methods) @@ -26,6 +59,19 @@ v0.7.5.0 [in progress] - [git #187] Support for writing 'new Image()' - [git #189] Fixed jQuery.when metadata - [git #201] Strongly typed some Knockout API (KnockoutMapping) + - Nuget packages for compiler, and individual import libraries + - VSIX-based approach for getting script# and associated templates + - Breaking changes: + - In a csproj, the TemplateFile property has been changed to ScriptTemplate + - When creating a project there is no prompt to setup a DeploymentPath + ... but for now, msbuild support continues to exist (via manual edit) + ... will potentially be replaced eventually. + - No more support for WebAppParitioning. If you were compiling multiple script + files out of a single c# project, this feature is gone. You can switch your + msbuild scripts to use the ScriptCompilerExecTask, instead of ScriptCompilerTask + and invoke the compiler multiple times for each script file, passing in exactly + the right set of sources for each script file to be generated. + - Removed Script.Windows.dll and gadget project v0.7.4.0 - Fix/update bing maps metadata bug diff --git a/License.txt b/License.txt index ae7144c3e..5f0dac0af 100644 --- a/License.txt +++ b/License.txt @@ -1,4 +1,7 @@ - + Script# Project + Copyright 2012, Script# Project + Copyright 2012, Nikhil Kothari + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -36,8 +39,7 @@ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). + copyright notice that is included in or attached to the work. "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the @@ -105,20 +107,20 @@ excluding those notices that do not pertain to any part of the Derivative Works; and - (d) If the Work includes a "NOTICE" text file as part of its + (d) If the Work includes a "License.txt" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not + within such License.txt file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed + of the following places: within a License.txt text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and + of the License.txt file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided + or as an addendum to the License.txt text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. diff --git a/Notice.txt b/Notice.txt new file mode 100644 index 000000000..76e1ddbbc --- /dev/null +++ b/Notice.txt @@ -0,0 +1,13 @@ +Script# Project +Copyright 2012, Script# Project +Copyright 2012, Nikhil Kothari + +Script# is licensed under the Apache License v2.0 (see License.txt). +Script# also includes works distributed under the licenses listed below. + +Mono Cecil +-------------- +Website: https://github.com/jbevain/cecil +Copyright: Copyright (c) 2008 - 2011 Jb Evain +License: The MIT License + http://opensource.org/licenses/mit-license.php diff --git a/Readme.md b/Readme.md index b6451d644..3140c065d 100644 --- a/Readme.md +++ b/Readme.md @@ -1,37 +1,37 @@ -# Welcome to the Script# Project # +# Script# Project # Script# is a development tool that generates JavaScript by compiling C# source code. It is especially interesting for scripting-in-the-large scenarios that is commonplace in the current generation of HTML5 and script-based Web applications. -Script# lets you leverage the productivity of C# (intellisense, build-time error checking, natural language syntax), and the power Visual Studio IDE and standard .NET tools (such as msbuild, refactoring, unit testing, static analysis, code visualization, fxcop). Script# brings all this to you without abstracting the runtime environment - you're still authoring script, just with a different set of tools. +The driving principle behind Script# is that JavaScript is the "assembly language of the Web" ... the idea isn't to dislike JavaScript, but rather appreciate it for its flexibility and ubiquity, while bringing the productivity and familiarity of C# when building large scale (large codebase, large team or project over a longer period) application where stronger tools, more maintainable codebases are of utmost importance. You might have heard of this described as "application scale". -You can even use Script# to work against other existing frameworks and APIs such as jQuery, jQuery plugins and Knockout, and can be extended to work against other existing script. - -Script# requires .NET 4.0 and Visual Studio 2010 or (the free) Visual Web Developer Express 2010. +Specifically, Script# lets you leverage the experience of C# (intellisense, build-time error checking, natural language syntax for OOP constructs), the power Visual Studio IDE and standard .NET tools ecosystem (such as msbuild, refactoring, unit testing, static analysis, code visualization, fxcop). Script# brings all this to you without abstracting the runtime environment - you're still authoring plain-old JavaScript and incorporating the best practices and idioms of JavaScript, just with a different set of tools. -To learn more about Script#, check out the project site, [http://www.scriptsharp.com](http://www.scriptsharp.com). You can also follow [@scriptsharp](http://twitter.com/scriptsharp) on twitter for the latest announcements. If you'd like, you can also ask general questions about using script# on [stack overflow](http://stackoverflow.com/questions/tagged/script%23). - -## Current Status ## +You can even use Script# to work against other existing frameworks and APIs such as jQuery, jQuery plugins and Knockout, and can be extended to work against other existing script. -Script# has been an ongoing project for many years, and as such is quite usable. It is in fact used across a number of large (and some *very* large) and successful deployed projects, both within Microsoft and amongst other developers. +Script# requires .NET 4.0 and Visual Studio 2012. You can also use one of the free Express tools instead such as [Visual Studio 2012 Express for Web](http://www.microsoft.com/visualstudio/eng/downloads#d-express-web) or [Visual Studio 2012 Express for Windows Desktop](http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop). -One area where Script# lacks is good and current documentation. While this is addressed (please stay tuned), be sure to check out the [sample apps](https://github.com/nikhilk/scriptsharp/tree/master/samples) in the repository. +## More Information ## +The following set of links are relevant if you're using Script# and want to learn more or ask questions, or stay up-to-date. -There is always room for further improvement that range from bug fixes to full-blown features. If you have feedback or suggestions, be sure to [file an issue](https://github.com/nikhilk/scriptsharp/issues). +* [Script# Project page](http://scriptsharp.com) +* [Latest released build](http://bit.ly/ssrelease) (packaged as a Visual Studio extension containing Script# project and item templates) +* [Issues, suggestions](https://github.com/nikhilk/scriptsharp/issues) here on GitHub. Also, check this out to participate in future design questions, calls for feedback, etc. +* For general discussion and Q&A, use [StackOverflow](http://stackoverflow.com/questions/tagged/scriptsharp) +* Follow [@scriptsharp](http://twitter.com/scriptsharp) and [@nikhilk](http://twitter.com/nikhilk) on twitter to keep up with updates and announcements. -The current release is v0.7.4. The next release, v0.7.5 is slated to be a bug fix release. Thereafter work will begin on a major update that brings about a much improved script generation model that incorporates a number of learnings over the years. +The [Script# Wiki](https://github.com/nikhilk/scriptsharp/wiki/Wiki) contains the following bits of information if you're checking out the repository, are interested in creating a private build, or even better, looking to contribute to the project. +* [Repository Contents](https://github.com/nikhilk/scriptsharp/wiki/Repository) +* [Status](https://github.com/nikhilk/scriptsharp/wiki/Status), including roadmap and some thoughts about areas of contribution +* [Building and testing](https://github.com/nikhilk/scriptsharp/wiki/Building-and-Testing) the sources, and information on using private as well as incremental pre-release builds +* [Coding guidelines](https://github.com/nikhilk/scriptsharp/wiki/Coding-Guidelines) -## Credits ## +### Credits ### Script# builds on the excellent Mono.Cecil project. Thanks to Jb Evain. -## License ## +Thanks to [all the contributors](https://github.com/nikhilk/scriptsharp/graphs/contributors) who have contributed to Script# over time. Your contributions are welcome, and appreciated. Let me know how you can help - whether its in the form of a feature, a sample, or some evangelizing/spreading the word, or via a suggestion. See the [status page](https://github.com/nikhilk/scriptsharp/wiki/Status) in the wiki for roadmap, plans, and some thoughts about possible contributions. + +### License ### Copyright (c) 2012, Script# Project. Script# is licensed under the Apache 2.0 License. - -## Contributing ## - -You are welcome to contribute to script# by reporting bugs/issues, creating and evangelizing samples and success stories, as well as with code. -Contributors implicity grant all rights to any code updates/additions made to the project for inclusion under the Apache 2 license. - -Fork away, and create a pull request! For any major functionality you'd like to add, it might be good to discuss and share thoughts to better coordinate. diff --git a/bin/cleanup.bat b/bin/cleanup.bat deleted file mode 100644 index cd4ecbc49..000000000 --- a/bin/cleanup.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off - -REM This script cleans up what setup.bat does. -REM It must be run within an Administrator command prompt. - -@echo Cleaning GAC entries... -gacutil /nologo /uf ScriptSharp -gacutil /nologo /uf ScriptSharp.Build -gacutil /nologo /uf ScriptSharp.Testing -gacutil /nologo /uf ScriptSharp.VisualStudio - -set InstallDir=%ProgramFiles(x86)% -if "%InstallDir%" == "" set InstallDir=%ProgramFiles% - -@echo Removing script# folder... -rd /s /q "%InstallDir%\ScriptSharp\v1.0" - -if "%1" neq "includeTemplates" goto Done - -:Templates -@echo Cleaning up templates... -set IDEDir="%VSINSTALLDIR%"\Common7\IDE -rd /s /q "%IDEDir%"\ProjectTemplates\CSharp\Script# -rd /s /q "%IDEDir%"\ItemTemplates\CSharp\Script# -%IDEDir%\devenv.exe /installvstemplates - -:Done diff --git a/bin/ref/ScriptSharp.dll b/bin/ref/ScriptSharp.dll deleted file mode 100644 index dfe6a8d62..000000000 Binary files a/bin/ref/ScriptSharp.dll and /dev/null differ diff --git a/bin/setup.bat b/bin/setup.bat deleted file mode 100644 index 079d20021..000000000 --- a/bin/setup.bat +++ /dev/null @@ -1,86 +0,0 @@ -@echo off - -REM This script installs a script# build (over what the msi installs) -REM It must be run within an Administrator command prompt. - -set InstallDir=%ProgramFiles(x86)% -if "%InstallDir%" == "" set InstallDir=%ProgramFiles% - -mkdir "%InstallDir%\ScriptSharp\v1.0\Framework" -mkdir "%InstallDir%\ScriptSharp\v1.0\CodeAnalysis" - -@echo Copying binaries... -copy /y Debug\ssc.exe "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\sspp.exe "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\ScriptSharp.dll "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\ScriptSharp.Build.dll "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\ScriptSharp.Testing.dll "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\ScriptSharp.VisualStudio.dll "%InstallDir%\ScriptSharp\v1.0" -copy /y Debug\ScriptSharp.FxCop.dll "%InstallDir%\ScriptSharp\v1.0\CodeAnalysis" -copy /y Debug\ScriptSharp.targets "%InstallDir%\ScriptSharp\v1.0" - -@echo Adding GAC entries... -gacutil /nologo /if "%InstallDir%\ScriptSharp\v1.0\ScriptSharp.dll -gacutil /nologo /if "%InstallDir%\ScriptSharp\v1.0\ScriptSharp.Build.dll -gacutil /nologo /if "%InstallDir%\ScriptSharp\v1.0\ScriptSharp.Testing.dll" -gacutil /nologo /if "%InstallDir%\ScriptSharp\v1.0\ScriptSharp.VisualStudio.dll" - -@echo Copying scripts... -copy /y ref\mscorlib.js "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y ref\mscorlib.debug.js "%InstallDir%\ScriptSharp\v1.0\Framework" - -@echo Copying assemblies... -copy /y Debug\mscorlib.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\mscorlib.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Web.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Web.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Windows.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Windows.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.UI.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.UI.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.UI.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.History.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.History.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.History.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Templating.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Templating.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Templating.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Validation.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Validation.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.jQuery.Validation.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Knockout.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Knockout.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Knockout.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Microsoft.BingMaps.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Microsoft.BingMaps.xml "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Microsoft.BingMaps.txt "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Sharpen.Framework.dll "%InstallDir%\ScriptSharp\v1.0\Framework" -copy /y Debug\Script.Sharpen.Framework.xml "%InstallDir%\ScriptSharp\v1.0\Framework" - -if "%1" neq "includeTemplates" goto Done - -:Templates -@echo Setting up templates... -set IDEDir="%VSINSTALLDIR%"Common7\IDE -mkdir "%IDEDir%"\ProjectTemplates\CSharp\Script# -mkdir "%IDEDir%"\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\Script#.VSTDIR %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\ProjectTemplates\ClassLibrary.zip %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\ProjectTemplates\jQueryClassLibrary.zip %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\ProjectTemplates\Gadget.zip %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\ProjectTemplates\UnitTest.zip %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\ProjectTemplates\ImportLibrary.zip %IDEDir%\ProjectTemplates\CSharp\Script# -copy /y Debug\Templates\Script#.VSTDIR %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\Class.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\Page.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\jQueryPage.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\jQueryPlugin.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\Resource.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\Scriptlet.zip %IDEDir%\ItemTemplates\CSharp\Script# -copy /y Debug\Templates\ItemTemplates\TestClass.zip %IDEDir%\ItemTemplates\CSharp\Script# -%IDEDir%\devenv.exe /installvstemplates - -:Done diff --git a/docs/Backlog.txt b/docs/Backlog.txt deleted file mode 100644 index ef2566b4c..000000000 --- a/docs/Backlog.txt +++ /dev/null @@ -1,8 +0,0 @@ -Compiler -=============================================================================== -- Number truncation when assigning to integer variable - (assignment, +=, -=, /= etc.) - -- Script generation overhaul and optimization - -- Look into substr/substring and matching c# semantics diff --git a/docs/CodingGuidelines.docx b/docs/CodingGuidelines.docx deleted file mode 100644 index 1f2fdf161..000000000 Binary files a/docs/CodingGuidelines.docx and /dev/null differ diff --git a/ext/FxCopSdk.dll b/ext/FxCopSdk.dll deleted file mode 100644 index 39738cefd..000000000 Binary files a/ext/FxCopSdk.dll and /dev/null differ diff --git a/ext/MSBuildTasks/Info.txt b/ext/MSBuildTasks/Info.txt deleted file mode 100644 index 09d2054b1..000000000 --- a/ext/MSBuildTasks/Info.txt +++ /dev/null @@ -1,4 +0,0 @@ -MSBuild Community Tasks - -http://msbuildtasks.tigris.org/ -v1.2.0.306 diff --git a/ext/MSBuildTasks/MSBuild.Community.Tasks.v1.2.0.306.zip b/ext/MSBuildTasks/MSBuild.Community.Tasks.v1.2.0.306.zip deleted file mode 100644 index 00d6b92f1..000000000 Binary files a/ext/MSBuildTasks/MSBuild.Community.Tasks.v1.2.0.306.zip and /dev/null differ diff --git a/ext/Microsoft.Cci.dll b/ext/Microsoft.Cci.dll deleted file mode 100644 index 9cd5df843..000000000 Binary files a/ext/Microsoft.Cci.dll and /dev/null differ diff --git a/samples/AroundMe/AroundMe.sln b/samples/AroundMe/AroundMe.sln index 2a8ceda41..c69f9e195 100644 --- a/samples/AroundMe/AroundMe.sln +++ b/samples/AroundMe/AroundMe.sln @@ -1,13 +1,18 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMeWeb", "AroundMeWeb\AroundMeWeb.csproj", "{B190181B-16F9-40A8-B431-2D80DE63D081}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMe", "AroundMe\AroundMe.csproj", "{C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMe", "AroundMe\AroundMe.csproj", "{DFF9B9D5-5CE0-448E-ADAF-47E26A72017E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Twitter", "Twitter\Twitter.csproj", "{476312F9-5403-4C3A-848A-0F31213FC72E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMeTests", "AroundMeTests\AroundMeTests.csproj", "{1A55F098-B1B4-41BC-93F7-EE89A85B0AF6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapDemo", "MapDemo\MapDemo.csproj", "{2176DBB5-D8FD-493C-B896-59E7283E7127}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Twitter", "Twitter\Twitter.csproj", "{135E07CB-462D-4014-BD74-FF565C60A46D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AroundMeTests", "AroundMeTests\AroundMeTests.csproj", "{E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F9ED6BAF-639F-4F4B-8E04-C6AE7EAE860A}" + ProjectSection(SolutionItems) = preProject + AroundMeTests.testsettings = AroundMeTests.testsettings + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,22 +20,22 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B190181B-16F9-40A8-B431-2D80DE63D081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B190181B-16F9-40A8-B431-2D80DE63D081}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B190181B-16F9-40A8-B431-2D80DE63D081}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B190181B-16F9-40A8-B431-2D80DE63D081}.Release|Any CPU.Build.0 = Release|Any CPU - {DFF9B9D5-5CE0-448E-ADAF-47E26A72017E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFF9B9D5-5CE0-448E-ADAF-47E26A72017E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFF9B9D5-5CE0-448E-ADAF-47E26A72017E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFF9B9D5-5CE0-448E-ADAF-47E26A72017E}.Release|Any CPU.Build.0 = Release|Any CPU - {1A55F098-B1B4-41BC-93F7-EE89A85B0AF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1A55F098-B1B4-41BC-93F7-EE89A85B0AF6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A55F098-B1B4-41BC-93F7-EE89A85B0AF6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1A55F098-B1B4-41BC-93F7-EE89A85B0AF6}.Release|Any CPU.Build.0 = Release|Any CPU - {135E07CB-462D-4014-BD74-FF565C60A46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {135E07CB-462D-4014-BD74-FF565C60A46D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {135E07CB-462D-4014-BD74-FF565C60A46D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {135E07CB-462D-4014-BD74-FF565C60A46D}.Release|Any CPU.Build.0 = Release|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2176DBB5-D8FD-493C-B896-59E7283E7127}.Release|Any CPU.Build.0 = Release|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {476312F9-5403-4C3A-848A-0F31213FC72E}.Release|Any CPU.Build.0 = Release|Any CPU + {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56}.Release|Any CPU.Build.0 = Release|Any CPU + {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/AroundMe/AroundMe/AroundMe.csproj b/samples/AroundMe/AroundMe/AroundMe.csproj index 64c0c5352..ef7bf43cb 100644 --- a/samples/AroundMe/AroundMe/AroundMe.csproj +++ b/samples/AroundMe/AroundMe/AroundMe.csproj @@ -5,75 +5,114 @@ AnyCPU 8.0.30703 2.0 - {DFF9B9D5-5CE0-448E-ADAF-47E26A72017E} + {C1AFF814-2C3A-4D04-88A4-5CF10D07AA56} Library - True - v4.0 - - ISO-2 Properties AroundMe AroundMe - Properties\AroundMe.script - Properties\AroundMe.ruleset - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ - ..\AroundMeWeb\Content\Scripts + Properties\Script.template + Properties\FxCop.ruleset + True + True + true - true - pdbonly bin\Debug\ - DEBUG;CODE_ANALYSIS + DEBUG;CODE_ANALYSIS;SCRIPTSHARP prompt 4 0028, 1591, 1684 - - + bin\Debug\AroundMe.xml - true - pdbonly bin\Release\ - CODE_ANALYSIS + CODE_ANALYSIS;SCRIPTSHARP prompt 4 0028, 1591, 1684 - - + bin\Release\AroundMe.xml - - - - - - - - - - - + + - - + + - - - - + + + + + + + + + + + + ..\packages\ScriptSharp.Lib.BingMaps.0.7.5.0\lib\Script.Microsoft.BingMaps.dll + + + ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + + - {135E07CB-462D-4014-BD74-FF565C60A46D} + {476312f9-5403-4c3a-848a-0f31213fc72e} Twitter - + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMe/Content/AroundMe.htm b/samples/AroundMe/AroundMe/Content/AroundMe.htm new file mode 100644 index 000000000..d5846da06 --- /dev/null +++ b/samples/AroundMe/AroundMe/Content/AroundMe.htm @@ -0,0 +1,41 @@ + + + + Photos Around Me + + + + +
+
+
Photos Around Me
+
+ + + + +
+
+
+
+
+ + +
+ + + + + +
+
+
+ + + + + + diff --git a/samples/AroundMe/AroundMeWeb/Content/CloseButton.png b/samples/AroundMe/AroundMe/Content/CloseButton.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/CloseButton.png rename to samples/AroundMe/AroundMe/Content/CloseButton.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Dot.png b/samples/AroundMe/AroundMe/Content/Dot.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Dot.png rename to samples/AroundMe/AroundMe/Content/Dot.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Flickr.png b/samples/AroundMe/AroundMe/Content/Flickr.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Flickr.png rename to samples/AroundMe/AroundMe/Content/Flickr.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Heart.png b/samples/AroundMe/AroundMe/Content/Heart.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Heart.png rename to samples/AroundMe/AroundMe/Content/Heart.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Location.png b/samples/AroundMe/AroundMe/Content/Location.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Location.png rename to samples/AroundMe/AroundMe/Content/Location.png diff --git a/samples/AroundMe/AroundMeWeb/Content/PlaceHolder.png b/samples/AroundMe/AroundMe/Content/PlaceHolder.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/PlaceHolder.png rename to samples/AroundMe/AroundMe/Content/PlaceHolder.png diff --git a/samples/AroundMe/AroundMeWeb/Content/ProgressBar.gif b/samples/AroundMe/AroundMe/Content/ProgressBar.gif similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/ProgressBar.gif rename to samples/AroundMe/AroundMe/Content/ProgressBar.gif diff --git a/samples/AroundMe/AroundMeWeb/Content/Pushpin.png b/samples/AroundMe/AroundMe/Content/Pushpin.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Pushpin.png rename to samples/AroundMe/AroundMe/Content/Pushpin.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Reset.png b/samples/AroundMe/AroundMe/Content/Reset.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Reset.png rename to samples/AroundMe/AroundMe/Content/Reset.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Search.png b/samples/AroundMe/AroundMe/Content/Search.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Search.png rename to samples/AroundMe/AroundMe/Content/Search.png diff --git a/samples/AroundMe/AroundMeWeb/Content/Site.css b/samples/AroundMe/AroundMe/Content/Site.css similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Site.css rename to samples/AroundMe/AroundMe/Content/Site.css diff --git a/samples/AroundMe/AroundMeWeb/Content/Twitter.png b/samples/AroundMe/AroundMe/Content/Twitter.png similarity index 100% rename from samples/AroundMe/AroundMeWeb/Content/Twitter.png rename to samples/AroundMe/AroundMe/Content/Twitter.png diff --git a/samples/AroundMe/AroundMe/Page.cs b/samples/AroundMe/AroundMe/Page.cs index fb41ab9e9..47192e0f3 100644 --- a/samples/AroundMe/AroundMe/Page.cs +++ b/samples/AroundMe/AroundMe/Page.cs @@ -35,6 +35,10 @@ internal static class Page { private static string _oldMode; static Page() { + if (Document.Body.GetAttribute("data-app") == null) { + return; + } + string flickrKey = (string)Document.Body.GetAttribute("data-flickr-key"); Debug.Assert(String.IsNullOrEmpty(flickrKey) == false); @@ -235,7 +239,7 @@ private static void ShowLocation() { if (_currentPushpin == null) { MapPushpinOptions pushpinOptions = new MapPushpinOptions(); - pushpinOptions.Icon = "/Content/Pushpin.png"; + pushpinOptions.Icon = "Pushpin.png"; pushpinOptions.Anchor = new MapPoint(12, 14); pushpinOptions.Width = 25; pushpinOptions.Height = 28; @@ -344,14 +348,14 @@ private static void UpdatePhotos(bool newPhotos) { calloutOptions.Height = 50; calloutOptions.ShowPointer = false; calloutOptions.ShowCloseButton = false; - calloutOptions.Offset = new MapPoint(-25, 25); + calloutOptions.Offset = new MapPoint(-25, -25); calloutOptions.HtmlContent = "
"; calloutOptions.Visible = true; MapPushpinOptions pushpinOptions = new MapPushpinOptions(); - pushpinOptions.Icon = "/Content/Dot.png"; + pushpinOptions.Icon = "Dot.png"; pushpinOptions.Width = 10; pushpinOptions.Height = 10; pushpinOptions.Anchor = new MapPoint(5, 5); diff --git a/samples/AroundMe/AroundMe/Properties/AroundMe.ruleset b/samples/AroundMe/AroundMe/Properties/AroundMe.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/AroundMe/AroundMe/Properties/AroundMe.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs b/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs index b023448af..0840f80f9 100644 --- a/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs +++ b/samples/AroundMe/AroundMe/Properties/AssemblyInfo.cs @@ -9,15 +9,15 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AroundMe")] -[assembly: AssemblyDescription("Script# Around Me Sample")] +[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("Script#")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ScriptAssembly("aroundMe")] +[assembly: ScriptAssembly("AroundMe")] [assembly: ScriptNamespace("app")] - diff --git a/samples/AroundMe/AroundMe/Properties/FxCop.ruleset b/samples/AroundMe/AroundMe/Properties/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/samples/AroundMe/AroundMe/Properties/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMe/Properties/AroundMe.script b/samples/AroundMe/AroundMe/Properties/Script.template similarity index 100% rename from samples/AroundMe/AroundMe/Properties/AroundMe.script rename to samples/AroundMe/AroundMe/Properties/Script.template diff --git a/samples/AroundMe/AroundMe/packages.config b/samples/AroundMe/AroundMe/packages.config new file mode 100644 index 000000000..a7a59cc42 --- /dev/null +++ b/samples/AroundMe/AroundMe/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMeTests.testsettings b/samples/AroundMe/AroundMeTests.testsettings new file mode 100644 index 000000000..d78647c9b --- /dev/null +++ b/samples/AroundMe/AroundMeTests.testsettings @@ -0,0 +1,25 @@ + + + These are default test settings for a local test run. + + + + + + + + + + +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMeTests/AroundMeTests.csproj b/samples/AroundMe/AroundMeTests/AroundMeTests.csproj index 89508739a..ea073b83b 100644 --- a/samples/AroundMe/AroundMeTests/AroundMeTests.csproj +++ b/samples/AroundMe/AroundMeTests/AroundMeTests.csproj @@ -5,7 +5,7 @@ AnyCPU 9.0.0 2.0 - {1A55F098-B1B4-41BC-93F7-EE89A85B0AF6} + {E01AE039-4B10-4A3B-AB86-EBFC1E2F6B17} Library Properties AroundMeTests @@ -13,6 +13,7 @@ v4.0 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + true true @@ -32,20 +33,25 @@ 4 + + ..\packages\ScriptSharp.Testing.0.7.5.0\lib\ScriptSharp.Testing.dll + - - + + + + - -

AroundMeTests - UnitTest1 Results

-

-

-
    -
    - - - - - diff --git a/samples/AroundMe/AroundMeTests/Web/QUnitExt.js b/samples/AroundMe/AroundMeTests/Web/QUnitExt.js index da2a82429..2e268d688 100644 --- a/samples/AroundMe/AroundMeTests/Web/QUnitExt.js +++ b/samples/AroundMe/AroundMeTests/Web/QUnitExt.js @@ -21,9 +21,16 @@ QUnit.done = function(failures, total) { appendLog('\r\nCompleted; ' + 'failures = ' + failures + '; total = ' + total); - var logUrl = '/Log.axd/' + ((failures === 0) ? 'Success' : 'Failure'); + var logUrl = '/log/' + ((failures === 0) ? 'success' : 'failure'); var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + window.open('', '_self', ''); + window.close(); + } + }; xhr.open('POST', logUrl, /* async */ false); + xhr.setRequestHeader('Content-Type', 'text/plain'); xhr.send(logData); } @@ -33,6 +40,7 @@ QUnit.testDone = function(name, failures, total) { appendLog(' Test Done: ' + name + '; failures = ' + failures + '; total = ' + total); + appendLog(''); } QUnit.moduleStart = function(name, testEnv) { @@ -43,6 +51,8 @@ QUnit.moduleDone = function(name, failures, total) { if (name === currentModule) { appendLog('Module Done: ' + name + '; failures = ' + failures + '; total = ' + total + '\r\n'); + appendLog(''); + appendLog(''); } currentModule = null; } diff --git a/samples/AroundMe/AroundMeTests/packages.config b/samples/AroundMe/AroundMeTests/packages.config new file mode 100644 index 000000000..753b9e2a5 --- /dev/null +++ b/samples/AroundMe/AroundMeTests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj b/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj deleted file mode 100644 index 9ede797bf..000000000 --- a/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {B190181B-16F9-40A8-B431-2D80DE63D081} - {F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - AroundMeWeb - AroundMeWeb - v4.0 - false - false - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - - - 3.5 - - - - 3.5 - - - - 3.5 - - - - - - - - - - Global.asax - - - ASPXCodeBehind - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - False - 30530 - / - - - False - False - - - False - - - - - \ No newline at end of file diff --git a/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.debug.js b/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.debug.js deleted file mode 100644 index abd679912..000000000 --- a/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.debug.js +++ /dev/null @@ -1,1825 +0,0 @@ -//! Script# Core Runtime -//! More information at http://projects.nikhilk.net/ScriptSharp -//! - -/////////////////////////////////////////////////////////////////////////////// -// Globals - -(function () { - var globals = { - version: '0.7.4.0', - - isUndefined: function (o) { - return (o === undefined); - }, - - isNull: function (o) { - return (o === null); - }, - - isNullOrUndefined: function (o) { - return (o === null) || (o === undefined); - }, - - isValue: function (o) { - return (o !== null) && (o !== undefined); - } - }; - - var started = false; - var startCallbacks = []; - - function onStartup(cb) { - startCallbacks ? startCallbacks.push(cb) : setTimeout(cb, 0); - } - function startup() { - if (startCallbacks) { - var callbacks = startCallbacks; - startCallbacks = null; - for (var i = 0, l = callbacks.length; i < l; i++) { - callbacks[i](); - } - } - } - if (document.addEventListener) { - document.readyState == 'complete' ? startup() : document.addEventListener('DOMContentLoaded', startup, false); - } - else if (window.attachEvent) { - window.attachEvent('onload', function () { - startup(); - }); - } - - var ss = window.ss; - if (!ss) { - window.ss = ss = { - init: onStartup, - ready: onStartup - }; - } - for (var n in globals) { - ss[n] = globals[n]; - } -})(); - -/////////////////////////////////////////////////////////////////////////////// -// Object Extensions - -Object.__typeName = 'Object'; -Object.__baseType = null; - -Object.clearKeys = function Object$clearKeys(d) { - for (var n in d) { - delete d[n]; - } -} - -Object.keyExists = function Object$keyExists(d, key) { - return d[key] !== undefined; -} - -if (!Object.keys) { - Object.keys = function Object$keys(d) { - var keys = []; - for (var n in d) { - keys.push(n); - } - return keys; - } - - Object.getKeyCount = function Object$getKeyCount(d) { - var count = 0; - for (var n in d) { - count++; - } - return count; - } -} -else { - Object.getKeyCount = function Object$getKeyCount(d) { - return Object.keys(d).length; - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Boolean Extensions - -Boolean.__typeName = 'Boolean'; - -Boolean.parse = function Boolean$parse(s) { - return (s.toLowerCase() == 'true'); -} - -/////////////////////////////////////////////////////////////////////////////// -// Number Extensions - -Number.__typeName = 'Number'; - -Number.parse = function Number$parse(s) { - if (!s || !s.length) { - return 0; - } - if ((s.indexOf('.') >= 0) || (s.indexOf('e') >= 0) || - s.endsWith('f') || s.endsWith('F')) { - return parseFloat(s); - } - return parseInt(s, 10); -} - -Number.prototype.format = function Number$format(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toString(); - } - return this._netFormat(format, false); -} - -Number.prototype.localeFormat = function Number$format(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toLocaleString(); - } - return this._netFormat(format, true); -} - -Number._commaFormat = function Number$_commaFormat(number, groups, decimal, comma) { - var decimalPart = null; - var decimalIndex = number.indexOf(decimal); - if (decimalIndex > 0) { - decimalPart = number.substr(decimalIndex); - number = number.substr(0, decimalIndex); - } - - var negative = number.startsWith('-'); - if (negative) { - number = number.substr(1); - } - - var groupIndex = 0; - var groupSize = groups[groupIndex]; - if (number.length < groupSize) { - return decimalPart ? number + decimalPart : number; - } - - var index = number.length; - var s = ''; - var done = false; - while (!done) { - var length = groupSize; - var startIndex = index - length; - if (startIndex < 0) { - groupSize += startIndex; - length += startIndex; - startIndex = 0; - done = true; - } - if (!length) { - break; - } - - var part = number.substr(startIndex, length); - if (s.length) { - s = part + comma + s; - } - else { - s = part; - } - index -= length; - - if (groupIndex < groups.length - 1) { - groupIndex++; - groupSize = groups[groupIndex]; - } - } - - if (negative) { - s = '-' + s; - } - return decimalPart ? s + decimalPart : s; -} - -Number.prototype._netFormat = function Number$_netFormat(format, useLocale) { - var nf = useLocale ? ss.CultureInfo.CurrentCulture.numberFormat : ss.CultureInfo.InvariantCulture.numberFormat; - - var s = ''; - var precision = -1; - - if (format.length > 1) { - precision = parseInt(format.substr(1)); - } - - var fs = format.charAt(0); - switch (fs) { - case 'd': case 'D': - s = parseInt(Math.abs(this)).toString(); - if (precision != -1) { - s = s.padLeft(precision, '0'); - } - if (this < 0) { - s = '-' + s; - } - break; - case 'x': case 'X': - s = parseInt(Math.abs(this)).toString(16); - if (fs == 'X') { - s = s.toUpperCase(); - } - if (precision != -1) { - s = s.padLeft(precision, '0'); - } - break; - case 'e': case 'E': - if (precision == -1) { - s = this.toExponential(); - } - else { - s = this.toExponential(precision); - } - if (fs == 'E') { - s = s.toUpperCase(); - } - break; - case 'f': case 'F': - case 'n': case 'N': - if (precision == -1) { - precision = nf.numberDecimalDigits; - } - s = this.toFixed(precision).toString(); - if (precision && (nf.numberDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.numberDecimalSeparator + s.substr(index + 1); - } - if ((fs == 'n') || (fs == 'N')) { - s = Number._commaFormat(s, nf.numberGroupSizes, nf.numberDecimalSeparator, nf.numberGroupSeparator); - } - break; - case 'c': case 'C': - if (precision == -1) { - precision = nf.currencyDecimalDigits; - } - s = Math.abs(this).toFixed(precision).toString(); - if (precision && (nf.currencyDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.currencyDecimalSeparator + s.substr(index + 1); - } - s = Number._commaFormat(s, nf.currencyGroupSizes, nf.currencyDecimalSeparator, nf.currencyGroupSeparator); - if (this < 0) { - s = String.format(nf.currencyNegativePattern, s); - } - else { - s = String.format(nf.currencyPositivePattern, s); - } - break; - case 'p': case 'P': - if (precision == -1) { - precision = nf.percentDecimalDigits; - } - s = (Math.abs(this) * 100.0).toFixed(precision).toString(); - if (precision && (nf.percentDecimalSeparator != '.')) { - var index = s.indexOf('.'); - s = s.substr(0, index) + nf.percentDecimalSeparator + s.substr(index + 1); - } - s = Number._commaFormat(s, nf.percentGroupSizes, nf.percentDecimalSeparator, nf.percentGroupSeparator); - if (this < 0) { - s = String.format(nf.percentNegativePattern, s); - } - else { - s = String.format(nf.percentPositivePattern, s); - } - break; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -// String Extensions - -String.__typeName = 'String'; -String.Empty = ''; - -String.compare = function String$compare(s1, s2, ignoreCase) { - if (ignoreCase) { - if (s1) { - s1 = s1.toUpperCase(); - } - if (s2) { - s2 = s2.toUpperCase(); - } - } - s1 = s1 || ''; - s2 = s2 || ''; - - if (s1 == s2) { - return 0; - } - if (s1 < s2) { - return -1; - } - return 1; -} - -String.prototype.compareTo = function String$compareTo(s, ignoreCase) { - return String.compare(this, s, ignoreCase); -} - -String.concat = function String$concat() { - if (arguments.length === 2) { - return arguments[0] + arguments[1]; - } - return Array.prototype.join.call(arguments, ''); -} - -String.prototype.endsWith = function String$endsWith(suffix) { - if (!suffix.length) { - return true; - } - if (suffix.length > this.length) { - return false; - } - return (this.substr(this.length - suffix.length) == suffix); -} - -String.equals = function String$equals1(s1, s2, ignoreCase) { - return String.compare(s1, s2, ignoreCase) == 0; -} - -String._format = function String$_format(format, values, useLocale) { - if (!String._formatRE) { - String._formatRE = /(\{[^\}^\{]+\})/g; - } - - return format.replace(String._formatRE, - function(str, m) { - var index = parseInt(m.substr(1)); - var value = values[index + 1]; - if (ss.isNullOrUndefined(value)) { - return ''; - } - if (value.format) { - var formatSpec = null; - var formatIndex = m.indexOf(':'); - if (formatIndex > 0) { - formatSpec = m.substring(formatIndex + 1, m.length - 1); - } - return useLocale ? value.localeFormat(formatSpec) : value.format(formatSpec); - } - else { - return useLocale ? value.toLocaleString() : value.toString(); - } - }); -} - -String.format = function String$format(format) { - return String._format(format, arguments, /* useLocale */ false); -} - -String.fromChar = function String$fromChar(ch, count) { - var s = ch; - for (var i = 1; i < count; i++) { - s += ch; - } - return s; -} - -String.prototype.htmlDecode = function String$htmlDecode() { - var div = document.createElement('div'); - div.innerHTML = this; - return div.textContent || div.innerText; -} - -String.prototype.htmlEncode = function String$htmlEncode() { - var div = document.createElement('div'); - div.appendChild(document.createTextNode(this)); - return div.innerHTML.replace(/\"/g, '"'); -} - -String.prototype.indexOfAny = function String$indexOfAny(chars, startIndex, count) { - var length = this.length; - if (!length) { - return -1; - } - - startIndex = startIndex || 0; - count = count || length; - - var endIndex = startIndex + count - 1; - if (endIndex >= length) { - endIndex = length - 1; - } - - for (var i = startIndex; i <= endIndex; i++) { - if (chars.indexOf(this.charAt(i)) >= 0) { - return i; - } - } - return -1; -} - -String.prototype.insert = function String$insert(index, value) { - if (!value) { - return this; - } - if (!index) { - return value + this; - } - var s1 = this.substr(0, index); - var s2 = this.substr(index); - return s1 + value + s2; -} - -String.isNullOrEmpty = function String$isNullOrEmpty(s) { - return !s || !s.length; -} - -String.prototype.lastIndexOfAny = function String$lastIndexOfAny(chars, startIndex, count) { - var length = this.length; - if (!length) { - return -1; - } - - startIndex = startIndex || length - 1; - count = count || length; - - var endIndex = startIndex - count + 1; - if (endIndex < 0) { - endIndex = 0; - } - - for (var i = startIndex; i >= endIndex; i--) { - if (chars.indexOf(this.charAt(i)) >= 0) { - return i; - } - } - return -1; -} - -String.localeFormat = function String$localeFormat(format) { - return String._format(format, arguments, /* useLocale */ true); -} - -String.prototype.padLeft = function String$padLeft(totalWidth, ch) { - if (this.length < totalWidth) { - ch = ch || ' '; - return String.fromChar(ch, totalWidth - this.length) + this; - } - return this; -} - -String.prototype.padRight = function String$padRight(totalWidth, ch) { - if (this.length < totalWidth) { - ch = ch || ' '; - return this + String.fromChar(ch, totalWidth - this.length); - } - return this; -} - -String.prototype.remove = function String$remove(index, count) { - if (!count || ((index + count) > this.length)) { - return this.substr(0, index); - } - return this.substr(0, index) + this.substr(index + count); -} - -String.prototype.replaceAll = function String$replaceAll(oldValue, newValue) { - newValue = newValue || ''; - return this.split(oldValue).join(newValue); -} - -String.prototype.startsWith = function String$startsWith(prefix) { - if (!prefix.length) { - return true; - } - if (prefix.length > this.length) { - return false; - } - return (this.substr(0, prefix.length) == prefix); -} - -if (!String.prototype.trim) { - String.prototype.trim = function String$trim() { - return this.trimEnd().trimStart(); - } -} - -String.prototype.trimEnd = function String$trimEnd() { - return this.replace(/\s*$/, ''); -} - -String.prototype.trimStart = function String$trimStart() { - return this.replace(/^\s*/, ''); -} - -/////////////////////////////////////////////////////////////////////////////// -// Array Extensions - -Array.__typeName = 'Array'; -Array.__interfaces = [ ss.IEnumerable ]; - -Array.prototype.add = function Array$add(item) { - this[this.length] = item; -} - -Array.prototype.addRange = function Array$addRange(items) { - this.push.apply(this, items); -} - -Array.prototype.aggregate = function Array$aggregate(seed, callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this) { - seed = callback.call(instance, seed, this[i], i, this); - } - } - return seed; -} - -Array.prototype.clear = function Array$clear() { - this.length = 0; -} - -Array.prototype.clone = function Array$clone() { - if (this.length === 1) { - return [this[0]]; - } - else { - return Array.apply(null, this); - } -} - -Array.prototype.contains = function Array$contains(item) { - var index = this.indexOf(item); - return (index >= 0); -} - -Array.prototype.dequeue = function Array$dequeue() { - return this.shift(); -} - -Array.prototype.enqueue = function Array$enqueue(item) { - // We record that this array instance is a queue, so we - // can implement the right behavior in the peek method. - this._queue = true; - this.push(item); -} - -Array.prototype.peek = function Array$peek() { - if (this.length) { - var index = this._queue ? 0 : this.length - 1; - return this[index]; - } - return null; -} - -if (!Array.prototype.every) { - Array.prototype.every = function Array$every(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this && !callback.call(instance, this[i], i, this)) { - return false; - } - } - return true; - } -} - -Array.prototype.extract = function Array$extract(index, count) { - if (!count) { - return this.slice(index); - } - return this.slice(index, index + count); -} - -if (!Array.prototype.filter) { - Array.prototype.filter = function Array$filter(callback, instance) { - var length = this.length; - var filtered = []; - for (var i = 0; i < length; i++) { - if (i in this) { - var val = this[i]; - if (callback.call(instance, val, i, this)) { - filtered.push(val); - } - } - } - return filtered; - } -} - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function Array$forEach(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this) { - callback.call(instance, this[i], i, this); - } - } - } -} - -Array.prototype.getEnumerator = function Array$getEnumerator() { - return new ss.ArrayEnumerator(this); -} - -Array.prototype.groupBy = function Array$groupBy(callback, instance) { - var length = this.length; - var groups = []; - var keys = {}; - for (var i = 0; i < length; i++) { - if (i in this) { - var key = callback.call(instance, this[i], i); - if (String.isNullOrEmpty(key)) { - continue; - } - var items = keys[key]; - if (!items) { - items = []; - items.key = key; - - keys[key] = items; - groups.add(items); - } - items.add(this[i]); - } - } - return groups; -} - -Array.prototype.index = function Array$index(callback, instance) { - var length = this.length; - var items = {}; - for (var i = 0; i < length; i++) { - if (i in this) { - var key = callback.call(instance, this[i], i); - if (String.isNullOrEmpty(key)) { - continue; - } - items[key] = this[i]; - } - } - return items; -} - -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function Array$indexOf(item, startIndex) { - startIndex = startIndex || 0; - var length = this.length; - if (length) { - for (var index = startIndex; index < length; index++) { - if (this[index] === item) { - return index; - } - } - } - return -1; - } -} - -Array.prototype.insert = function Array$insert(index, item) { - this.splice(index, 0, item); -} - -Array.prototype.insertRange = function Array$insertRange(index, items) { - if (index === 0) { - this.unshift.apply(this, items); - } - else { - for (var i = 0; i < items.length; i++) { - this.splice(index + i, 0, items[i]); - } - } -} - -if (!Array.prototype.map) { - Array.prototype.map = function Array$map(callback, instance) { - var length = this.length; - var mapped = new Array(length); - for (var i = 0; i < length; i++) { - if (i in this) { - mapped[i] = callback.call(instance, this[i], i, this); - } - } - return mapped; - } -} - -Array.parse = function Array$parse(s) { - return eval('(' + s + ')'); -} - -Array.prototype.remove = function Array$remove(item) { - var index = this.indexOf(item); - if (index >= 0) { - this.splice(index, 1); - return true; - } - return false; -} - -Array.prototype.removeAt = function Array$removeAt(index) { - this.splice(index, 1); -} - -Array.prototype.removeRange = function Array$removeRange(index, count) { - return this.splice(index, count); -} - -if (!Array.prototype.some) { - Array.prototype.some = function Array$some(callback, instance) { - var length = this.length; - for (var i = 0; i < length; i++) { - if (i in this && callback.call(instance, this[i], i, this)) { - return true; - } - } - return false; - } -} - -Array.toArray = function Array$toArray(obj) { - return Array.prototype.slice.call(obj); -} - -/////////////////////////////////////////////////////////////////////////////// -// RegExp Extensions - -RegExp.__typeName = 'RegExp'; - -RegExp.parse = function RegExp$parse(s) { - if (s.startsWith('/')) { - var endSlashIndex = s.lastIndexOf('/'); - if (endSlashIndex > 1) { - var expression = s.substring(1, endSlashIndex); - var flags = s.substr(endSlashIndex + 1); - return new RegExp(expression, flags); - } - } - - return null; -} - -/////////////////////////////////////////////////////////////////////////////// -// Date Extensions - -Date.__typeName = 'Date'; - -Date.empty = null; - -Date.get_now = function Date$get_now() { - return new Date(); -} - -Date.get_today = function Date$get_today() { - var d = new Date(); - return new Date(d.getFullYear(), d.getMonth(), d.getDate()); -} - -Date.isEmpty = function Date$isEmpty(d) { - return (d === null) || (d.valueOf() === 0); -} - -Date.prototype.format = function Date$format(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toString(); - } - if (format == 'id') { - return this.toDateString(); - } - if (format == 'it') { - return this.toTimeString(); - } - - return this._netFormat(format, false); -} - -Date.prototype.localeFormat = function Date$localeFormat(format) { - if (ss.isNullOrUndefined(format) || (format.length == 0) || (format == 'i')) { - return this.toLocaleString(); - } - if (format == 'id') { - return this.toLocaleDateString(); - } - if (format == 'it') { - return this.toLocaleTimeString(); - } - - return this._netFormat(format, true); -} - -Date.prototype._netFormat = function Date$_netFormat(format, useLocale) { - var dt = this; - var dtf = useLocale ? ss.CultureInfo.CurrentCulture.dateFormat : ss.CultureInfo.InvariantCulture.dateFormat; - - if (format.length == 1) { - switch (format) { - case 'f': format = dtf.longDatePattern + ' ' + dtf.shortTimePattern; break; - case 'F': format = dtf.dateTimePattern; break; - - case 'd': format = dtf.shortDatePattern; break; - case 'D': format = dtf.longDatePattern; break; - - case 't': format = dtf.shortTimePattern; break; - case 'T': format = dtf.longTimePattern; break; - - case 'g': format = dtf.shortDatePattern + ' ' + dtf.shortTimePattern; break; - case 'G': format = dtf.shortDatePattern + ' ' + dtf.longTimePattern; break; - - case 'R': case 'r': - dtf = ss.CultureInfo.InvariantCulture.dateFormat; - format = dtf.gmtDateTimePattern; - break; - case 'u': format = dtf.universalDateTimePattern; break; - case 'U': - format = dtf.dateTimePattern; - dt = new Date(dt.getUTCFullYear(), dt.getUTCMonth(), dt.getUTCDate(), - dt.getUTCHours(), dt.getUTCMinutes(), dt.getUTCSeconds(), dt.getUTCMilliseconds()); - break; - - case 's': format = dtf.sortableDateTimePattern; break; - } - } - - if (format.charAt(0) == '%') { - format = format.substr(1); - } - - if (!Date._formatRE) { - Date._formatRE = /'.*?[^\\]'|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g; - } - - var re = Date._formatRE; - var sb = new ss.StringBuilder(); - - re.lastIndex = 0; - while (true) { - var index = re.lastIndex; - var match = re.exec(format); - - sb.append(format.slice(index, match ? match.index : format.length)); - if (!match) { - break; - } - - var fs = match[0]; - var part = fs; - switch (fs) { - case 'dddd': - part = dtf.dayNames[dt.getDay()]; - break; - case 'ddd': - part = dtf.shortDayNames[dt.getDay()]; - break; - case 'dd': - part = dt.getDate().toString().padLeft(2, '0'); - break; - case 'd': - part = dt.getDate(); - break; - case 'MMMM': - part = dtf.monthNames[dt.getMonth()]; - break; - case 'MMM': - part = dtf.shortMonthNames[dt.getMonth()]; - break; - case 'MM': - part = (dt.getMonth() + 1).toString().padLeft(2, '0'); - break; - case 'M': - part = (dt.getMonth() + 1); - break; - case 'yyyy': - part = dt.getFullYear(); - break; - case 'yy': - part = (dt.getFullYear() % 100).toString().padLeft(2, '0'); - break; - case 'y': - part = (dt.getFullYear() % 100); - break; - case 'h': case 'hh': - part = dt.getHours() % 12; - if (!part) { - part = '12'; - } - else if (fs == 'hh') { - part = part.toString().padLeft(2, '0'); - } - break; - case 'HH': - part = dt.getHours().toString().padLeft(2, '0'); - break; - case 'H': - part = dt.getHours(); - break; - case 'mm': - part = dt.getMinutes().toString().padLeft(2, '0'); - break; - case 'm': - part = dt.getMinutes(); - break; - case 'ss': - part = dt.getSeconds().toString().padLeft(2, '0'); - break; - case 's': - part = dt.getSeconds(); - break; - case 't': case 'tt': - part = (dt.getHours() < 12) ? dtf.amDesignator : dtf.pmDesignator; - if (fs == 't') { - part = part.charAt(0); - } - break; - case 'fff': - part = dt.getMilliseconds().toString().padLeft(3, '0'); - break; - case 'ff': - part = dt.getMilliseconds().toString().padLeft(3).substr(0, 2); - break; - case 'f': - part = dt.getMilliseconds().toString().padLeft(3).charAt(0); - break; - case 'z': - part = dt.getTimezoneOffset() / 60; - part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)); - break; - case 'zz': case 'zzz': - part = dt.getTimezoneOffset() / 60; - part = ((part >= 0) ? '-' : '+') + Math.floor(Math.abs(part)).toString().padLeft(2, '0'); - if (fs == 'zzz') { - part += dtf.timeSeparator + Math.abs(dt.getTimezoneOffset() % 60).toString().padLeft(2, '0'); - } - break; - default: - if (part.charAt(0) == '\'') { - part = part.substr(1, part.length - 2).replace(/\\'/g, '\''); - } - break; - } - sb.append(part); - } - - return sb.toString(); -} - -Date.parseDate = function Date$parse(s) { - // Date.parse returns the number of milliseconds - // so we use that to create an actual Date instance - return new Date(Date.parse(s)); -} - -/////////////////////////////////////////////////////////////////////////////// -// Error Extensions - -Error.__typeName = 'Error'; - -Error.prototype.popStackFrame = function Error$popStackFrame() { - if (ss.isNullOrUndefined(this.stack) || - ss.isNullOrUndefined(this.fileName) || - ss.isNullOrUndefined(this.lineNumber)) { - return; - } - - var stackFrames = this.stack.split('\n'); - var currentFrame = stackFrames[0]; - var pattern = this.fileName + ':' + this.lineNumber; - while (!ss.isNullOrUndefined(currentFrame) && - currentFrame.indexOf(pattern) === -1) { - stackFrames.shift(); - currentFrame = stackFrames[0]; - } - - var nextFrame = stackFrames[1]; - if (isNullOrUndefined(nextFrame)) { - return; - } - - var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/); - if (ss.isNullOrUndefined(nextFrameParts)) { - return; - } - - stackFrames.shift(); - this.stack = stackFrames.join("\n"); - this.fileName = nextFrameParts[1]; - this.lineNumber = parseInt(nextFrameParts[2]); -} - -Error.createError = function Error$createError(message, errorInfo, innerException) { - var e = new Error(message); - if (errorInfo) { - for (var v in errorInfo) { - e[v] = errorInfo[v]; - } - } - if (innerException) { - e.innerException = innerException; - } - - e.popStackFrame(); - return e; -} - -/////////////////////////////////////////////////////////////////////////////// -// Debug Extensions - -ss.Debug = window.Debug || function() {}; -ss.Debug.__typeName = 'Debug'; - -if (!ss.Debug.writeln) { - ss.Debug.writeln = function Debug$writeln(text) { - if (window.console) { - if (window.console.debug) { - window.console.debug(text); - return; - } - else if (window.console.log) { - window.console.log(text); - return; - } - } - else if (window.opera && - window.opera.postError) { - window.opera.postError(text); - return; - } - } -} - -ss.Debug._fail = function Debug$_fail(message) { - ss.Debug.writeln(message); - eval('debugger;'); -} - -ss.Debug.assert = function Debug$assert(condition, message) { - if (!condition) { - message = 'Assert failed: ' + message; - if (confirm(message + '\r\n\r\nBreak into debugger?')) { - ss.Debug._fail(message); - } - } -} - -ss.Debug.fail = function Debug$fail(message) { - ss.Debug._fail(message); -} - -/////////////////////////////////////////////////////////////////////////////// -// Type System Implementation - -window.Type = Function; -Type.__typeName = 'Type'; - -window.__Namespace = function(name) { - this.__typeName = name; -} -__Namespace.prototype = { - __namespace: true, - getName: function() { - return this.__typeName; - } -} - -Type.registerNamespace = function Type$registerNamespace(name) { - if (!window.__namespaces) { - window.__namespaces = {}; - } - if (!window.__rootNamespaces) { - window.__rootNamespaces = []; - } - - if (window.__namespaces[name]) { - return; - } - - var ns = window; - var nameParts = name.split('.'); - - for (var i = 0; i < nameParts.length; i++) { - var part = nameParts[i]; - var nso = ns[part]; - if (!nso) { - ns[part] = nso = new __Namespace(nameParts.slice(0, i + 1).join('.')); - if (i == 0) { - window.__rootNamespaces.add(nso); - } - } - ns = nso; - } - - window.__namespaces[name] = ns; -} - -Type.prototype.registerClass = function Type$registerClass(name, baseType, interfaceType) { - this.prototype.constructor = this; - this.__typeName = name; - this.__class = true; - this.__baseType = baseType || Object; - if (baseType) { - this.__basePrototypePending = true; - } - - if (interfaceType) { - this.__interfaces = []; - for (var i = 2; i < arguments.length; i++) { - interfaceType = arguments[i]; - this.__interfaces.add(interfaceType); - } - } -} - -Type.prototype.registerInterface = function Type$createInterface(name) { - this.__typeName = name; - this.__interface = true; -} - -Type.prototype.registerEnum = function Type$createEnum(name, flags) { - for (var field in this.prototype) { - this[field] = this.prototype[field]; - } - - this.__typeName = name; - this.__enum = true; - if (flags) { - this.__flags = true; - } -} - -Type.prototype.setupBase = function Type$setupBase() { - if (this.__basePrototypePending) { - var baseType = this.__baseType; - if (baseType.__basePrototypePending) { - baseType.setupBase(); - } - - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!this.prototype[memberName]) { - this.prototype[memberName] = memberValue; - } - } - - delete this.__basePrototypePending; - } -} - -if (!Type.prototype.resolveInheritance) { - // This function is not used by Script#; Visual Studio relies on it - // for JavaScript IntelliSense support of derived types. - Type.prototype.resolveInheritance = Type.prototype.setupBase; -} - -Type.prototype.initializeBase = function Type$initializeBase(instance, args) { - if (this.__basePrototypePending) { - this.setupBase(); - } - - if (!args) { - this.__baseType.apply(instance); - } - else { - this.__baseType.apply(instance, args); - } -} - -Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, args) { - var baseMethod = this.__baseType.prototype[name]; - if (!args) { - return baseMethod.apply(instance); - } - else { - return baseMethod.apply(instance, args); - } -} - -Type.prototype.get_baseType = function Type$get_baseType() { - return this.__baseType || null; -} - -Type.prototype.get_fullName = function Type$get_fullName() { - return this.__typeName; -} - -Type.prototype.get_name = function Type$get_name() { - var fullName = this.__typeName; - var nsIndex = fullName.lastIndexOf('.'); - if (nsIndex > 0) { - return fullName.substr(nsIndex + 1); - } - return fullName; -} - -Type.prototype.getInterfaces = function Type$getInterfaces() { - return this.__interfaces; -} - -Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) { - if (ss.isNullOrUndefined(instance)) { - return false; - } - if ((this == Object) || (instance instanceof this)) { - return true; - } - - var type = Type.getInstanceType(instance); - return this.isAssignableFrom(type); -} - -Type.prototype.isAssignableFrom = function Type$isAssignableFrom(type) { - if ((this == Object) || (this == type)) { - return true; - } - if (this.__class) { - var baseType = type.__baseType; - while (baseType) { - if (this == baseType) { - return true; - } - baseType = baseType.__baseType; - } - } - else if (this.__interface) { - var interfaces = type.__interfaces; - if (interfaces && interfaces.contains(this)) { - return true; - } - - var baseType = type.__baseType; - while (baseType) { - interfaces = baseType.__interfaces; - if (interfaces && interfaces.contains(this)) { - return true; - } - baseType = baseType.__baseType; - } - } - return false; -} - -Type.isClass = function Type$isClass(type) { - return (type.__class == true); -} - -Type.isEnum = function Type$isEnum(type) { - return (type.__enum == true); -} - -Type.isFlags = function Type$isFlags(type) { - return ((type.__enum == true) && (type.__flags == true)); -} - -Type.isInterface = function Type$isInterface(type) { - return (type.__interface == true); -} - -Type.isNamespace = function Type$isNamespace(object) { - return (object.__namespace == true); -} - -Type.canCast = function Type$canCast(instance, type) { - return type.isInstanceOfType(instance); -} - -Type.safeCast = function Type$safeCast(instance, type) { - if (type.isInstanceOfType(instance)) { - return instance; - } - return null; -} - -Type.getInstanceType = function Type$getInstanceType(instance) { - var ctor = null; - - // NOTE: We have to catch exceptions because the constructor - // cannot be looked up on native COM objects - try { - ctor = instance.constructor; - } - catch (ex) { - } - if (!ctor || !ctor.__typeName) { - ctor = Object; - } - return ctor; -} - -Type.getType = function Type$getType(typeName) { - if (!typeName) { - return null; - } - - if (!Type.__typeCache) { - Type.__typeCache = {}; - } - - var type = Type.__typeCache[typeName]; - if (!type) { - type = eval(typeName); - Type.__typeCache[typeName] = type; - } - return type; -} - -Type.parse = function Type$parse(typeName) { - return Type.getType(typeName); -} - -/////////////////////////////////////////////////////////////////////////////// -// Delegate - -ss.Delegate = function Delegate$() { -} -ss.Delegate.registerClass('Delegate'); - -ss.Delegate.empty = function() { } - -ss.Delegate._contains = function Delegate$_contains(targets, object, method) { - for (var i = 0; i < targets.length; i += 2) { - if (targets[i] === object && targets[i + 1] === method) { - return true; - } - } - return false; -} - -ss.Delegate._create = function Delegate$_create(targets) { - var delegate = function() { - if (targets.length == 2) { - return targets[1].apply(targets[0], arguments); - } - else { - var clone = targets.clone(); - for (var i = 0; i < clone.length; i += 2) { - if (ss.Delegate._contains(targets, clone[i], clone[i + 1])) { - clone[i + 1].apply(clone[i], arguments); - } - } - return null; - } - }; - delegate._targets = targets; - - return delegate; -} - -ss.Delegate.create = function Delegate$create(object, method) { - if (!object) { - return method; - } - return ss.Delegate._create([object, method]); -} - -ss.Delegate.combine = function Delegate$combine(delegate1, delegate2) { - if (!delegate1) { - if (!delegate2._targets) { - return ss.Delegate.create(null, delegate2); - } - return delegate2; - } - if (!delegate2) { - if (!delegate1._targets) { - return ss.Delegate.create(null, delegate1); - } - return delegate1; - } - - var targets1 = delegate1._targets ? delegate1._targets : [null, delegate1]; - var targets2 = delegate2._targets ? delegate2._targets : [null, delegate2]; - - return ss.Delegate._create(targets1.concat(targets2)); -} - -ss.Delegate.remove = function Delegate$remove(delegate1, delegate2) { - if (!delegate1 || (delegate1 === delegate2)) { - return null; - } - if (!delegate2) { - return delegate1; - } - - var targets = delegate1._targets; - var object = null; - var method; - if (delegate2._targets) { - object = delegate2._targets[0]; - method = delegate2._targets[1]; - } - else { - method = delegate2; - } - - for (var i = 0; i < targets.length; i += 2) { - if ((targets[i] === object) && (targets[i + 1] === method)) { - if (targets.length == 2) { - return null; - } - targets.splice(i, 2); - return ss.Delegate._create(targets); - } - } - - return delegate1; -} - -ss.Delegate.createExport = function Delegate$createExport(delegate, multiUse, name) { - // Generate a unique name if one is not specified - name = name || '__' + (new Date()).valueOf(); - - // Exported delegates go on window (so they are callable using a simple identifier). - - // Multi-use delegates are exported directly; for the rest a stub is exported, and the stub - // first deletes, and then invokes the actual delegate. - window[name] = multiUse ? delegate : function() { - try { delete window[name]; } catch(e) { window[name] = undefined; } - delegate.apply(null, arguments); - }; - - return name; -} - -ss.Delegate.deleteExport = function Delegate$deleteExport(name) { - delete window[name]; -} - -ss.Delegate.clearExport = function Delegate$clearExport(name) { - window[name] = ss.Delegate.empty; -} - -/////////////////////////////////////////////////////////////////////////////// -// CultureInfo - -ss.CultureInfo = function CultureInfo$(name, numberFormat, dateFormat) { - this.name = name; - this.numberFormat = numberFormat; - this.dateFormat = dateFormat; -} -ss.CultureInfo.registerClass('CultureInfo'); - -ss.CultureInfo.InvariantCulture = new ss.CultureInfo('en-US', - { - naNSymbol: 'NaN', - negativeSign: '-', - positiveSign: '+', - negativeInfinityText: '-Infinity', - positiveInfinityText: 'Infinity', - - percentSymbol: '%', - percentGroupSizes: [3], - percentDecimalDigits: 2, - percentDecimalSeparator: '.', - percentGroupSeparator: ',', - percentPositivePattern: '{0} %', - percentNegativePattern: '-{0} %', - - currencySymbol:'$', - currencyGroupSizes: [3], - currencyDecimalDigits: 2, - currencyDecimalSeparator: '.', - currencyGroupSeparator: ',', - currencyNegativePattern: '(${0})', - currencyPositivePattern: '${0}', - - numberGroupSizes: [3], - numberDecimalDigits: 2, - numberDecimalSeparator: '.', - numberGroupSeparator: ',' - }, - { - amDesignator: 'AM', - pmDesignator: 'PM', - - dateSeparator: '/', - timeSeparator: ':', - - gmtDateTimePattern: 'ddd, dd MMM yyyy HH:mm:ss \'GMT\'', - universalDateTimePattern: 'yyyy-MM-dd HH:mm:ssZ', - sortableDateTimePattern: 'yyyy-MM-ddTHH:mm:ss', - dateTimePattern: 'dddd, MMMM dd, yyyy h:mm:ss tt', - - longDatePattern: 'dddd, MMMM dd, yyyy', - shortDatePattern: 'M/d/yyyy', - - longTimePattern: 'h:mm:ss tt', - shortTimePattern: 'h:mm tt', - - firstDayOfWeek: 0, - dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], - shortDayNames: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'], - minimizedDayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], - - monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December',''], - shortMonthNames: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec',''] - }); -ss.CultureInfo.CurrentCulture = ss.CultureInfo.InvariantCulture; - -/////////////////////////////////////////////////////////////////////////////// -// IEnumerator - -ss.IEnumerator = function IEnumerator$() { }; -ss.IEnumerator.prototype = { - get_current: null, - moveNext: null, - reset: null -} - -ss.IEnumerator.getEnumerator = function ss_IEnumerator$getEnumerator(enumerable) { - if (enumerable) { - return enumerable.getEnumerator ? enumerable.getEnumerator() : new ss.ArrayEnumerator(enumerable); - } - return null; -} - -ss.IEnumerator.registerInterface('IEnumerator'); - -/////////////////////////////////////////////////////////////////////////////// -// IEnumerable - -ss.IEnumerable = function IEnumerable$() { }; -ss.IEnumerable.prototype = { - getEnumerator: null -} -ss.IEnumerable.registerInterface('IEnumerable'); - -/////////////////////////////////////////////////////////////////////////////// -// ArrayEnumerator - -ss.ArrayEnumerator = function ArrayEnumerator$(array) { - this._array = array; - this._index = -1; - this.current = null; -} -ss.ArrayEnumerator.prototype = { - moveNext: function ArrayEnumerator$moveNext() { - this._index++; - this.current = this._array[this._index]; - return (this._index < this._array.length); - }, - reset: function ArrayEnumerator$reset() { - this._index = -1; - this.current = null; - } -} - -ss.ArrayEnumerator.registerClass('ArrayEnumerator', null, ss.IEnumerator); - -/////////////////////////////////////////////////////////////////////////////// -// IDisposable - -ss.IDisposable = function IDisposable$() { }; -ss.IDisposable.prototype = { - dispose: null -} -ss.IDisposable.registerInterface('IDisposable'); - -/////////////////////////////////////////////////////////////////////////////// -// StringBuilder - -ss.StringBuilder = function StringBuilder$(s) { - this._parts = !ss.isNullOrUndefined(s) ? [s] : []; - this.isEmpty = this._parts.length == 0; -} -ss.StringBuilder.prototype = { - append: function StringBuilder$append(s) { - if (!ss.isNullOrUndefined(s)) { - this._parts.add(s); - this.isEmpty = false; - } - return this; - }, - - appendLine: function StringBuilder$appendLine(s) { - this.append(s); - this.append('\r\n'); - this.isEmpty = false; - return this; - }, - - clear: function StringBuilder$clear() { - this._parts = []; - this.isEmpty = true; - }, - - toString: function StringBuilder$toString(s) { - return this._parts.join(s || ''); - } -}; - -ss.StringBuilder.registerClass('StringBuilder'); - -/////////////////////////////////////////////////////////////////////////////// -// EventArgs - -ss.EventArgs = function EventArgs$() { -} -ss.EventArgs.registerClass('EventArgs'); - -ss.EventArgs.Empty = new ss.EventArgs(); - -/////////////////////////////////////////////////////////////////////////////// -// XMLHttpRequest - -if (!window.XMLHttpRequest) { - window.XMLHttpRequest = function() { - var progIDs = [ 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP' ]; - - for (var i = 0; i < progIDs.length; i++) { - try { - var xmlHttp = new ActiveXObject(progIDs[i]); - return xmlHttp; - } - catch (ex) { - } - } - - return null; - } -} - -/////////////////////////////////////////////////////////////////////////////// -// XmlDocumentParser - -ss.parseXml = function(markup) { - try { - if (DOMParser) { - var domParser = new DOMParser(); - return domParser.parseFromString(markup, 'text/xml'); - } - else { - var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ]; - - for (var i = 0; i < progIDs.length; i++) { - var xmlDOM = new ActiveXObject(progIDs[i]); - xmlDOM.async = false; - xmlDOM.loadXML(markup); - xmlDOM.setProperty('SelectionLanguage', 'XPath'); - - return xmlDOM; - } - } - } - catch (ex) { - } - - return null; -} - -/////////////////////////////////////////////////////////////////////////////// -// CancelEventArgs - -ss.CancelEventArgs = function CancelEventArgs$() { - ss.CancelEventArgs.initializeBase(this); - this.cancel = false; -} -ss.CancelEventArgs.registerClass('CancelEventArgs', ss.EventArgs); - -/////////////////////////////////////////////////////////////////////////////// -// Tuple - -ss.Tuple = function (first, second, third) { - this.first = first; - this.second = second; - if (arguments.length == 3) { - this.third = third; - } -} -ss.Tuple.registerClass('Tuple'); - -/////////////////////////////////////////////////////////////////////////////// -// Observable - -ss.Observable = function(v) { - this._v = v; - this._observers = null; -} -ss.Observable.prototype = { - - getValue: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._v; - }, - setValue: function (v) { - if (this._v !== v) { - this._v = v; - - var observers = this._observers; - if (observers) { - this._observers = null; - ss.Observable._invalidateObservers(observers); - } - } - } -}; - -ss.Observable._observerStack = []; -ss.Observable._observerRegistration = { - dispose: function () { - ss.Observable._observerStack.pop(); - } -} -ss.Observable.registerObserver = function (o) { - ss.Observable._observerStack.push(o); - return ss.Observable._observerRegistration; -} -ss.Observable._captureObservers = function (observers) { - var registeredObservers = ss.Observable._observerStack; - var observerCount = registeredObservers.length; - - if (observerCount) { - observers = observers || []; - for (var i = 0; i < observerCount; i++) { - var observer = registeredObservers[i]; - if (!observers.contains(observer)) { - observers.push(observer); - } - } - return observers; - } - return null; -} -ss.Observable._invalidateObservers = function (observers) { - for (var i = 0, len = observers.length; i < len; i++) { - observers[i].invalidateObserver(); - } -} - -ss.Observable.registerClass('Observable'); - - -ss.ObservableCollection = function (items) { - this._items = items || []; - this._observers = null; -} -ss.ObservableCollection.prototype = { - - get_item: function (index) { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items[index]; - }, - set_item: function (index, item) { - this._items[index] = item; - this._updated(); - }, - get_length: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items.length; - }, - add: function (item) { - this._items.push(item); - this._updated(); - }, - clear: function () { - this._items.clear(); - this._updated(); - }, - contains: function (item) { - return this._items.contains(item); - }, - getEnumerator: function () { - this._observers = ss.Observable._captureObservers(this._observers); - return this._items.getEnumerator(); - }, - indexOf: function (item) { - return this._items.indexOf(item); - }, - insert: function (index, item) { - this._items.insert(index, item); - this._updated(); - }, - remove: function (item) { - if (this._items.remove(item)) { - this._updated(); - return true; - } - return false; - }, - removeAt: function (index) { - this._items.removeAt(index); - this._updated(); - }, - toArray: function () { - return this._items; - }, - _updated: function() { - var observers = this._observers; - if (observers) { - this._observers = null; - ss.Observable._invalidateObservers(observers); - } - } -} -ss.ObservableCollection.registerClass('ObservableCollection', null, ss.IEnumerable); - -/////////////////////////////////////////////////////////////////////////////// -// Interfaces - -ss.IApplication = function() { }; -ss.IApplication.registerInterface('IApplication'); - -ss.IContainer = function () { }; -ss.IContainer.registerInterface('IContainer'); - -ss.IObjectFactory = function () { }; -ss.IObjectFactory.registerInterface('IObjectFactory'); - -ss.IEventManager = function () { }; -ss.IEventManager.registerInterface('IEventManager'); - -ss.IInitializable = function () { }; -ss.IInitializable.registerInterface('IInitializable'); diff --git a/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.js b/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.js deleted file mode 100644 index 5631d9cc8..000000000 --- a/samples/AroundMe/AroundMeWeb/Content/Scripts/mscorlib.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var e={version:"0.7.4.0",isUndefined:function(a){return a===undefined},isNull:function(a){return a===null},isNullOrUndefined:function(a){return a===null||a===undefined},isValue:function(a){return a!==null&&a!==undefined}},g=false,a=[];function d(b){a?a.push(b):setTimeout(b,0)}function b(){if(a){var c=a;a=null;for(var b=0,d=c.length;b=0||a.indexOf("e")>=0||a.endsWith("f")||a.endsWith("F")?parseFloat(a):parseInt(a,10)};Number.prototype.format=function(a){return ss.isNullOrUndefined(a)||a.length==0||a=="i"?this.toString():this._netFormat(a,false)};Number.prototype.localeFormat=function(a){return ss.isNullOrUndefined(a)||a.length==0||a=="i"?this.toLocaleString():this._netFormat(a,true)};Number._commaFormat=function(a,i,n,o){var c=null,h=a.indexOf(n);if(h>0){c=a.substr(h);a=a.substr(0,h)}var j=a.startsWith("-");if(j)a=a.substr(1);var f=0,g=i[f];if(a.length1)c=parseInt(f.substr(1));var e=f.charAt(0);switch(e){case"d":case"D":a=parseInt(Math.abs(this)).toString();if(c!=-1)a=a.padLeft(c,"0");if(this<0)a="-"+a;break;case"x":case"X":a=parseInt(Math.abs(this)).toString(16);if(e=="X")a=a.toUpperCase();if(c!=-1)a=a.padLeft(c,"0");break;case"e":case"E":if(c==-1)a=this.toExponential();else a=this.toExponential(c);if(e=="E")a=a.toUpperCase();break;case"f":case"F":case"n":case"N":if(c==-1)c=b.numberDecimalDigits;a=this.toFixed(c).toString();if(c&&b.numberDecimalSeparator!="."){var d=a.indexOf(".");a=a.substr(0,d)+b.numberDecimalSeparator+a.substr(d+1)}if(e=="n"||e=="N")a=Number._commaFormat(a,b.numberGroupSizes,b.numberDecimalSeparator,b.numberGroupSeparator);break;case"c":case"C":if(c==-1)c=b.currencyDecimalDigits;a=Math.abs(this).toFixed(c).toString();if(c&&b.currencyDecimalSeparator!="."){var d=a.indexOf(".");a=a.substr(0,d)+b.currencyDecimalSeparator+a.substr(d+1)}a=Number._commaFormat(a,b.currencyGroupSizes,b.currencyDecimalSeparator,b.currencyGroupSeparator);if(this<0)a=String.format(b.currencyNegativePattern,a);else a=String.format(b.currencyPositivePattern,a);break;case"p":case"P":if(c==-1)c=b.percentDecimalDigits;a=(Math.abs(this)*100).toFixed(c).toString();if(c&&b.percentDecimalSeparator!="."){var d=a.indexOf(".");a=a.substr(0,d)+b.percentDecimalSeparator+a.substr(d+1)}a=Number._commaFormat(a,b.percentGroupSizes,b.percentDecimalSeparator,b.percentGroupSeparator);if(this<0)a=String.format(b.percentNegativePattern,a);else a=String.format(b.percentPositivePattern,a)}return a};String.__typeName="String";String.Empty="";String.compare=function(a,b,c){if(c){if(a)a=a.toUpperCase();if(b)b=b.toUpperCase()}a=a||"";b=b||"";return a==b?0:athis.length?false:this.substr(this.length-a.length)==a};String.equals=function(b,c,a){return String.compare(b,c,a)==0};String._format=function(b,c,a){if(!String._formatRE)String._formatRE=/(\{[^\}^\{]+\})/g;return b.replace(String._formatRE,function(h,d){var g=parseInt(d.substr(1)),b=c[g+1];if(ss.isNullOrUndefined(b))return"";if(b.format){var e=null,f=d.indexOf(":");if(f>0)e=d.substring(f+1,d.length-1);return a?b.localeFormat(e):b.format(e)}else return a?b.toLocaleString():b.toString()})};String.format=function(a){return String._format(a,arguments,false)};String.fromChar=function(a,d){for(var c=a,b=1;b=b)d=b-1;for(var c=a;c<=d;c++)if(f.indexOf(this.charAt(c))>=0)return c;return-1};String.prototype.insert=function(a,b){if(!b)return this;if(!a)return b+this;var c=this.substr(0,a),d=this.substr(a);return c+b+d};String.isNullOrEmpty=function(a){return!a||!a.length};String.prototype.lastIndexOfAny=function(f,a,e){var d=this.length;if(!d)return-1;a=a||d-1;e=e||d;var c=a-e+1;if(c<0)c=0;for(var b=a;b>=c;b--)if(f.indexOf(this.charAt(b))>=0)return b;return-1};String.localeFormat=function(a){return String._format(a,arguments,true)};String.prototype.padLeft=function(b,a){if(this.lengththis.length?this.substr(0,a):this.substr(0,a)+this.substr(a+b)};String.prototype.replaceAll=function(b,a){a=a||"";return this.split(b).join(a)};String.prototype.startsWith=function(a){return!a.length?true:a.length>this.length?false:this.substr(0,a.length)==a};if(!String.prototype.trim)String.prototype.trim=function(){return this.trimEnd().trimStart()};String.prototype.trimEnd=function(){return this.replace(/\s*$/,"")};String.prototype.trimStart=function(){return this.replace(/^\s*/,"")};Array.__typeName="Array";Array.__interfaces=[ss.IEnumerable];Array.prototype.add=function(a){this[this.length]=a};Array.prototype.addRange=function(a){this.push.apply(this,a)};Array.prototype.aggregate=function(b,c,d){for(var e=this.length,a=0;a=0};Array.prototype.dequeue=function(){return this.shift()};Array.prototype.enqueue=function(a){this._queue=true;this.push(a)};Array.prototype.peek=function(){if(this.length){var a=this._queue?0:this.length-1;return this[a]}return null};if(!Array.prototype.every)Array.prototype.every=function(b,c){for(var d=this.length,a=0;a=0){this.splice(a,1);return true}return false};Array.prototype.removeAt=function(a){this.splice(a,1)};Array.prototype.removeRange=function(b,a){return this.splice(b,a)};if(!Array.prototype.some)Array.prototype.some=function(b,c){for(var d=this.length,a=0;a1){var c=a.substring(1,b),d=a.substr(b+1);return new RegExp(c,d)}}return null};Date.__typeName="Date";Date.empty=null;Date.get_now=function(){return new Date};Date.get_today=function(){var a=new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate())};Date.isEmpty=function(a){return a===null||a.valueOf()===0};Date.prototype.format=function(a){return ss.isNullOrUndefined(a)||a.length==0||a=="i"?this.toString():a=="id"?this.toDateString():a=="it"?this.toTimeString():this._netFormat(a,false)};Date.prototype.localeFormat=function(a){return ss.isNullOrUndefined(a)||a.length==0||a=="i"?this.toLocaleString():a=="id"?this.toLocaleDateString():a=="it"?this.toLocaleTimeString():this._netFormat(a,true)};Date.prototype._netFormat=function(d,i){var b=this,c=i?ss.CultureInfo.CurrentCulture.dateFormat:ss.CultureInfo.InvariantCulture.dateFormat;if(d.length==1)switch(d){case"f":d=c.longDatePattern+" "+c.shortTimePattern;break;case"F":d=c.dateTimePattern;break;case"d":d=c.shortDatePattern;break;case"D":d=c.longDatePattern;break;case"t":d=c.shortTimePattern;break;case"T":d=c.longTimePattern;break;case"g":d=c.shortDatePattern+" "+c.shortTimePattern;break;case"G":d=c.shortDatePattern+" "+c.longTimePattern;break;case"R":case"r":c=ss.CultureInfo.InvariantCulture.dateFormat;d=c.gmtDateTimePattern;break;case"u":d=c.universalDateTimePattern;break;case"U":d=c.dateTimePattern;b=new Date(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds());break;case"s":d=c.sortableDateTimePattern}if(d.charAt(0)=="%")d=d.substr(1);if(!Date._formatRE)Date._formatRE=/'.*?[^\\]'|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g;var g=Date._formatRE,h=new ss.StringBuilder;g.lastIndex=0;while(true){var j=g.lastIndex,f=g.exec(d);h.append(d.slice(j,f?f.index:d.length));if(!f)break;var e=f[0],a=e;switch(e){case"dddd":a=c.dayNames[b.getDay()];break;case"ddd":a=c.shortDayNames[b.getDay()];break;case"dd":a=b.getDate().toString().padLeft(2,"0");break;case"d":a=b.getDate();break;case"MMMM":a=c.monthNames[b.getMonth()];break;case"MMM":a=c.shortMonthNames[b.getMonth()];break;case"MM":a=(b.getMonth()+1).toString().padLeft(2,"0");break;case"M":a=b.getMonth()+1;break;case"yyyy":a=b.getFullYear();break;case"yy":a=(b.getFullYear()%100).toString().padLeft(2,"0");break;case"y":a=b.getFullYear()%100;break;case"h":case"hh":a=b.getHours()%12;if(!a)a="12";else if(e=="hh")a=a.toString().padLeft(2,"0");break;case"HH":a=b.getHours().toString().padLeft(2,"0");break;case"H":a=b.getHours();break;case"mm":a=b.getMinutes().toString().padLeft(2,"0");break;case"m":a=b.getMinutes();break;case"ss":a=b.getSeconds().toString().padLeft(2,"0");break;case"s":a=b.getSeconds();break;case"t":case"tt":a=b.getHours()<12?c.amDesignator:c.pmDesignator;if(e=="t")a=a.charAt(0);break;case"fff":a=b.getMilliseconds().toString().padLeft(3,"0");break;case"ff":a=b.getMilliseconds().toString().padLeft(3).substr(0,2);break;case"f":a=b.getMilliseconds().toString().padLeft(3).charAt(0);break;case"z":a=b.getTimezoneOffset()/60;a=(a>=0?"-":"+")+Math.floor(Math.abs(a));break;case"zz":case"zzz":a=b.getTimezoneOffset()/60;a=(a>=0?"-":"+")+Math.floor(Math.abs(a)).toString().padLeft(2,"0");if(e=="zzz")a+=c.timeSeparator+Math.abs(b.getTimezoneOffset()%60).toString().padLeft(2,"0");break;default:if(a.charAt(0)=="'")a=a.substr(1,a.length-2).replace(/\\'/g,"'")}h.append(a)}return h.toString()};Date.parseDate=function(a){return new Date(Date.parse(a))};Error.__typeName="Error";Error.prototype.popStackFrame=function(){if(ss.isNullOrUndefined(this.stack)||ss.isNullOrUndefined(this.fileName)||ss.isNullOrUndefined(this.lineNumber))return;var a=this.stack.split("\n"),c=a[0],e=this.fileName+":"+this.lineNumber;while(!ss.isNullOrUndefined(c)&&c.indexOf(e)===-1){a.shift();c=a[0]}var d=a[1];if(isNullOrUndefined(d))return;var b=d.match(/@(.*):(\d+)$/);if(ss.isNullOrUndefined(b))return;a.shift();this.stack=a.join("\n");this.fileName=b[1];this.lineNumber=parseInt(b[2])};Error.createError=function(e,b,c){var a=new Error(e);if(b)for(var d in b)a[d]=b[d];if(c)a.innerException=c;a.popStackFrame();return a};ss.Debug=window.Debug||function(){};ss.Debug.__typeName="Debug";if(!ss.Debug.writeln)ss.Debug.writeln=function(a){if(window.console){if(window.console.debug){window.console.debug(a);return}else if(window.console.log){window.console.log(a);return}}else if(window.opera&&window.opera.postError){window.opera.postError(a);return}};ss.Debug._fail=function(a){ss.Debug.writeln(a);eval("debugger;")};ss.Debug.assert=function(b,a){if(!b){a="Assert failed: "+a;confirm(a+"\r\n\r\nBreak into debugger?")&&ss.Debug._fail(a)}};ss.Debug.fail=function(a){ss.Debug._fail(a)};window.Type=Function;Type.__typeName="Type";window.__Namespace=function(a){this.__typeName=a};__Namespace.prototype={__namespace:true,getName:function(){return this.__typeName}};Type.registerNamespace=function(e){if(!window.__namespaces)window.__namespaces={};if(!window.__rootNamespaces)window.__rootNamespaces=[];if(window.__namespaces[e])return;for(var c=window,d=e.split("."),a=0;a0?a.substr(b+1):a};Type.prototype.getInterfaces=function(){return this.__interfaces};Type.prototype.isInstanceOfType=function(a){if(ss.isNullOrUndefined(a))return false;if(this==Object||a instanceof this)return true;var b=Type.getInstanceType(a);return this.isAssignableFrom(b)};Type.prototype.isAssignableFrom=function(c){if(this==Object||this==c)return true;if(this.__class){var a=c.__baseType;while(a){if(this==a)return true;a=a.__baseType}}else if(this.__interface){var b=c.__interfaces;if(b&&b.contains(this))return true;var a=c.__baseType;while(a){b=a.__interfaces;if(b&&b.contains(this))return true;a=a.__baseType}}return false};Type.isClass=function(a){return a.__class==true};Type.isEnum=function(a){return a.__enum==true};Type.isFlags=function(a){return a.__enum==true&&a.__flags==true};Type.isInterface=function(a){return a.__interface==true};Type.isNamespace=function(a){return a.__namespace==true};Type.canCast=function(a,b){return b.isInstanceOfType(a)};Type.safeCast=function(a,b){return b.isInstanceOfType(a)?a:null};Type.getInstanceType=function(b){var a=null;try{a=b.constructor}catch(c){}if(!a||!a.__typeName)a=Object;return a};Type.getType=function(a){if(!a)return null;if(!Type.__typeCache)Type.__typeCache={};var b=Type.__typeCache[a];if(!b){b=eval(a);Type.__typeCache[a]=b}return b};Type.parse=function(a){return Type.getType(a)};ss.Delegate=function(){};ss.Delegate.registerClass("Delegate");ss.Delegate.empty=function(){};ss.Delegate._contains=function(b,d,c){for(var a=0;a diff --git a/samples/AroundMe/AroundMeWeb/Global.asax.cs b/samples/AroundMe/AroundMeWeb/Global.asax.cs deleted file mode 100644 index 069209831..000000000 --- a/samples/AroundMe/AroundMeWeb/Global.asax.cs +++ /dev/null @@ -1,29 +0,0 @@ -// AroundMeApplication.cs -// - -using System; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; - -namespace AroundMeWeb { - - public class AroundMeApplication : HttpApplication { - - public static void RegisterRoutes(RouteCollection routes) { - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - routes.IgnoreRoute("Content/{*pathInfo}"); - - routes.MapRoute("DefaultRoute", "{controller}/{action}/{id}", - new { - controller = "Home", - action = "Index", - id = UrlParameter.Optional - }); - } - - protected void Application_Start() { - RegisterRoutes(RouteTable.Routes); - } - } -} diff --git a/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs b/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs deleted file mode 100644 index a1d36b2f8..000000000 --- a/samples/AroundMe/AroundMeWeb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AroundMeWeb")] -[assembly: AssemblyDescription("Script# Around Me Sample Web App")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("Script#")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/AroundMe/AroundMeWeb/Views/Home/Index.aspx b/samples/AroundMe/AroundMeWeb/Views/Home/Index.aspx deleted file mode 100644 index 21da57a72..000000000 --- a/samples/AroundMe/AroundMeWeb/Views/Home/Index.aspx +++ /dev/null @@ -1,42 +0,0 @@ -<%@ Page Language="C#" Inherits="System.Web.Mvc.DynamicViewPage" %> - - - - Photos Around Me - - - - -
    -
    -
    Photos Around Me
    -
    - - - - -
    -
    -
    -
    -
    - - -
    - - - - - -
    -
    -
    - - - - - - diff --git a/samples/AroundMe/AroundMeWeb/Views/web.config b/samples/AroundMe/AroundMeWeb/Views/web.config deleted file mode 100644 index e61b1a6e0..000000000 --- a/samples/AroundMe/AroundMeWeb/Views/web.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/AroundMe/AroundMeWeb/web.config b/samples/AroundMe/AroundMeWeb/web.config deleted file mode 100644 index fc11f6a09..000000000 --- a/samples/AroundMe/AroundMeWeb/web.config +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/AroundMe/MapDemo/Map.htm b/samples/AroundMe/MapDemo/Map.htm new file mode 100644 index 000000000..bb66498bb --- /dev/null +++ b/samples/AroundMe/MapDemo/Map.htm @@ -0,0 +1,19 @@ + + + + Bing Maps Demo + + +
    +
    +
    + +
    + + + + + + + + diff --git a/samples/AroundMe/MapDemo/MapApplication.cs b/samples/AroundMe/MapDemo/MapApplication.cs new file mode 100644 index 000000000..278df9f46 --- /dev/null +++ b/samples/AroundMe/MapDemo/MapApplication.cs @@ -0,0 +1,18 @@ +// MapApplication.cs +// + +using System; +using System.Html; + +namespace MapDemo { + + internal static class MapApplication { + + static MapApplication() { + Window.AddEventListener("load", delegate(ElementEvent e) { + MapPage page = new MapPage(); + page.Run(); + }, /* useCapture */ false); + } + } +} diff --git a/samples/AroundMe/MapDemo/MapDemo.csproj b/samples/AroundMe/MapDemo/MapDemo.csproj new file mode 100644 index 000000000..8e7e73c4a --- /dev/null +++ b/samples/AroundMe/MapDemo/MapDemo.csproj @@ -0,0 +1,59 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {2176DBB5-D8FD-493C-B896-59E7283E7127} + Library + Properties + MapDemo + MapDemo + Properties\Script.template + Properties\FxCop.ruleset + True + True + true + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\MapDemo.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\MapDemo.xml + + + + + + + + + + + + ..\packages\ScriptSharp.Lib.BingMaps.0.7.5.0\lib\Script.Microsoft.BingMaps.dll + + + ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + + + + + PreserveNewest + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/MapDemo/MapPage.cs b/samples/AroundMe/MapDemo/MapPage.cs new file mode 100644 index 000000000..843dac4e9 --- /dev/null +++ b/samples/AroundMe/MapDemo/MapPage.cs @@ -0,0 +1,118 @@ +// MapPage.cs +// + +using System; +using System.Collections; +using System.Html; +using Microsoft.Maps; +using Microsoft.Maps.Location; +using Microsoft.Maps.Traffic; +using Microsoft.Maps.VenueMaps; + +namespace MapDemo { + + internal sealed class MapPage { + + private Map _map; + private MapPushpin _pushpin; + private MapInfobox _infobox; + + public void Run() { + Element rootElement = Document.GetElementById("map"); + + MapOptions mapOptions = new MapOptions(); + mapOptions.Credentials = (string)rootElement.GetAttribute("data-credentials"); + mapOptions.Width = 640; + mapOptions.Height = 480; + mapOptions.ShowCopyright = false; + mapOptions.ShowMapTypeSelector = false; + mapOptions.ShowLogo = false; + mapOptions.ShowScalebar = false; + mapOptions.ShowNavControl = false; + mapOptions.ShowDashboard = false; + mapOptions.Center = new MapLocation(47.610377, -122.2006786); + mapOptions.Zoom = 10; + mapOptions.MapType = MapType.Road; + + MapPushpinOptions pushpinOptions = new MapPushpinOptions(); + _pushpin = new MapPushpin(mapOptions.Center, pushpinOptions); + + MapInfoboxOptions infoboxOptions = new MapInfoboxOptions(); + infoboxOptions.Title = "Bellevue"; + infoboxOptions.Visible = false; + infoboxOptions.Offset = new MapPoint(0, 20); + infoboxOptions.Height = 48; + infoboxOptions.Width = 80; + infoboxOptions.ShowCloseButton = false; + _infobox = new MapInfobox(mapOptions.Center, infoboxOptions); + + _map = new Map(rootElement, mapOptions); + _map.Entities.Push(_pushpin); + _map.Entities.Push(_infobox); + + MapEvents.AddHandler(_pushpin, "click", OnPushpinClick); + MapEvents.AddHandler(_map, "viewchange", OnViewChanged); + + MapModuleOptions trafficOptions = new MapModuleOptions(); + trafficOptions.Callback = delegate() { + TrafficLayer trafficLayer = new TrafficLayer(_map); + trafficLayer.Show(); + }; + Map.LoadModule(MapModule.Traffic, trafficOptions); + + MapModuleOptions venueMapOptions = new MapModuleOptions(); + venueMapOptions.Callback = delegate() { + VenueMapFactory venueMapFactory = new VenueMapFactory(_map); + + VenueMapSearchOptions searchOptions = new VenueMapSearchOptions(); + searchOptions.Map = _map; + searchOptions.Location = mapOptions.Center; + searchOptions.Radius = 1000; + searchOptions.Callback = delegate(Venue[] venues) { + if (venues.Length != 0) { + VenueMapOptions venueOptions = new VenueMapOptions(); + venueOptions.VenueMapID = venues[0].Metadata.ID; + venueOptions.SuccessCallback = delegate(VenueMap venueMap, VenueMapOptions options) { + + venueMap.Show(); + if (Script.Confirm("Zoom to " + venueMap.Name + "?")) { + _map.SetView(venueMap.BestMapView); + } + }; + + venueMapFactory.Create(venueOptions); + } + }; + + venueMapFactory.Search(searchOptions); + }; + Map.LoadModule(MapModule.VenueMaps, venueMapOptions); + + Element locateMeButton = Document.GetElementById("locateMeButton"); + locateMeButton.AddEventListener("click", OnLocateMeClick, false); + } + + private void OnLocateMeClick(ElementEvent e) { + GeoLocationProvider geoLocationProvider = new GeoLocationProvider(_map); + + GeoLocationOptions options = new GeoLocationOptions(); + options.UpdateMapView = true; + + geoLocationProvider.GetCurrentPosition(options); + } + + private void OnPushpinClick(EventArgs e) { + MapInfoboxOptions options = new MapInfoboxOptions(); + options.Visible = true; + + _infobox.SetOptions(options); + } + + private void OnViewChanged(EventArgs e) { + MapInfoboxOptions options = new MapInfoboxOptions(); + options.Visible = false; + + _infobox.SetOptions(options); + } + } +} diff --git a/samples/AroundMe/MapDemo/Properties/AssemblyInfo.cs b/samples/AroundMe/MapDemo/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..cd6b0d34b --- /dev/null +++ b/samples/AroundMe/MapDemo/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MapDemo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("MapDemo")] diff --git a/samples/AroundMe/MapDemo/Properties/FxCop.ruleset b/samples/AroundMe/MapDemo/Properties/FxCop.ruleset new file mode 100644 index 000000000..47c160f61 --- /dev/null +++ b/samples/AroundMe/MapDemo/Properties/FxCop.ruleset @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/BingMapsDemo/BingMapsApp/Properties/BingMapsApp.script b/samples/AroundMe/MapDemo/Properties/Script.template similarity index 100% rename from samples/BingMapsDemo/BingMapsApp/Properties/BingMapsApp.script rename to samples/AroundMe/MapDemo/Properties/Script.template diff --git a/samples/AroundMe/MapDemo/packages.config b/samples/AroundMe/MapDemo/packages.config new file mode 100644 index 000000000..a7a59cc42 --- /dev/null +++ b/samples/AroundMe/MapDemo/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs b/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs index 783d2153f..80fc9acb6 100644 --- a/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs +++ b/samples/AroundMe/Twitter/Properties/AssemblyInfo.cs @@ -9,10 +9,11 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Twitter")] -[assembly: AssemblyDescription("Script# Around Me Sample Twitter Import Library")] +[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("Script#")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/samples/AroundMe/Twitter/Properties/ScriptInfo.txt b/samples/AroundMe/Twitter/Properties/ScriptInfo.txt new file mode 100644 index 000000000..802afb692 --- /dev/null +++ b/samples/AroundMe/Twitter/Properties/ScriptInfo.txt @@ -0,0 +1,12 @@ +Script Information +=============================================================================== + +This assembly provides access to script APIs. This is only meant for use at +development time, so you can reference and compile your c# code against the +script APIs. You must include the appropriate scripts in your page for +runtime functionality. + +# TODO: You can use this file to describe which version of the script +# your import library is based on, the URLs of associated scripts +# or any particular usage information for including those scripts +# into the application. diff --git a/samples/AroundMe/Twitter/Twitter.cs b/samples/AroundMe/Twitter/Twitter.cs index 46d93ce48..291e1b475 100644 --- a/samples/AroundMe/Twitter/Twitter.cs +++ b/samples/AroundMe/Twitter/Twitter.cs @@ -4,7 +4,6 @@ // https://dev.twitter.com/anywhere/begin using System; -using System.Html; using System.Runtime.CompilerServices; namespace TwitterApi { diff --git a/samples/AroundMe/Twitter/Twitter.csproj b/samples/AroundMe/Twitter/Twitter.csproj index 26ac2687e..171fb0894 100644 --- a/samples/AroundMe/Twitter/Twitter.csproj +++ b/samples/AroundMe/Twitter/Twitter.csproj @@ -5,32 +5,23 @@ AnyCPU 9.0.30729 2.0 - {135E07CB-462D-4014-BD74-FF565C60A46D} + {476312F9-5403-4C3A-848A-0F31213FC72E} Library - True 512 - v4.0 - - ISO-2 Properties - Twitter + TwitterApi Twitter - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ + true - false - none bin\Debug\ DEBUG prompt 4 1591, 0661, 0660, 1684 bin\Debug\Twitter.xml - 3 - false - none bin\Release\ @@ -38,15 +29,24 @@ 4 1591, 0661, 0660, 1684 bin\Release\Twitter.xml - 3 - - + + + - - + + + + + ..\packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/Twitter/packages.config b/samples/AroundMe/Twitter/packages.config new file mode 100644 index 000000000..794c9675d --- /dev/null +++ b/samples/AroundMe/Twitter/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/samples/AroundMe/packages/nuget.exe b/samples/AroundMe/packages/nuget.exe new file mode 100644 index 000000000..e313ff958 Binary files /dev/null and b/samples/AroundMe/packages/nuget.exe differ diff --git a/samples/AroundMe/packages/nuget.targets b/samples/AroundMe/packages/nuget.targets new file mode 100644 index 000000000..51fc72bd2 --- /dev/null +++ b/samples/AroundMe/packages/nuget.targets @@ -0,0 +1,16 @@ + + + + false + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory))) + $(MSBuildThisFileDirectory)nuget.exe install "$(MSBuildProjectDirectory)\packages.config" -o "$(PackagesDir)" + + RestorePackages; + $(BuildDependsOn); + + + + + + + \ No newline at end of file diff --git a/samples/AroundMe/packages/repositories.config b/samples/AroundMe/packages/repositories.config new file mode 100644 index 000000000..e003ad5ea --- /dev/null +++ b/samples/AroundMe/packages/repositories.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/samples/BingMapsDemo/BingMapsApp/BingMapsApp.csproj b/samples/BingMapsDemo/BingMapsApp/BingMapsApp.csproj deleted file mode 100644 index fb3d51c09..000000000 --- a/samples/BingMapsDemo/BingMapsApp/BingMapsApp.csproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {DDDA2C59-1B18-4016-AC45-6FF217665A01} - Library - True - v4.0 - - ISO-2 - Properties - BingMapsApp - BingMapsApp - Properties\BingMapsApp.script - Properties\BingMapsApp.ruleset - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ - ..\BingMapsWeb - - - true - pdbonly - bin\Debug\ - DEBUG;CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Debug\BingMapsApp.xml - - - true - pdbonly - bin\Release\ - CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Release\BingMapsApp.xml - - - - - False - C:\Program Files (x86)\ScriptSharp\v1.0\Framework\Script.Microsoft.BingMaps.dll - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/BingMapsDemo/BingMapsApp/BingMapsApplication.cs b/samples/BingMapsDemo/BingMapsApp/BingMapsApplication.cs deleted file mode 100644 index 6520f9fd1..000000000 --- a/samples/BingMapsDemo/BingMapsApp/BingMapsApplication.cs +++ /dev/null @@ -1,20 +0,0 @@ -// BingMapsApplication.cs -// - -using System; -using System.Collections; -using System.Html; -using System.Runtime.CompilerServices; - -namespace BingMapsApp { - - internal static class BingMapsApplication { - - static BingMapsApplication() { - Window.AddEventListener("load", delegate(ElementEvent e) { - BingMapsShell shell = new BingMapsShell(); - shell.Run(); - }, /* useCapture */ false); - } - } -} diff --git a/samples/BingMapsDemo/BingMapsApp/BingMapsShell.cs b/samples/BingMapsDemo/BingMapsApp/BingMapsShell.cs deleted file mode 100644 index 8cb49a3c6..000000000 --- a/samples/BingMapsDemo/BingMapsApp/BingMapsShell.cs +++ /dev/null @@ -1,118 +0,0 @@ -// BingMapsShell.cs -// - -using System; -using System.Collections; -using System.Html; -using Microsoft.Maps; -using Microsoft.Maps.Location; -using Microsoft.Maps.Traffic; -using Microsoft.Maps.VenueMaps; - -namespace BingMapsApp { - - internal sealed class BingMapsShell { - - private Map _map; - private MapPushpin _pushpin; - private MapInfobox _infobox; - - public void Run() { - Element rootElement = Document.GetElementById("map"); - - MapOptions mapOptions = new MapOptions(); - mapOptions.Credentials = (string)rootElement.GetAttribute("data-credentials"); - mapOptions.Width = 640; - mapOptions.Height = 480; - mapOptions.ShowCopyright = false; - mapOptions.ShowMapTypeSelector = false; - mapOptions.ShowLogo = false; - mapOptions.ShowScalebar = false; - mapOptions.ShowNavControl = false; - mapOptions.ShowDashboard = false; - mapOptions.Center = new MapLocation(47.610377, -122.2006786); - mapOptions.Zoom = 10; - mapOptions.MapType = MapType.Road; - - MapPushpinOptions pushpinOptions = new MapPushpinOptions(); - _pushpin = new MapPushpin(mapOptions.Center, pushpinOptions); - - MapInfoboxOptions infoboxOptions = new MapInfoboxOptions(); - infoboxOptions.Title = "Bellevue"; - infoboxOptions.Visible = false; - infoboxOptions.Offset = new MapPoint(0, 20); - infoboxOptions.Height = 48; - infoboxOptions.Width = 80; - infoboxOptions.ShowCloseButton = false; - _infobox = new MapInfobox(mapOptions.Center, infoboxOptions); - - _map = new Map(rootElement, mapOptions); - _map.Entities.Push(_pushpin); - _map.Entities.Push(_infobox); - - MapEvents.AddHandler(_pushpin, "click", OnPushpinClick); - MapEvents.AddHandler(_map, "viewchange", OnViewChanged); - - MapModuleOptions trafficOptions = new MapModuleOptions(); - trafficOptions.Callback = delegate() { - TrafficLayer trafficLayer = new TrafficLayer(_map); - trafficLayer.Show(); - }; - Map.LoadModule(MapModule.Traffic, trafficOptions); - - MapModuleOptions venueMapOptions = new MapModuleOptions(); - venueMapOptions.Callback = delegate() { - VenueMapFactory venueMapFactory = new VenueMapFactory(_map); - - VenueMapSearchOptions searchOptions = new VenueMapSearchOptions(); - searchOptions.Map = _map; - searchOptions.Location = mapOptions.Center; - searchOptions.Radius = 1000; - searchOptions.Callback = delegate(Venue[] venues) { - if (venues.Length != 0) { - VenueMapOptions venueOptions = new VenueMapOptions(); - venueOptions.VenueMapID = venues[0].Metadata.ID; - venueOptions.SuccessCallback = delegate(VenueMap venueMap, VenueMapOptions options) { - - venueMap.Show(); - if (Script.Confirm("Zoom to " + venueMap.Name + "?")) { - _map.SetView(venueMap.BestMapView); - } - }; - - venueMapFactory.Create(venueOptions); - } - }; - - venueMapFactory.Search(searchOptions); - }; - Map.LoadModule(MapModule.VenueMaps, venueMapOptions); - - Element locateMeButton = Document.GetElementById("locateMeButton"); - locateMeButton.AddEventListener("click", OnLocateMeClick, false); - } - - private void OnLocateMeClick(ElementEvent e) { - GeoLocationProvider geoLocationProvider = new GeoLocationProvider(_map); - - GeoLocationOptions options = new GeoLocationOptions(); - options.UpdateMapView = true; - - geoLocationProvider.GetCurrentPosition(options); - } - - private void OnPushpinClick(EventArgs e) { - MapInfoboxOptions options = new MapInfoboxOptions(); - options.Visible = true; - - _infobox.SetOptions(options); - } - - private void OnViewChanged(EventArgs e) { - MapInfoboxOptions options = new MapInfoboxOptions(); - options.Visible = false; - - _infobox.SetOptions(options); - } - } -} diff --git a/samples/BingMapsDemo/BingMapsApp/Properties/AssemblyInfo.cs b/samples/BingMapsDemo/BingMapsApp/Properties/AssemblyInfo.cs deleted file mode 100644 index 69e3a6d59..000000000 --- a/samples/BingMapsDemo/BingMapsApp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("BingMapsApp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Script# Samples")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: ScriptAssembly("BingMapsApp")] -[assembly: ScriptNamespace("bma")] diff --git a/samples/BingMapsDemo/BingMapsApp/Properties/BingMapsApp.ruleset b/samples/BingMapsDemo/BingMapsApp/Properties/BingMapsApp.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/BingMapsDemo/BingMapsApp/Properties/BingMapsApp.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/BingMapsDemo/BingMapsDemo.sln b/samples/BingMapsDemo/BingMapsDemo.sln deleted file mode 100644 index 3d6e6cfda..000000000 --- a/samples/BingMapsDemo/BingMapsDemo.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BingMapsWeb", "BingMapsWeb\BingMapsWeb.csproj", "{538BAD37-C5FE-48EA-BC51-6686A575D1F0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BingMapsApp", "BingMapsApp\BingMapsApp.csproj", "{DDDA2C59-1B18-4016-AC45-6FF217665A01}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {538BAD37-C5FE-48EA-BC51-6686A575D1F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {538BAD37-C5FE-48EA-BC51-6686A575D1F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {538BAD37-C5FE-48EA-BC51-6686A575D1F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {538BAD37-C5FE-48EA-BC51-6686A575D1F0}.Release|Any CPU.Build.0 = Release|Any CPU - {DDDA2C59-1B18-4016-AC45-6FF217665A01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DDDA2C59-1B18-4016-AC45-6FF217665A01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DDDA2C59-1B18-4016-AC45-6FF217665A01}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DDDA2C59-1B18-4016-AC45-6FF217665A01}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/BingMapsDemo/BingMapsWeb/BingMapsWeb.csproj b/samples/BingMapsDemo/BingMapsWeb/BingMapsWeb.csproj deleted file mode 100644 index fc5d58993..000000000 --- a/samples/BingMapsDemo/BingMapsWeb/BingMapsWeb.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {538BAD37-C5FE-48EA-BC51-6686A575D1F0} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - BingMapsWeb - BingMapsWeb - v4.0 - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - False - True - 29475 - / - - - False - False - - - False - - - - - - \ No newline at end of file diff --git a/samples/BingMapsDemo/BingMapsWeb/Default.htm b/samples/BingMapsDemo/BingMapsWeb/Default.htm deleted file mode 100644 index e97d2ef29..000000000 --- a/samples/BingMapsDemo/BingMapsWeb/Default.htm +++ /dev/null @@ -1,19 +0,0 @@ - - - - Bing Maps - - -
    -
    -
    - -
    - - - - - - - - diff --git a/samples/BingMapsDemo/BingMapsWeb/Properties/AssemblyInfo.cs b/samples/BingMapsDemo/BingMapsWeb/Properties/AssemblyInfo.cs deleted file mode 100644 index f2b554302..000000000 --- a/samples/BingMapsDemo/BingMapsWeb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("BingMapsWeb")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Script# Samples")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/FishTankDemo/FishTankApp/Fish.cs b/samples/FishTank/Fish.cs similarity index 100% rename from samples/FishTankDemo/FishTankApp/Fish.cs rename to samples/FishTank/Fish.cs diff --git a/samples/FishTankDemo/FishTankWeb/Fishes.png b/samples/FishTank/FishSprites.png similarity index 100% rename from samples/FishTankDemo/FishTankWeb/Fishes.png rename to samples/FishTank/FishSprites.png diff --git a/samples/FishTankDemo/FishTankApp/FishTank.cs b/samples/FishTank/FishTank.cs similarity index 100% rename from samples/FishTankDemo/FishTankApp/FishTank.cs rename to samples/FishTank/FishTank.cs diff --git a/samples/FishTank/FishTank.csproj b/samples/FishTank/FishTank.csproj new file mode 100644 index 000000000..93e669f10 --- /dev/null +++ b/samples/FishTank/FishTank.csproj @@ -0,0 +1,65 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C} + Library + Properties + FishTank + FishTank + Properties\Script.template + Properties\FxCop.ruleset + True + True + True + + + bin\Debug\ + DEBUG;CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Debug\FishTank.xml + + + bin\Release\ + CODE_ANALYSIS;SCRIPTSHARP + prompt + 4 + 0028, 1591, 1684 + bin\Release\FishTank.xml + + + + + Designer + + + + + + + + + + packages\ScriptSharp.Lib.HTML.0.7.5.0\lib\Script.Web.dll + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + \ No newline at end of file diff --git a/samples/FishTank/FishTank.htm b/samples/FishTank/FishTank.htm new file mode 100644 index 000000000..9256870a2 --- /dev/null +++ b/samples/FishTank/FishTank.htm @@ -0,0 +1,28 @@ + + + + Fish Tank + + + + + + + + + + + + + diff --git a/samples/FishTankDemo/FishTankWeb/FishTank.jpg b/samples/FishTank/FishTank.jpg similarity index 100% rename from samples/FishTankDemo/FishTankWeb/FishTank.jpg rename to samples/FishTank/FishTank.jpg diff --git a/samples/FishTank/FishTank.sln b/samples/FishTank/FishTank.sln new file mode 100644 index 000000000..76ecdfa32 --- /dev/null +++ b/samples/FishTank/FishTank.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishTank", "FishTank.csproj", "{A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A506F058-5DDB-4A1C-8DAE-ECFB59F78C4C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/FishTankDemo/FishTankApp/FishTankApplication.cs b/samples/FishTank/FishTankApplication.cs similarity index 87% rename from samples/FishTankDemo/FishTankApp/FishTankApplication.cs rename to samples/FishTank/FishTankApplication.cs index 6ce8afa58..28d97accb 100644 --- a/samples/FishTankDemo/FishTankApp/FishTankApplication.cs +++ b/samples/FishTank/FishTankApplication.cs @@ -4,9 +4,11 @@ using System; using System.Collections; using System.Html; +using System.Runtime.CompilerServices; namespace FishTankApp { + [GlobalMethods] internal static class FishTankApplication { static FishTankApplication() { diff --git a/samples/FishTank/Properties/AssemblyInfo.cs b/samples/FishTank/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..3da5e17cf --- /dev/null +++ b/samples/FishTank/Properties/AssemblyInfo.cs @@ -0,0 +1,23 @@ +// AssemblyInfo.cs +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FishTank")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Script# Samples")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: ScriptAssembly("FishTank")] +[assembly: ScriptNamespace("ft")] diff --git a/samples/FishTank/Properties/FxCop.ruleset b/samples/FishTank/Properties/FxCop.ruleset new file mode 100644 index 000000000..eedb32ead --- /dev/null +++ b/samples/FishTank/Properties/FxCop.ruleset @@ -0,0 +1,107 @@ + + + + ..\packages\ScriptSharp.FxCop.0.7.5.0\tools + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/FishTankDemo/FishTankApp/Properties/FishTankApp.script b/samples/FishTank/Properties/Script.template similarity index 100% rename from samples/FishTankDemo/FishTankApp/Properties/FishTankApp.script rename to samples/FishTank/Properties/Script.template diff --git a/samples/FishTank/packages.config b/samples/FishTank/packages.config new file mode 100644 index 000000000..7025b00f8 --- /dev/null +++ b/samples/FishTank/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/samples/FishTank/packages/nuget.exe b/samples/FishTank/packages/nuget.exe new file mode 100644 index 000000000..e313ff958 Binary files /dev/null and b/samples/FishTank/packages/nuget.exe differ diff --git a/samples/FishTank/packages/nuget.targets b/samples/FishTank/packages/nuget.targets new file mode 100644 index 000000000..51fc72bd2 --- /dev/null +++ b/samples/FishTank/packages/nuget.targets @@ -0,0 +1,16 @@ + + + + false + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory))) + $(MSBuildThisFileDirectory)nuget.exe install "$(MSBuildProjectDirectory)\packages.config" -o "$(PackagesDir)" + + RestorePackages; + $(BuildDependsOn); + + + + + + + \ No newline at end of file diff --git a/samples/FishTank/packages/repositories.config b/samples/FishTank/packages/repositories.config new file mode 100644 index 000000000..0dec135fc --- /dev/null +++ b/samples/FishTank/packages/repositories.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/FishTankDemo/FishTankApp/FishTankApp.csproj b/samples/FishTankDemo/FishTankApp/FishTankApp.csproj deleted file mode 100644 index 3e47912f4..000000000 --- a/samples/FishTankDemo/FishTankApp/FishTankApp.csproj +++ /dev/null @@ -1,55 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {C2E3C95C-6B2A-4152-916B-578CAD82E776} - Library - True - v4.0 - - ISO-2 - Properties - FishTankApp - FishTankApp - Properties\FishTankApp.script - Properties\FishTankApp.ruleset - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ - ..\FishTankWeb - - - true - pdbonly - bin\Debug\ - DEBUG;CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Debug\FishTankApp.xml - - - true - pdbonly - bin\Release\ - CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Release\FishTankApp.xml - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/FishTankDemo/FishTankApp/Properties/AssemblyInfo.cs b/samples/FishTankDemo/FishTankApp/Properties/AssemblyInfo.cs deleted file mode 100644 index dc49c414b..000000000 --- a/samples/FishTankDemo/FishTankApp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FishTankApp")] -[assembly: AssemblyDescription("Fish Tank Sample App")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Script#")] -[assembly: AssemblyCopyright("Copyright © Nikhil Kothari 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: ScriptAssembly("FishTankApp")] -[assembly: ScriptNamespace("ft")] diff --git a/samples/FishTankDemo/FishTankApp/Properties/FishTankApp.ruleset b/samples/FishTankDemo/FishTankApp/Properties/FishTankApp.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/FishTankDemo/FishTankApp/Properties/FishTankApp.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/FishTankDemo/FishTankDemo.sln b/samples/FishTankDemo/FishTankDemo.sln deleted file mode 100644 index f9ac5340c..000000000 --- a/samples/FishTankDemo/FishTankDemo.sln +++ /dev/null @@ -1,45 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "FishTankWeb", "FishTankWeb", "{4EF1027C-01B9-4F82-AE0C-338425CDB125}" - ProjectSection(WebsiteProperties) = preProject - TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" - Debug.AspNetCompiler.VirtualPath = "/FishTankWeb" - Debug.AspNetCompiler.PhysicalPath = "FishTankWeb\" - Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\FishTankWeb\" - Debug.AspNetCompiler.Updateable = "true" - Debug.AspNetCompiler.ForceOverwrite = "true" - Debug.AspNetCompiler.FixedNames = "false" - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.VirtualPath = "/FishTankWeb" - Release.AspNetCompiler.PhysicalPath = "FishTankWeb\" - Release.AspNetCompiler.TargetPath = "PrecompiledWeb\FishTankWeb\" - Release.AspNetCompiler.Updateable = "true" - Release.AspNetCompiler.ForceOverwrite = "true" - Release.AspNetCompiler.FixedNames = "false" - Release.AspNetCompiler.Debug = "False" - VWDPort = "31123" - DefaultWebSiteLanguage = "Visual C#" - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishTankApp", "FishTankApp\FishTankApp.csproj", "{C2E3C95C-6B2A-4152-916B-578CAD82E776}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4EF1027C-01B9-4F82-AE0C-338425CDB125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EF1027C-01B9-4F82-AE0C-338425CDB125}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EF1027C-01B9-4F82-AE0C-338425CDB125}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {4EF1027C-01B9-4F82-AE0C-338425CDB125}.Release|Any CPU.Build.0 = Debug|Any CPU - {C2E3C95C-6B2A-4152-916B-578CAD82E776}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C2E3C95C-6B2A-4152-916B-578CAD82E776}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C2E3C95C-6B2A-4152-916B-578CAD82E776}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2E3C95C-6B2A-4152-916B-578CAD82E776}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/FishTankDemo/FishTankWeb/Default.htm b/samples/FishTankDemo/FishTankWeb/Default.htm deleted file mode 100644 index 8b7b7ca4d..000000000 --- a/samples/FishTankDemo/FishTankWeb/Default.htm +++ /dev/null @@ -1,33 +0,0 @@ - - - - Fish Tank - - - - - - - - - - - - - diff --git a/samples/PhotoDemo/Flickr/Flickr.cs b/samples/PhotoDemo/Flickr/Flickr.cs deleted file mode 100644 index d8ad92229..000000000 --- a/samples/PhotoDemo/Flickr/Flickr.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Flickr.cs -// - -using System; -using System.Collections; -using System.Html; -using System.Runtime.CompilerServices; - -namespace Flickr { - - [Imported] - [IgnoreNamespace] - public sealed class Photo : Record { - - public string id; - public string secret; - public string title; - public int server; - public string url_m; - public string url_sq; - public int width_m; - public int height_m; - } - - [Imported] - [IgnoreNamespace] - internal sealed class PhotoCollection : Record { - - public Photo[] photo = null; - } - - [Imported] - [IgnoreNamespace] - internal sealed class PhotoSearchResponse : Record { - - public PhotoCollection photos = null; - } - - public interface IPhotoService { - - void SearchPhotos(string tags, int count, FlickrSearchCallback callback); - } - - public sealed class FlickrService : IPhotoService { - - private const string FlickrSearchURLFormat = - "http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=be9b6f66bd7a1c0c0f1465a1b7e8a764&tags={0}&per_page={1}&sort=interestingness-desc&safe_search=1&content_type=1&in_gallery=true&extras=o_dims%2Curl_sq%2Curl_m&format=json&jsoncallback={2}"; - - public void SearchPhotos(string tags, int count, FlickrSearchCallback callback) { - FlickrCallback requestCallback = delegate(PhotoSearchResponse response) { - callback(response.photos.photo); - }; - string callbackName = Delegate.CreateExport(requestCallback); - - string url = String.Format(FlickrSearchURLFormat, tags.EncodeUriComponent(), count, callbackName); - ScriptElement script = (ScriptElement)Document.CreateElement("script"); - script.Type = "text/javascript"; - script.Src = url; - Document.GetElementsByTagName("head")[0].AppendChild(script); - } - } - - internal delegate void FlickrCallback(PhotoSearchResponse response); - - public delegate void FlickrSearchCallback(Photo[] photos); -} diff --git a/samples/PhotoDemo/Flickr/Flickr.csproj b/samples/PhotoDemo/Flickr/Flickr.csproj deleted file mode 100644 index 94c16b995..000000000 --- a/samples/PhotoDemo/Flickr/Flickr.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {5F2605F7-5F00-4756-AC61-1D83B0E541E4} - Library - True - v4.0 - - ISO-2 - Properties - Flickr - Flickr - Properties\Flickr.script - Properties\Flickr.ruleset - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ - ..\PhotoWeb\Content\Scripts - - - true - pdbonly - bin\Debug\ - DEBUG;CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Debug\Flickr.xml - - - true - pdbonly - bin\Release\ - CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Release\Flickr.xml - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Flickr/Properties/AssemblyInfo.cs b/samples/PhotoDemo/Flickr/Properties/AssemblyInfo.cs deleted file mode 100644 index 7cb4b8038..000000000 --- a/samples/PhotoDemo/Flickr/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Flickr")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Flickr")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: ScriptAssembly("Flickr")] diff --git a/samples/PhotoDemo/Flickr/Properties/Flickr.ruleset b/samples/PhotoDemo/Flickr/Properties/Flickr.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/PhotoDemo/Flickr/Properties/Flickr.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Flickr/Properties/Flickr.script b/samples/PhotoDemo/Flickr/Properties/Flickr.script deleted file mode 100644 index 4ed4bd67e..000000000 --- a/samples/PhotoDemo/Flickr/Properties/Flickr.script +++ /dev/null @@ -1,6 +0,0 @@ -//! #= ScriptFile ## -// - -(function() { -#include[as-is] "%code%" -})(); diff --git a/samples/PhotoDemo/Gallery/Gallery.csproj b/samples/PhotoDemo/Gallery/Gallery.csproj deleted file mode 100644 index a6ff5e839..000000000 --- a/samples/PhotoDemo/Gallery/Gallery.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {16B291CB-4AC1-41B9-943C-341FB528D7A1} - Library - True - v4.0 - - ISO-2 - Properties - Gallery - Gallery - Properties\Gallery.script - Properties\Gallery.ruleset - $(MSBuildProgramFiles32)\ScriptSharp\v1.0\Framework\ - ..\PhotoWeb\Content\Scripts - - - true - pdbonly - bin\Debug\ - DEBUG;CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Debug\Gallery.xml - - - true - pdbonly - bin\Release\ - CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Release\Gallery.xml - - - - - - - - - - - - - - - - - - - - {5F2605F7-5F00-4756-AC61-1D83B0E541E4} - Flickr - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Gallery/Interestingness.cs b/samples/PhotoDemo/Gallery/Interestingness.cs deleted file mode 100644 index 362616ca9..000000000 --- a/samples/PhotoDemo/Gallery/Interestingness.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Interestingness.cs -// - -using System; -using System.Collections; -using jQueryApi; -using jQueryApi.History; - -namespace Gallery { - - public class Interestingness { - - private static string _currentTags; - - public static void Main(Dictionary args) { - jQuery.Window.Bind("hashchange", delegate(jQueryEvent e) { - string tags = (string)jQueryHistory.GetState("tags"); - if (tags != _currentTags) { - ShowPhotos(tags); - } - }); - - jQuery.Select("#searchButton").Bind("click", delegate(jQueryEvent e) { - string tags = jQuery.Select("#tagsTextBox").GetValue(); - ShowPhotos(tags); - }); - } - - private static void ShowPhotos(string tags) { - if (String.IsNullOrEmpty(tags)) { - return; - } - - _currentTags = tags; - GalleryPluginOptions options = - new GalleryPluginOptions("tags", tags, - "thumbsListID", "thumbsList", - "photoPanelID", "photoPanel", - "thumbnailTemplateID", "thumbnailTemplate", - "photoTemplateID", "photoTemplate"); - - jQuery.Select("#gallery").Plugin().Gallery(options); - jQueryHistory.PushState(new Dictionary("tags", tags)); - } - } -} diff --git a/samples/PhotoDemo/Gallery/Properties/AssemblyInfo.cs b/samples/PhotoDemo/Gallery/Properties/AssemblyInfo.cs deleted file mode 100644 index f4f5c1d49..000000000 --- a/samples/PhotoDemo/Gallery/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Gallery")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Gallery")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: ScriptAssembly("Gallery")] diff --git a/samples/PhotoDemo/Gallery/Properties/Gallery.ruleset b/samples/PhotoDemo/Gallery/Properties/Gallery.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/PhotoDemo/Gallery/Properties/Gallery.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Gallery/Properties/Gallery.script b/samples/PhotoDemo/Gallery/Properties/Gallery.script deleted file mode 100644 index 888eadd9c..000000000 --- a/samples/PhotoDemo/Gallery/Properties/Gallery.script +++ /dev/null @@ -1,6 +0,0 @@ -//! #= ScriptFile ## -// - -(function($) { -#include[as-is] "%code%" -})(jQuery); diff --git a/samples/PhotoDemo/Gallery/Tests/GalleryPluginTests.cs b/samples/PhotoDemo/Gallery/Tests/GalleryPluginTests.cs deleted file mode 100644 index 37ee62b39..000000000 --- a/samples/PhotoDemo/Gallery/Tests/GalleryPluginTests.cs +++ /dev/null @@ -1,46 +0,0 @@ -// ListBuilderTests.cs -// - -using System; -using System.Collections; -using System.Diagnostics.CodeAnalysis; -using System.Html; -using System.Testing; -using jQueryApi; -using Flickr; -using Gallery; - -namespace Gallery.Tests { - - [SuppressMessage("Microsoft.Performance", "CA1812", - Justification = "Tests don't have internal consumers. They're only compiled into .test.js scripts.")] - internal sealed class GalleryPluginTests : TestClass { - - private jQueryObject _thumbsList; - - public override void Setup() { - _thumbsList = jQuery.FromHtml("
      "); - _thumbsList.AppendTo(Document.Body); - } - - public override void Cleanup() { - _thumbsList.Remove(); - _thumbsList = null; - } - - public void TestEmptyCollection() { - Assert.ExpectAsserts(1); - - GalleryPluginOptions options = new GalleryPluginOptions("thumbsListID", "thumbsList"); - options.photoService = new MockPhotoService(null); - - TestEngine.WaitForAsyncCompletion(); - - jQuery.FromElement(Document.Body).Plugin().Gallery(options); - - Assert.AreEqual(_thumbsList.GetHtml().Trim().Length, 0, "Expected html to be empty for null photos array."); - - TestEngine.ResumeOnAsyncCompleted(); - } - } -} diff --git a/samples/PhotoDemo/Gallery/Tests/MockPhotoService.cs b/samples/PhotoDemo/Gallery/Tests/MockPhotoService.cs deleted file mode 100644 index f0a58df53..000000000 --- a/samples/PhotoDemo/Gallery/Tests/MockPhotoService.cs +++ /dev/null @@ -1,27 +0,0 @@ -// MockPhotoService.cs -// - -using System; -using System.Collections; -using System.Diagnostics.CodeAnalysis; -using System.Html; -using System.Testing; -using Flickr; - -namespace Gallery.Tests { - - public sealed class MockPhotoService : IPhotoService { - - private Photo[] _photos; - - public MockPhotoService(Photo[] photos) { - _photos = photos; - } - - public void SearchPhotos(string tags, int count, FlickrSearchCallback callback) { - Window.SetTimeout(delegate() { - callback(_photos); - }, 0); - } - } -} diff --git a/samples/PhotoDemo/GalleryTests/GalleryPluginTests.cs b/samples/PhotoDemo/GalleryTests/GalleryPluginTests.cs deleted file mode 100644 index 24f6b6c22..000000000 --- a/samples/PhotoDemo/GalleryTests/GalleryPluginTests.cs +++ /dev/null @@ -1,54 +0,0 @@ -// GalleryPluginTests.cs -// - -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using ScriptSharp.Testing; - -namespace GalleryTests { - - [TestClass] - [DeploymentItem("GalleryTests\\Web", "Web")] - [DeploymentItem("Gallery\\bin\\debug\\mscorlib.js", "Web")] - [DeploymentItem("Gallery\\bin\\debug\\Flickr.js", "Web")] - [DeploymentItem("Gallery\\bin\\debug\\Gallery.test.js", "Web")] - public class GalleryPluginTests { - - private static WebTest _webTest; - - public TestContext TestContext { - get; - set; - } - - [ClassInitialize()] - public static void OnInitialize(TestContext testContext) { - // This starts the web server rooted at the specified directory - // on http://localhost: - - string webRoot = Path.Combine(testContext.DeploymentDirectory, "Web"); - int port = 3976; - - _webTest = new WebTest(); - _webTest.StartWebServer(webRoot, port); - } - - [ClassCleanup()] - public static void OnCleanup() { - _webTest.StopWebServer(); - } - - [TestMethod] - public void TestGallery() { - Uri testUri = _webTest.GetTestUri("/Gallery.htm"); - - WebTestResult chromeResult = _webTest.RunTest(testUri, WebBrowser.Chrome); - Assert.IsTrue(chromeResult.Succeeded, "Chrome:\r\n" + chromeResult.Log); - - WebTestResult ffResult = _webTest.RunTest(testUri, WebBrowser.Firefox); - Assert.IsTrue(ffResult.Succeeded, "Firefox:\r\n" + ffResult.Log); - } - } -} diff --git a/samples/PhotoDemo/GalleryTests/GalleryTests.csproj b/samples/PhotoDemo/GalleryTests/GalleryTests.csproj deleted file mode 100644 index b5d18e456..000000000 --- a/samples/PhotoDemo/GalleryTests/GalleryTests.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 9.0.0 - 2.0 - {E47A38F5-8EBD-438F-AA58-DE475354222B} - Library - Properties - GalleryTests - GalleryTests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/GalleryTests/Properties/AssemblyInfo.cs b/samples/PhotoDemo/GalleryTests/Properties/AssemblyInfo.cs deleted file mode 100644 index f3810772f..000000000 --- a/samples/PhotoDemo/GalleryTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GalleryTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("GalleryTests")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/PhotoDemo/GalleryTests/Web/Gallery.htm b/samples/PhotoDemo/GalleryTests/Web/Gallery.htm deleted file mode 100644 index 4f532d498..000000000 --- a/samples/PhotoDemo/GalleryTests/Web/Gallery.htm +++ /dev/null @@ -1,21 +0,0 @@ - - - - GalleryTests - ListBuilder - - - - - - - - - -

      GalleryTests - UnitTest1 Results

      -

      -

      -
        -
        - - - diff --git a/samples/PhotoDemo/GalleryTests/Web/QUnitExt.js b/samples/PhotoDemo/GalleryTests/Web/QUnitExt.js deleted file mode 100644 index da2a82429..000000000 --- a/samples/PhotoDemo/GalleryTests/Web/QUnitExt.js +++ /dev/null @@ -1,49 +0,0 @@ -(function() { - var currentModule = null; - var logData = ''; - - function appendLog(logText) { - logData = logData + logText + '\r\n'; - - var logHolder = document.getElementById('qunit-log'); - if (logHolder) { - logHolder.value = logData; - } - } - - QUnit.log = function(result, message) { - if (arguments.length === 1) { - message = arguments[0]; - } - appendLog(' ' + message); - } - - QUnit.done = function(failures, total) { - appendLog('\r\nCompleted; ' + 'failures = ' + failures + '; total = ' + total); - - var logUrl = '/Log.axd/' + ((failures === 0) ? 'Success' : 'Failure'); - var xhr = new XMLHttpRequest(); - xhr.open('POST', logUrl, /* async */ false); - xhr.send(logData); - } - - QUnit.testStart = function(name) { - appendLog(' Test Started: ' + name); - } - - QUnit.testDone = function(name, failures, total) { - appendLog(' Test Done: ' + name + '; failures = ' + failures + '; total = ' + total); - } - - QUnit.moduleStart = function(name, testEnv) { - currentModule = name; - appendLog('Module Started: ' + name); - } - - QUnit.moduleDone = function(name, failures, total) { - if (name === currentModule) { - appendLog('Module Done: ' + name + '; failures = ' + failures + '; total = ' + total + '\r\n'); - } - currentModule = null; - } -})(); diff --git a/samples/PhotoDemo/Interestingness/Content/Core.css b/samples/PhotoDemo/Interestingness/Content/Core.css deleted file mode 100644 index 63994f4ed..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Core.css +++ /dev/null @@ -1,4 +0,0 @@ -body, html { - margin: 0px; - padding: 0px; -} diff --git a/samples/PhotoDemo/Interestingness/Content/Flyout.css b/samples/PhotoDemo/Interestingness/Content/Flyout.css deleted file mode 100644 index 4f7b3fe4d..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Flyout.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - background-color: black; - width: 600px; - height: 400px; - overflow: visible; -} diff --git a/samples/PhotoDemo/Interestingness/Content/Flyout.htm b/samples/PhotoDemo/Interestingness/Content/Flyout.htm deleted file mode 100644 index d035d5e15..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Flyout.htm +++ /dev/null @@ -1,11 +0,0 @@ - - - - Photo - - - - - - - diff --git a/samples/PhotoDemo/Interestingness/Content/Gadget.css b/samples/PhotoDemo/Interestingness/Content/Gadget.css deleted file mode 100644 index 33da9e4ea..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Gadget.css +++ /dev/null @@ -1,5 +0,0 @@ -body { - background-color: Black; - width: 79px; - height: 79px; -} diff --git a/samples/PhotoDemo/Interestingness/Content/Gadget.htm b/samples/PhotoDemo/Interestingness/Content/Gadget.htm deleted file mode 100644 index 780cb77bc..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Gadget.htm +++ /dev/null @@ -1,18 +0,0 @@ - - - - Interestingness - - - - - - - - - - - - diff --git a/samples/PhotoDemo/Interestingness/Content/Gadget.png b/samples/PhotoDemo/Interestingness/Content/Gadget.png deleted file mode 100644 index cd1d40fef..000000000 Binary files a/samples/PhotoDemo/Interestingness/Content/Gadget.png and /dev/null differ diff --git a/samples/PhotoDemo/Interestingness/Content/Gadget.xml b/samples/PhotoDemo/Interestingness/Content/Gadget.xml deleted file mode 100644 index 99b2805d8..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Gadget.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - Interestingness - Interestingness - 1.0.0.0 - - - - - Copyright (c) 2007 - A look at what is interesting on Flickr! - - - - - - - Full - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Interestingness/Content/GadgetIcon.png b/samples/PhotoDemo/Interestingness/Content/GadgetIcon.png deleted file mode 100644 index cd1d40fef..000000000 Binary files a/samples/PhotoDemo/Interestingness/Content/GadgetIcon.png and /dev/null differ diff --git a/samples/PhotoDemo/Interestingness/Content/Logo.png b/samples/PhotoDemo/Interestingness/Content/Logo.png deleted file mode 100644 index 60dd1cf20..000000000 Binary files a/samples/PhotoDemo/Interestingness/Content/Logo.png and /dev/null differ diff --git a/samples/PhotoDemo/Interestingness/Content/Settings.css b/samples/PhotoDemo/Interestingness/Content/Settings.css deleted file mode 100644 index 4570ca9c6..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Settings.css +++ /dev/null @@ -1,4 +0,0 @@ -body { - width: 200px; - height: 100px; -} diff --git a/samples/PhotoDemo/Interestingness/Content/Settings.htm b/samples/PhotoDemo/Interestingness/Content/Settings.htm deleted file mode 100644 index 8c3699855..000000000 --- a/samples/PhotoDemo/Interestingness/Content/Settings.htm +++ /dev/null @@ -1,19 +0,0 @@ - - - - Gadget Settings - - - - -
        -
        - - - - - - - diff --git a/samples/PhotoDemo/Interestingness/GadgetScriptlet.cs b/samples/PhotoDemo/Interestingness/GadgetScriptlet.cs deleted file mode 100644 index 912861b0d..000000000 --- a/samples/PhotoDemo/Interestingness/GadgetScriptlet.cs +++ /dev/null @@ -1,112 +0,0 @@ -// GadgetScriptlet.cs -// - -using System; -using System.Collections; -using System.Html; -using System.Gadgets; -using Flickr; -using System.Diagnostics; - -namespace Interestingness { - - public class GadgetScriptlet { - - private Gallery _gallery; - - private int _timerID; - private bool _flyoutVisible; - - private GadgetScriptlet() { - Type.SetField(Gadget.Document.ParentWindow, "Scriptlet", this); - - Gadget.OnDock = OnDock; - Gadget.OnUndock = OnUndock; - - Gadget.Flyout.File = "Flyout.htm"; - Gadget.Flyout.OnShow = OnFlyoutShow; - Gadget.Flyout.OnHide = OnFlyoutHide; - - UpdateDockedState(); - - Gadget.SettingsUI = "Settings.htm"; - - _gallery = new Gallery(); - _gallery.PhotoChanged += OnGalleryPhotoChanged; - - _timerID = Window.SetInterval(OnTimer, 4000); - Script.Literal("{0}.attachEvent('onclick', {1})", Gadget.Document.Body, (Action)OnThumbnailClick); - } - - public static GadgetScriptlet Current { - get { - return (GadgetScriptlet)Type.GetField(Gadget.Document.ParentWindow, "Scriptlet"); - } - } - - public Gallery Gallery { - get { - return _gallery; - } - } - - public static void Main(Dictionary arguments) { - GadgetScriptlet scriptlet = new GadgetScriptlet(); - } - - private void OnDock() { - UpdateDockedState(); - } - - private void OnFlyoutHide() { - _flyoutVisible = false; - } - - private void OnFlyoutShow() { - _flyoutVisible = true; - - Photo selectedPhoto = _gallery.SelectedPhoto; - int width = Number.ParseInt(selectedPhoto.width_m); - int height = Number.ParseInt(selectedPhoto.height_m); - - DocumentInstance flyoutDocument = Gadget.Flyout.Document; - flyoutDocument.Body.Style.Width = (width + 8) + "px"; - flyoutDocument.Body.Style.Height = (height + 8) + "px"; - - ImageElement photoImage = (ImageElement)flyoutDocument.GetElementById("photoImage"); - photoImage.Width = width; - photoImage.Height = height; - photoImage.Src = selectedPhoto.url_m; - } - - private void OnGalleryPhotoChanged(object sender, EventArgs e) { - Photo photo = _gallery.SelectedPhoto; - if (photo != null) { - ImageElement thumbnail = (ImageElement)Gadget.Document.GetElementById("thumbnail"); - thumbnail.Src = photo.url_sq; - thumbnail.Title = photo.title; - } - } - - private void OnTimer() { - if (_flyoutVisible) { - return; - } - _gallery.NextPhoto(); - } - - private void OnThumbnailClick() { - if (_gallery.SelectedPhoto != null) { - Gadget.Flyout.Show = true; - } - } - - private void OnUndock() { - UpdateDockedState(); - } - - private void UpdateDockedState() { - Gadget.Document.Body.ClassName = Gadget.Docked ? "docked" : "undocked"; - } - } -} diff --git a/samples/PhotoDemo/Interestingness/Gallery.cs b/samples/PhotoDemo/Interestingness/Gallery.cs deleted file mode 100644 index 8be1493dc..000000000 --- a/samples/PhotoDemo/Interestingness/Gallery.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Gallery.cs -// - -using System; -using System.Collections; -using Flickr; -using System.Diagnostics; - -namespace Interestingness { - - public class Gallery { - - private string _tags; - private Photo[] _photos; - private int _selectedIndex; - - public Gallery() { - _tags = "Seattle"; - _selectedIndex = -1; - - UpdatePhotos(); - } - - public Photo[] Photos { - get { - return _photos; - } - } - - public Photo SelectedPhoto { - get { - if ((_photos == null) || (_selectedIndex > _photos.Length - 1)) { - return null; - } - return _photos[_selectedIndex]; - } - } - - public string Tags { - get { - return _tags; - } - set { - _tags = value; - UpdatePhotos(); - } - } - - public event EventHandler PhotoChanged; - - public void NextPhoto() { - if ((_photos == null) || (_photos.Length == 0)) { - return; - } - - _selectedIndex++; - if (_selectedIndex >= _photos.Length) { - _selectedIndex = 0; - } - - RaisePhotoChanged(); - } - - private void RaisePhotoChanged() { - if (PhotoChanged != null) { - PhotoChanged(this, EventArgs.Empty); - } - } - - private void UpdatePhotos() { - FlickrService flickr = new FlickrService(); - flickr.SearchPhotos(_tags, 10, delegate(Photo[] photos) { - if ((photos == null) || (photos.Length == 0)) { - return; - } - - _photos = photos; - _selectedIndex = 0; - - RaisePhotoChanged(); - }); - } - } -} diff --git a/samples/PhotoDemo/Interestingness/Interestingness.csproj b/samples/PhotoDemo/Interestingness/Interestingness.csproj deleted file mode 100644 index ef85d3704..000000000 --- a/samples/PhotoDemo/Interestingness/Interestingness.csproj +++ /dev/null @@ -1,76 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {4D8373CD-6685-4288-A1FF-1E37319D60D4} - Library - Properties - Interestingness - Interestingness - True - v4.0 - - ISO-2 - Properties\Interestingness.script - Properties\Interestingness.ruleset - Content\ - true - true - - - true - pdbonly - bin\Debug\ - DEBUG;CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Debug\Interestingness.xml - - - true - pdbonly - bin\Release\ - CODE_ANALYSIS - prompt - 4 - 0028, 1591, 1684 - bin\Release\Interestingness.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5F2605F7-5F00-4756-AC61-1D83B0E541E4} - Flickr - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Interestingness/Properties/AssemblyInfo.cs b/samples/PhotoDemo/Interestingness/Properties/AssemblyInfo.cs deleted file mode 100644 index c039406aa..000000000 --- a/samples/PhotoDemo/Interestingness/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// AssemblyInfo.cs -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Interestingness")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Interestingness")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: ScriptAssembly("Interestingness")] diff --git a/samples/PhotoDemo/Interestingness/Properties/Interestingness.ruleset b/samples/PhotoDemo/Interestingness/Properties/Interestingness.ruleset deleted file mode 100644 index 5e264d42f..000000000 --- a/samples/PhotoDemo/Interestingness/Properties/Interestingness.ruleset +++ /dev/null @@ -1,107 +0,0 @@ - - - - %ProgramFiles%\ScriptSharp\v1.0\CodeAnalysis - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/PhotoDemo/Interestingness/Properties/Interestingness.script b/samples/PhotoDemo/Interestingness/Properties/Interestingness.script deleted file mode 100644 index 1178aae74..000000000 --- a/samples/PhotoDemo/Interestingness/Properties/Interestingness.script +++ /dev/null @@ -1,44 +0,0 @@ -// Interestingness.js -// - -(function() { - function __createNativeAPI(api) { - try { - return new ActiveXObject(api); - } - catch (ex) { - } - return null; - } - - function Shell() { - return __createNativeAPI('WScript.Shell'); - } - - function FileSystemObject() { - return __createNativeAPI('Scripting.FileSystemObject'); - } - - function FeedsManager() { - return __createNativeAPI('Microsoft.FeedsManager'); - } - - ss.Debug.assert = function(condition, message) { - if (!condition) { - message = message + '\r\n\r\nBreak into debugger?'; - - var shell = new Shell(); - if (shell.Popup(message, 0, 'Assert Failed', 20) == 6) { - ss.Debug._fail(message); - } - } - }; - - ss.Debug.writeln = function(message) { - System.Debug.outputString(message + '\r\n'); - } - -#include[as-is] "%code%" -})(); - -//! This script was generated using Script# v#= CompilerVersion ## diff --git a/samples/PhotoDemo/Interestingness/SettingsScriptlet.cs b/samples/PhotoDemo/Interestingness/SettingsScriptlet.cs deleted file mode 100644 index 92f913c9c..000000000 --- a/samples/PhotoDemo/Interestingness/SettingsScriptlet.cs +++ /dev/null @@ -1,36 +0,0 @@ -// SettingsScriptlet.cs -// - -using System; -using System.Collections; -using System.Html; -using System.Gadgets; - -namespace Interestingness { - - public class SettingsScriptlet { - - private SettingsScriptlet() { - Gadget.OnSettingsClosing = OnClosing; - - TextElement tagsTextBox = (TextElement)Document.GetElementById("tagsTextBox"); - tagsTextBox.Value = GadgetScriptlet.Current.Gallery.Tags; - } - - public static void Main(Dictionary arguments) { - SettingsScriptlet scriptlet = new SettingsScriptlet(); - } - - private void OnClosing(GadgetSettingsEvent e) { - TextElement tagsTextBox = (TextElement)Document.GetElementById("tagsTextBox"); - - if (e.CloseAction == e.Action.Commit) { - Gallery gallery = GadgetScriptlet.Current.Gallery; - gallery.Tags = tagsTextBox.Value; - } - - Gadget.OnSettingsClosing = null; - e.Cancel = false; - } - } -} diff --git a/samples/PhotoDemo/PhotoDemo.sln b/samples/PhotoDemo/PhotoDemo.sln deleted file mode 100644 index d576718f1..000000000 --- a/samples/PhotoDemo/PhotoDemo.sln +++ /dev/null @@ -1,44 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoWeb", "PhotoWeb\PhotoWeb.csproj", "{C8DE7DBA-DA86-4315-A48A-50BEC9DDFCA7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flickr", "Flickr\Flickr.csproj", "{5F2605F7-5F00-4756-AC61-1D83B0E541E4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallery", "Gallery\Gallery.csproj", "{16B291CB-4AC1-41B9-943C-341FB528D7A1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interestingness", "Interestingness\Interestingness.csproj", "{4D8373CD-6685-4288-A1FF-1E37319D60D4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GalleryTests", "GalleryTests\GalleryTests.csproj", "{E47A38F5-8EBD-438F-AA58-DE475354222B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C8DE7DBA-DA86-4315-A48A-50BEC9DDFCA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C8DE7DBA-DA86-4315-A48A-50BEC9DDFCA7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C8DE7DBA-DA86-4315-A48A-50BEC9DDFCA7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C8DE7DBA-DA86-4315-A48A-50BEC9DDFCA7}.Release|Any CPU.Build.0 = Release|Any CPU - {5F2605F7-5F00-4756-AC61-1D83B0E541E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F2605F7-5F00-4756-AC61-1D83B0E541E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F2605F7-5F00-4756-AC61-1D83B0E541E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F2605F7-5F00-4756-AC61-1D83B0E541E4}.Release|Any CPU.Build.0 = Release|Any CPU - {16B291CB-4AC1-41B9-943C-341FB528D7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {16B291CB-4AC1-41B9-943C-341FB528D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {16B291CB-4AC1-41B9-943C-341FB528D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {16B291CB-4AC1-41B9-943C-341FB528D7A1}.Release|Any CPU.Build.0 = Release|Any CPU - {4D8373CD-6685-4288-A1FF-1E37319D60D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D8373CD-6685-4288-A1FF-1E37319D60D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D8373CD-6685-4288-A1FF-1E37319D60D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4D8373CD-6685-4288-A1FF-1E37319D60D4}.Release|Any CPU.Build.0 = Release|Any CPU - {E47A38F5-8EBD-438F-AA58-DE475354222B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E47A38F5-8EBD-438F-AA58-DE475354222B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E47A38F5-8EBD-438F-AA58-DE475354222B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E47A38F5-8EBD-438F-AA58-DE475354222B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/PhotoDemo/PhotoWeb/Content/Scripts/jquery.bbq.js b/samples/PhotoDemo/PhotoWeb/Content/Scripts/jquery.bbq.js deleted file mode 100644 index f251123ac..000000000 --- a/samples/PhotoDemo/PhotoWeb/Content/Scripts/jquery.bbq.js +++ /dev/null @@ -1,1137 +0,0 @@ -/*! - * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 - * http://benalman.com/projects/jquery-bbq-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ - -// Script: jQuery BBQ: Back Button & Query Library -// -// *Version: 1.2.1, Last updated: 2/17/2010* -// -// Project Home - http://benalman.com/projects/jquery-bbq-plugin/ -// GitHub - http://github.com/cowboy/jquery-bbq/ -// Source - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js -// (Minified) - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js (4.0kb) -// -// About: License -// -// Copyright (c) 2010 "Cowboy" Ben Alman, -// Dual licensed under the MIT and GPL licenses. -// http://benalman.com/about/license/ -// -// About: Examples -// -// These working examples, complete with fully commented code, illustrate a few -// ways in which this plugin can be used. -// -// Basic AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/ -// Advanced AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/ -// jQuery UI Tabs - http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/ -// Deparam - http://benalman.com/code/projects/jquery-bbq/examples/deparam/ -// -// About: Support and Testing -// -// Information about what version or versions of jQuery this plugin has been -// tested with, what browsers it has been tested in, and where the unit tests -// reside (so you can test it yourself). -// -// jQuery Versions - 1.3.2, 1.4.1, 1.4.2 -// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, -// Chrome 4-5, Opera 9.6-10.1. -// Unit Tests - http://benalman.com/code/projects/jquery-bbq/unit/ -// -// About: Release History -// -// 1.2.1 - (2/17/2010) Actually fixed the stale window.location Safari bug from -// in BBQ, which was the main reason for the -// previous release! -// 1.2 - (2/16/2010) Integrated v1.2, which fixes a -// Safari bug, the event can now be bound before DOM ready, and IE6/7 -// page should no longer scroll when the event is first bound. Also -// added the method, and reworked the -// internal "add" method to be compatible with -// changes made to the jQuery 1.4.2 special events API. -// 1.1.1 - (1/22/2010) Integrated v1.1, which fixes an -// obscure IE8 EmulateIE7 meta tag compatibility mode bug. -// 1.1 - (1/9/2010) Broke out the jQuery BBQ event.special -// functionality into a separate plugin for users who want just the -// basic event & back button support, without all the extra awesomeness -// that BBQ provides. This plugin will be included as part of jQuery BBQ, -// but also be available separately. See -// plugin for more information. Also added the -// method and added additional examples. -// 1.0.3 - (12/2/2009) Fixed an issue in IE 6 where location.search and -// location.hash would report incorrectly if the hash contained the ? -// character. Also and -// will no longer parse params out of a URL that doesn't contain ? or #, -// respectively. -// 1.0.2 - (10/10/2009) Fixed an issue in IE 6/7 where the hidden IFRAME caused -// a "This page contains both secure and nonsecure items." warning when -// used on an https:// page. -// 1.0.1 - (10/7/2009) Fixed an issue in IE 8. Since both "IE7" and "IE8 -// Compatibility View" modes erroneously report that the browser -// supports the native window.onhashchange event, a slightly more -// robust test needed to be added. -// 1.0 - (10/2/2009) Initial release - -(function($,window){ - '$:nomunge'; // Used by YUI compressor. - - // Some convenient shortcuts. - var undefined, - aps = Array.prototype.slice, - decode = decodeURIComponent, - - // Method / object references. - jq_param = $.param, - jq_param_fragment, - jq_deparam, - jq_deparam_fragment, - jq_bbq = $.bbq = $.bbq || {}, - jq_bbq_pushState, - jq_bbq_getState, - jq_elemUrlAttr, - jq_event_special = $.event.special, - - // Reused strings. - str_hashchange = 'hashchange', - str_querystring = 'querystring', - str_fragment = 'fragment', - str_elemUrlAttr = 'elemUrlAttr', - str_location = 'location', - str_href = 'href', - str_src = 'src', - - // Reused RegExp. - re_trim_querystring = /^.*\?|#.*$/g, - re_trim_fragment = /^.*\#/, - re_no_escape, - - // Used by jQuery.elemUrlAttr. - elemUrlAttr_cache = {}; - - // A few commonly used bits, broken out to help reduce minified file size. - - function is_string( arg ) { - return typeof arg === 'string'; - }; - - // Why write the same function twice? Let's curry! Mmmm, curry.. - - function curry( func ) { - var args = aps.call( arguments, 1 ); - - return function() { - return func.apply( this, args.concat( aps.call( arguments ) ) ); - }; - }; - - // Get location.hash (or what you'd expect location.hash to be) sans any - // leading #. Thanks for making this necessary, Firefox! - function get_fragment( url ) { - return url.replace( /^[^#]*#?(.*)$/, '$1' ); - }; - - // Get location.search (or what you'd expect location.search to be) sans any - // leading #. Thanks for making this necessary, IE6! - function get_querystring( url ) { - return url.replace( /(?:^[^?#]*\?([^#]*).*$)?.*/, '$1' ); - }; - - // Section: Param (to string) - // - // Method: jQuery.param.querystring - // - // Retrieve the query string from a URL or if no arguments are passed, the - // current window.location. - // - // Usage: - // - // > jQuery.param.querystring( [ url ] ); - // - // Arguments: - // - // url - (String) A URL containing query string params to be parsed. If url - // is not passed, the current window.location is used. - // - // Returns: - // - // (String) The parsed query string, with any leading "?" removed. - // - - // Method: jQuery.param.querystring (build url) - // - // Merge a URL, with or without pre-existing query string params, plus any - // object, params string or URL containing query string params into a new URL. - // - // Usage: - // - // > jQuery.param.querystring( url, params [, merge_mode ] ); - // - // Arguments: - // - // url - (String) A valid URL for params to be merged into. This URL may - // contain a query string and/or fragment (hash). - // params - (String) A params string or URL containing query string params to - // be merged into url. - // params - (Object) A params object to be merged into url. - // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not - // specified, and is as-follows: - // - // * 0: params in the params argument will override any query string - // params in url. - // * 1: any query string params in url will override params in the params - // argument. - // * 2: params argument will completely replace any query string in url. - // - // Returns: - // - // (String) Either a params string with urlencoded data or a URL with a - // urlencoded query string in the format 'a=b&c=d&e=f'. - - // Method: jQuery.param.fragment - // - // Retrieve the fragment (hash) from a URL or if no arguments are passed, the - // current window.location. - // - // Usage: - // - // > jQuery.param.fragment( [ url ] ); - // - // Arguments: - // - // url - (String) A URL containing fragment (hash) params to be parsed. If - // url is not passed, the current window.location is used. - // - // Returns: - // - // (String) The parsed fragment (hash) string, with any leading "#" removed. - - // Method: jQuery.param.fragment (build url) - // - // Merge a URL, with or without pre-existing fragment (hash) params, plus any - // object, params string or URL containing fragment (hash) params into a new - // URL. - // - // Usage: - // - // > jQuery.param.fragment( url, params [, merge_mode ] ); - // - // Arguments: - // - // url - (String) A valid URL for params to be merged into. This URL may - // contain a query string and/or fragment (hash). - // params - (String) A params string or URL containing fragment (hash) params - // to be merged into url. - // params - (Object) A params object to be merged into url. - // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not - // specified, and is as-follows: - // - // * 0: params in the params argument will override any fragment (hash) - // params in url. - // * 1: any fragment (hash) params in url will override params in the - // params argument. - // * 2: params argument will completely replace any query string in url. - // - // Returns: - // - // (String) Either a params string with urlencoded data or a URL with a - // urlencoded fragment (hash) in the format 'a=b&c=d&e=f'. - - function jq_param_sub( is_fragment, get_func, url, params, merge_mode ) { - var result, - qs, - matches, - url_params, - hash; - - if ( params !== undefined ) { - // Build URL by merging params into url string. - - // matches[1] = url part that precedes params, not including trailing ?/# - // matches[2] = params, not including leading ?/# - // matches[3] = if in 'querystring' mode, hash including leading #, otherwise '' - matches = url.match( is_fragment ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ ); - - // Get the hash if in 'querystring' mode, and it exists. - hash = matches[3] || ''; - - if ( merge_mode === 2 && is_string( params ) ) { - // If merge_mode is 2 and params is a string, merge the fragment / query - // string into the URL wholesale, without converting it into an object. - qs = params.replace( is_fragment ? re_trim_fragment : re_trim_querystring, '' ); - - } else { - // Convert relevant params in url to object. - url_params = jq_deparam( matches[2] ); - - params = is_string( params ) - - // Convert passed params string into object. - ? jq_deparam[ is_fragment ? str_fragment : str_querystring ]( params ) - - // Passed params object. - : params; - - qs = merge_mode === 2 ? params // passed params replace url params - : merge_mode === 1 ? $.extend( {}, params, url_params ) // url params override passed params - : $.extend( {}, url_params, params ); // passed params override url params - - // Convert params object to a string. - qs = jq_param( qs ); - - // Unescape characters specified via $.param.noEscape. Since only hash- - // history users have requested this feature, it's only enabled for - // fragment-related params strings. - if ( is_fragment ) { - qs = qs.replace( re_no_escape, decode ); - } - } - - // Build URL from the base url, querystring and hash. In 'querystring' - // mode, ? is only added if a query string exists. In 'fragment' mode, # - // is always added. - result = matches[1] + ( is_fragment ? '#' : qs || !matches[1] ? '?' : '' ) + qs + hash; - - } else { - // If URL was passed in, parse params from URL string, otherwise parse - // params from window.location. - result = get_func( url !== undefined ? url : window[ str_location ][ str_href ] ); - } - - return result; - }; - - jq_param[ str_querystring ] = curry( jq_param_sub, 0, get_querystring ); - jq_param[ str_fragment ] = jq_param_fragment = curry( jq_param_sub, 1, get_fragment ); - - // Method: jQuery.param.fragment.noEscape - // - // Specify characters that will be left unescaped when fragments are created - // or merged using , or when the fragment is modified - // using . This option only applies to serialized data - // object fragments, and not set-as-string fragments. Does not affect the - // query string. Defaults to ",/" (comma, forward slash). - // - // Note that this is considered a purely aesthetic option, and will help to - // create URLs that "look pretty" in the address bar or bookmarks, without - // affecting functionality in any way. That being said, be careful to not - // unescape characters that are used as delimiters or serve a special - // purpose, such as the "#?&=+" (octothorpe, question mark, ampersand, - // equals, plus) characters. - // - // Usage: - // - // > jQuery.param.fragment.noEscape( [ chars ] ); - // - // Arguments: - // - // chars - (String) The characters to not escape in the fragment. If - // unspecified, defaults to empty string (escape all characters). - // - // Returns: - // - // Nothing. - - jq_param_fragment.noEscape = function( chars ) { - chars = chars || ''; - var arr = $.map( chars.split(''), encodeURIComponent ); - re_no_escape = new RegExp( arr.join('|'), 'g' ); - }; - - // A sensible default. These are the characters people seem to complain about - // "uglifying up the URL" the most. - jq_param_fragment.noEscape( ',/' ); - - // Section: Deparam (from string) - // - // Method: jQuery.deparam - // - // Deserialize a params string into an object, optionally coercing numbers, - // booleans, null and undefined values; this method is the counterpart to the - // internal jQuery.param method. - // - // Usage: - // - // > jQuery.deparam( params [, coerce ] ); - // - // Arguments: - // - // params - (String) A params string to be parsed. - // coerce - (Boolean) If true, coerces any numbers or true, false, null, and - // undefined to their actual value. Defaults to false if omitted. - // - // Returns: - // - // (Object) An object representing the deserialized params string. - - $.deparam = jq_deparam = function( params, coerce ) { - var obj = {}, - coerce_types = { 'true': !0, 'false': !1, 'null': null }; - - // Iterate over all name=value pairs. - $.each( params.replace( /\+/g, ' ' ).split( '&' ), function(j,v){ - var param = v.split( '=' ), - key = decode( param[0] ), - val, - cur = obj, - i = 0, - - // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it - // into its component parts. - keys = key.split( '][' ), - keys_last = keys.length - 1; - - // If the first keys part contains [ and the last ends with ], then [] - // are correctly balanced. - if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) { - // Remove the trailing ] from the last keys part. - keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, '' ); - - // Split first keys part into two parts on the [ and add them back onto - // the beginning of the keys array. - keys = keys.shift().split('[').concat( keys ); - - keys_last = keys.length - 1; - } else { - // Basic 'foo' style key. - keys_last = 0; - } - - // Are we dealing with a name=value pair, or just a name? - if ( param.length === 2 ) { - val = decode( param[1] ); - - // Coerce values. - if ( coerce ) { - val = val && !isNaN(val) ? +val // number - : val === 'undefined' ? undefined // undefined - : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null - : val; // string - } - - if ( keys_last ) { - // Complex key, build deep object structure based on a few rules: - // * The 'cur' pointer starts at the object top-level. - // * [] = array push (n is set to array length), [n] = array if n is - // numeric, otherwise object. - // * If at the last keys part, set the value. - // * For each keys part, if the current level is undefined create an - // object or array based on the type of the next keys part. - // * Move the 'cur' pointer to the next level. - // * Rinse & repeat. - for ( ; i <= keys_last; i++ ) { - key = keys[i] === '' ? cur.length : keys[i]; - cur = cur[key] = i < keys_last - ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] ) - : val; - } - - } else { - // Simple key, even simpler rules, since only scalars and shallow - // arrays are allowed. - - if ( $.isArray( obj[key] ) ) { - // val is already an array, so push on the next value. - obj[key].push( val ); - - } else if ( obj[key] !== undefined ) { - // val isn't an array, but since a second value has been specified, - // convert val into an array. - obj[key] = [ obj[key], val ]; - - } else { - // val is a scalar. - obj[key] = val; - } - } - - } else if ( key ) { - // No value was defined, so set something meaningful. - obj[key] = coerce - ? undefined - : ''; - } - }); - - return obj; - }; - - // Method: jQuery.deparam.querystring - // - // Parse the query string from a URL or the current window.location, - // deserializing it into an object, optionally coercing numbers, booleans, - // null and undefined values. - // - // Usage: - // - // > jQuery.deparam.querystring( [ url ] [, coerce ] ); - // - // Arguments: - // - // url - (String) An optional params string or URL containing query string - // params to be parsed. If url is omitted, the current window.location - // is used. - // coerce - (Boolean) If true, coerces any numbers or true, false, null, and - // undefined to their actual value. Defaults to false if omitted. - // - // Returns: - // - // (Object) An object representing the deserialized params string. - - // Method: jQuery.deparam.fragment - // - // Parse the fragment (hash) from a URL or the current window.location, - // deserializing it into an object, optionally coercing numbers, booleans, - // null and undefined values. - // - // Usage: - // - // > jQuery.deparam.fragment( [ url ] [, coerce ] ); - // - // Arguments: - // - // url - (String) An optional params string or URL containing fragment (hash) - // params to be parsed. If url is omitted, the current window.location - // is used. - // coerce - (Boolean) If true, coerces any numbers or true, false, null, and - // undefined to their actual value. Defaults to false if omitted. - // - // Returns: - // - // (Object) An object representing the deserialized params string. - - function jq_deparam_sub( is_fragment, url_or_params, coerce ) { - if ( url_or_params === undefined || typeof url_or_params === 'boolean' ) { - // url_or_params not specified. - coerce = url_or_params; - url_or_params = jq_param[ is_fragment ? str_fragment : str_querystring ](); - } else { - url_or_params = is_string( url_or_params ) - ? url_or_params.replace( is_fragment ? re_trim_fragment : re_trim_querystring, '' ) - : url_or_params; - } - - return jq_deparam( url_or_params, coerce ); - }; - - jq_deparam[ str_querystring ] = curry( jq_deparam_sub, 0 ); - jq_deparam[ str_fragment ] = jq_deparam_fragment = curry( jq_deparam_sub, 1 ); - - // Section: Element manipulation - // - // Method: jQuery.elemUrlAttr - // - // Get the internal "Default URL attribute per tag" list, or augment the list - // with additional tag-attribute pairs, in case the defaults are insufficient. - // - // In the and methods, this list - // is used to determine which attribute contains the URL to be modified, if - // an "attr" param is not specified. - // - // Default Tag-Attribute List: - // - // a - href - // base - href - // iframe - src - // img - src - // input - src - // form - action - // link - href - // script - src - // - // Usage: - // - // > jQuery.elemUrlAttr( [ tag_attr ] ); - // - // Arguments: - // - // tag_attr - (Object) An object containing a list of tag names and their - // associated default attribute names in the format { tag: 'attr', ... } to - // be merged into the internal tag-attribute list. - // - // Returns: - // - // (Object) An object containing all stored tag-attribute values. - - // Only define function and set defaults if function doesn't already exist, as - // the urlInternal plugin will provide this method as well. - $[ str_elemUrlAttr ] || ($[ str_elemUrlAttr ] = function( obj ) { - return $.extend( elemUrlAttr_cache, obj ); - })({ - a: str_href, - base: str_href, - iframe: str_src, - img: str_src, - input: str_src, - form: 'action', - link: str_href, - script: str_src - }); - - jq_elemUrlAttr = $[ str_elemUrlAttr ]; - - // Method: jQuery.fn.querystring - // - // Update URL attribute in one or more elements, merging the current URL (with - // or without pre-existing query string params) plus any params object or - // string into a new URL, which is then set into that attribute. Like - // , but for all elements in a jQuery - // collection. - // - // Usage: - // - // > jQuery('selector').querystring( [ attr, ] params [, merge_mode ] ); - // - // Arguments: - // - // attr - (String) Optional name of an attribute that will contain a URL to - // merge params or url into. See for a list of default - // attributes. - // params - (Object) A params object to be merged into the URL attribute. - // params - (String) A URL containing query string params, or params string - // to be merged into the URL attribute. - // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not - // specified, and is as-follows: - // - // * 0: params in the params argument will override any params in attr URL. - // * 1: any params in attr URL will override params in the params argument. - // * 2: params argument will completely replace any query string in attr - // URL. - // - // Returns: - // - // (jQuery) The initial jQuery collection of elements, but with modified URL - // attribute values. - - // Method: jQuery.fn.fragment - // - // Update URL attribute in one or more elements, merging the current URL (with - // or without pre-existing fragment/hash params) plus any params object or - // string into a new URL, which is then set into that attribute. Like - // , but for all elements in a jQuery - // collection. - // - // Usage: - // - // > jQuery('selector').fragment( [ attr, ] params [, merge_mode ] ); - // - // Arguments: - // - // attr - (String) Optional name of an attribute that will contain a URL to - // merge params into. See for a list of default - // attributes. - // params - (Object) A params object to be merged into the URL attribute. - // params - (String) A URL containing fragment (hash) params, or params - // string to be merged into the URL attribute. - // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not - // specified, and is as-follows: - // - // * 0: params in the params argument will override any params in attr URL. - // * 1: any params in attr URL will override params in the params argument. - // * 2: params argument will completely replace any fragment (hash) in attr - // URL. - // - // Returns: - // - // (jQuery) The initial jQuery collection of elements, but with modified URL - // attribute values. - - function jq_fn_sub( mode, force_attr, params, merge_mode ) { - if ( !is_string( params ) && typeof params !== 'object' ) { - // force_attr not specified. - merge_mode = params; - params = force_attr; - force_attr = undefined; - } - - return this.each(function(){ - var that = $(this), - - // Get attribute specified, or default specified via $.elemUrlAttr. - attr = force_attr || jq_elemUrlAttr()[ ( this.nodeName || '' ).toLowerCase() ] || '', - - // Get URL value. - url = attr && that.attr( attr ) || ''; - - // Update attribute with new URL. - that.attr( attr, jq_param[ mode ]( url, params, merge_mode ) ); - }); - - }; - - $.fn[ str_querystring ] = curry( jq_fn_sub, str_querystring ); - $.fn[ str_fragment ] = curry( jq_fn_sub, str_fragment ); - - // Section: History, hashchange event - // - // Method: jQuery.bbq.pushState - // - // Adds a 'state' into the browser history at the current position, setting - // location.hash and triggering any bound callbacks - // (provided the new state is different than the previous state). - // - // If no arguments are passed, an empty state is created, which is just a - // shortcut for jQuery.bbq.pushState( {}, 2 ). - // - // Usage: - // - // > jQuery.bbq.pushState( [ params [, merge_mode ] ] ); - // - // Arguments: - // - // params - (String) A serialized params string or a hash string beginning - // with # to merge into location.hash. - // params - (Object) A params object to merge into location.hash. - // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not - // specified (unless a hash string beginning with # is specified, in which - // case merge behavior defaults to 2), and is as-follows: - // - // * 0: params in the params argument will override any params in the - // current state. - // * 1: any params in the current state will override params in the params - // argument. - // * 2: params argument will completely replace current state. - // - // Returns: - // - // Nothing. - // - // Additional Notes: - // - // * Setting an empty state may cause the browser to scroll. - // * Unlike the fragment and querystring methods, if a hash string beginning - // with # is specified as the params agrument, merge_mode defaults to 2. - - jq_bbq.pushState = jq_bbq_pushState = function( params, merge_mode ) { - if ( is_string( params ) && /^#/.test( params ) && merge_mode === undefined ) { - // Params string begins with # and merge_mode not specified, so completely - // overwrite window.location.hash. - merge_mode = 2; - } - - var has_args = params !== undefined, - // Merge params into window.location using $.param.fragment. - url = jq_param_fragment( window[ str_location ][ str_href ], - has_args ? params : {}, has_args ? merge_mode : 2 ); - - // Set new window.location.href. If hash is empty, use just # to prevent - // browser from reloading the page. Note that Safari 3 & Chrome barf on - // location.hash = '#'. - window[ str_location ][ str_href ] = url + ( /#/.test( url ) ? '' : '#' ); - }; - - // Method: jQuery.bbq.getState - // - // Retrieves the current 'state' from the browser history, parsing - // location.hash for a specific key or returning an object containing the - // entire state, optionally coercing numbers, booleans, null and undefined - // values. - // - // Usage: - // - // > jQuery.bbq.getState( [ key ] [, coerce ] ); - // - // Arguments: - // - // key - (String) An optional state key for which to return a value. - // coerce - (Boolean) If true, coerces any numbers or true, false, null, and - // undefined to their actual value. Defaults to false. - // - // Returns: - // - // (Anything) If key is passed, returns the value corresponding with that key - // in the location.hash 'state', or undefined. If not, an object - // representing the entire 'state' is returned. - - jq_bbq.getState = jq_bbq_getState = function( key, coerce ) { - return key === undefined || typeof key === 'boolean' - ? jq_deparam_fragment( key ) // 'key' really means 'coerce' here - : jq_deparam_fragment( coerce )[ key ]; - }; - - // Method: jQuery.bbq.removeState - // - // Remove one or more keys from the current browser history 'state', creating - // a new state, setting location.hash and triggering any bound - // callbacks (provided the new state is different than - // the previous state). - // - // If no arguments are passed, an empty state is created, which is just a - // shortcut for jQuery.bbq.pushState( {}, 2 ). - // - // Usage: - // - // > jQuery.bbq.removeState( [ key [, key ... ] ] ); - // - // Arguments: - // - // key - (String) One or more key values to remove from the current state, - // passed as individual arguments. - // key - (Array) A single array argument that contains a list of key values - // to remove from the current state. - // - // Returns: - // - // Nothing. - // - // Additional Notes: - // - // * Setting an empty state may cause the browser to scroll. - - jq_bbq.removeState = function( arr ) { - var state = {}; - - // If one or more arguments is passed.. - if ( arr !== undefined ) { - - // Get the current state. - state = jq_bbq_getState(); - - // For each passed key, delete the corresponding property from the current - // state. - $.each( $.isArray( arr ) ? arr : arguments, function(i,v){ - delete state[ v ]; - }); - } - - // Set the state, completely overriding any existing state. - jq_bbq_pushState( state, 2 ); - }; - - // Event: hashchange event (BBQ) - // - // Usage in jQuery 1.4 and newer: - // - // In jQuery 1.4 and newer, the event object passed into any hashchange event - // callback is augmented with a copy of the location.hash fragment at the time - // the event was triggered as its event.fragment property. In addition, the - // event.getState method operates on this property (instead of location.hash) - // which allows this fragment-as-a-state to be referenced later, even after - // window.location may have changed. - // - // Note that event.fragment and event.getState are not defined according to - // W3C (or any other) specification, but will still be available whether or - // not the hashchange event exists natively in the browser, because of the - // utility they provide. - // - // The event.fragment property contains the output of - // and the event.getState method is equivalent to the - // method. - // - // > $(window).bind( 'hashchange', function( event ) { - // > var hash_str = event.fragment, - // > param_obj = event.getState(), - // > param_val = event.getState( 'param_name' ), - // > param_val_coerced = event.getState( 'param_name', true ); - // > ... - // > }); - // - // Usage in jQuery 1.3.2: - // - // In jQuery 1.3.2, the event object cannot to be augmented as in jQuery 1.4+, - // so the fragment state isn't bound to the event object and must instead be - // parsed using the and methods. - // - // > $(window).bind( 'hashchange', function( event ) { - // > var hash_str = $.param.fragment(), - // > param_obj = $.bbq.getState(), - // > param_val = $.bbq.getState( 'param_name' ), - // > param_val_coerced = $.bbq.getState( 'param_name', true ); - // > ... - // > }); - // - // Additional Notes: - // - // * Due to changes in the special events API, jQuery BBQ v1.2 or newer is - // required to enable the augmented event object in jQuery 1.4.2 and newer. - // * See for more detailed information. - - jq_event_special[ str_hashchange ] = $.extend( jq_event_special[ str_hashchange ], { - - // Augmenting the event object with the .fragment property and .getState - // method requires jQuery 1.4 or newer. Note: with 1.3.2, everything will - // work, but the event won't be augmented) - add: function( handleObj ) { - var old_handler; - - function new_handler(e) { - // e.fragment is set to the value of location.hash (with any leading # - // removed) at the time the event is triggered. - var hash = e[ str_fragment ] = jq_param_fragment(); - - // e.getState() works just like $.bbq.getState(), but uses the - // e.fragment property stored on the event object. - e.getState = function( key, coerce ) { - return key === undefined || typeof key === 'boolean' - ? jq_deparam( hash, key ) // 'key' really means 'coerce' here - : jq_deparam( hash, coerce )[ key ]; - }; - - old_handler.apply( this, arguments ); - }; - - // This may seem a little complicated, but it normalizes the special event - // .add method between jQuery 1.4/1.4.1 and 1.4.2+ - if ( $.isFunction( handleObj ) ) { - // 1.4, 1.4.1 - old_handler = handleObj; - return new_handler; - } else { - // 1.4.2+ - old_handler = handleObj.handler; - handleObj.handler = new_handler; - } - } - - }); - -})(jQuery,this); - -/*! - * jQuery hashchange event - v1.2 - 2/11/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ - -// Script: jQuery hashchange event -// -// *Version: 1.2, Last updated: 2/11/2010* -// -// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/ -// GitHub - http://github.com/cowboy/jquery-hashchange/ -// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js -// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.1kb) -// -// About: License -// -// Copyright (c) 2010 "Cowboy" Ben Alman, -// Dual licensed under the MIT and GPL licenses. -// http://benalman.com/about/license/ -// -// About: Examples -// -// This working example, complete with fully commented code, illustrate one way -// in which this plugin can be used. -// -// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ -// -// About: Support and Testing -// -// Information about what version or versions of jQuery this plugin has been -// tested with, what browsers it has been tested in, and where the unit tests -// reside (so you can test it yourself). -// -// jQuery Versions - 1.3.2, 1.4.1, 1.4.2 -// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.1. -// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/ -// -// About: Known issues -// -// While this jQuery hashchange event implementation is quite stable and robust, -// there are a few unfortunate browser bugs surrounding expected hashchange -// event-based behaviors, independent of any JavaScript window.onhashchange -// abstraction. See the following examples for more information: -// -// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/ -// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/ -// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/ -// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/ -// -// About: Release History -// -// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin -// from a page on another domain would cause an error in Safari 4. Also, -// IE6/7 Iframe is now inserted after the body (this actually works), -// which prevents the page from scrolling when the event is first bound. -// Event can also now be bound before DOM ready, but it won't be usable -// before then in IE6/7. -// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug -// where browser version is incorrectly reported as 8.0, despite -// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag. -// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special -// window.onhashchange functionality into a separate plugin for users -// who want just the basic event & back button support, without all the -// extra awesomeness that BBQ provides. This plugin will be included as -// part of jQuery BBQ, but also be available separately. - -(function($,window,undefined){ - '$:nomunge'; // Used by YUI compressor. - - // Method / object references. - var fake_onhashchange, - jq_event_special = $.event.special, - - // Reused strings. - str_location = 'location', - str_hashchange = 'hashchange', - str_href = 'href', - - // IE6/7 specifically need some special love when it comes to back-button - // support, so let's do a little browser sniffing.. - browser = $.browser, - mode = document.documentMode, - is_old_ie = browser.msie && ( mode === undefined || mode < 8 ), - - // Does the browser support window.onhashchange? Test for IE version, since - // IE8 incorrectly reports this when in "IE7" or "IE8 Compatibility View"! - supports_onhashchange = 'on' + str_hashchange in window && !is_old_ie; - - // Get location.hash (or what you'd expect location.hash to be) sans any - // leading #. Thanks for making this necessary, Firefox! - function get_fragment( url ) { - url = url || window[ str_location ][ str_href ]; - return url.replace( /^[^#]*#?(.*)$/, '$1' ); - }; - - // Property: jQuery.hashchangeDelay - // - // The numeric interval (in milliseconds) at which the - // polling loop executes. Defaults to 100. - - $[ str_hashchange + 'Delay' ] = 100; - - // Event: hashchange event - // - // Fired when location.hash changes. In browsers that support it, the native - // window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is - // initialized, running every milliseconds to see if - // the hash has changed. In IE 6 and 7, a hidden Iframe is created to allow - // the back button and hash-based history to work. - // - // Usage: - // - // > $(window).bind( 'hashchange', function(e) { - // > var hash = location.hash; - // > ... - // > }); - // - // Additional Notes: - // - // * The polling loop and Iframe are not created until at least one callback - // is actually bound to 'hashchange'. - // * If you need the bound callback(s) to execute immediately, in cases where - // the page 'state' exists on page load (via bookmark or page refresh, for - // example) use $(window).trigger( 'hashchange' ); - // * The event can be bound before DOM ready, but since it won't be usable - // before then in IE6/7 (due to the necessary Iframe), recommended usage is - // to bind it inside a $(document).ready() callback. - - jq_event_special[ str_hashchange ] = $.extend( jq_event_special[ str_hashchange ], { - - // Called only when the first 'hashchange' event is bound to window. - setup: function() { - // If window.onhashchange is supported natively, there's nothing to do.. - if ( supports_onhashchange ) { return false; } - - // Otherwise, we need to create our own. And we don't want to call this - // until the user binds to the event, just in case they never do, since it - // will create a polling loop and possibly even a hidden Iframe. - $( fake_onhashchange.start ); - }, - - // Called only when the last 'hashchange' event is unbound from window. - teardown: function() { - // If window.onhashchange is supported natively, there's nothing to do.. - if ( supports_onhashchange ) { return false; } - - // Otherwise, we need to stop ours (if possible). - $( fake_onhashchange.stop ); - } - - }); - - // fake_onhashchange does all the work of triggering the window.onhashchange - // event for browsers that don't natively support it, including creating a - // polling loop to watch for hash changes and in IE 6/7 creating a hidden - // Iframe to enable back and forward. - fake_onhashchange = (function(){ - var self = {}, - timeout_id, - iframe, - set_history, - get_history; - - // Initialize. In IE 6/7, creates a hidden Iframe for history handling. - function init(){ - // Most browsers don't need special methods here.. - set_history = get_history = function(val){ return val; }; - - // But IE6/7 do! - if ( is_old_ie ) { - - // Create hidden Iframe after the end of the body to prevent initial - // page load from scrolling unnecessarily. - iframe = $('