repo
stringlengths
5
75
commit
stringlengths
40
40
message
stringlengths
6
18.2k
diff
stringlengths
60
262k
dotnet/android-samples
b5c9ecf6a9b0a358329759db9763e3dd1f8deb20
onboard missing samples
diff --git a/CustomRowView/README.md b/CustomRowView/README.md index bab7539..9d672a3 100644 --- a/CustomRowView/README.md +++ b/CustomRowView/README.md @@ -1,13 +1,16 @@ --- -name: Xamarin.Android - Custom Row Views -description: Creating a custom view for a row in a ListView. +name: Xamarin.Android - Custom Rows for ListView +description: "Creating a custom view for a row in a ListView (UI)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - ui urlFragment: customrowview --- # Custom Row Views -This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). \ No newline at end of file +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). diff --git a/CustomTransitions/README.md b/CustomTransitions/README.md index 2e6156a..b0400f1 100644 --- a/CustomTransitions/README.md +++ b/CustomTransitions/README.md @@ -1,28 +1,28 @@ --- name: Xamarin.Android - Custom Transitions -description: This sample demonstrates how to create custom transitions to go from one scene in their app to the next +description: "Demonstrates how to create custom transitions to go from one scene in their app to the next" page_type: sample languages: - csharp products: - xamarin urlFragment: customtransitions --- # Custom Transitions This sample demonstrates how to create custom transitions to go from one scene in their app to the next. The transition created in this sample smoothly changes between three scenes which each have three colored boxes with the colors in a different order in each scene. ## Instructions -* Press the "Show next scene" button to cycle the colors using a custom transition. -* Press the "Show Log" button to show what is logged as the transitions occur +- Press the "Show next scene" button to cycle the colors using a custom transition. +- Press the "Show Log" button to show what is logged as the transitions occur ## Build Requirements This sample requires the SDK platform level 19 to build and a device that is level 19 or newer to run. ![Custom Transitions application screenshot](Screenshots/Screenshot_2014-07-03-15-58-07.png "Custom Transitions application screenshot") ## License Copyright (c) 2005-2008, The Android Open Source Project diff --git a/DynamicTest/Metadata.xml b/DynamicTest/Metadata.xml deleted file mode 100755 index 99103a8..0000000 --- a/DynamicTest/Metadata.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<SampleMetadata> - <ID>98ff0c41-15b5-4211-b232-4927ede31b37</ID> - <IsFullApplication>false</IsFullApplication> - <Level>Beginner</Level> - <Tags>Data</Tags> - <Gallery>true</Gallery> - <Brief>This sample demonstrates the use of dynamic types in DLR.</Brief> -</SampleMetadata> diff --git a/DynamicTest/README.md b/DynamicTest/README.md index 8bac474..b3e18a1 100644 --- a/DynamicTest/README.md +++ b/DynamicTest/README.md @@ -1,23 +1,13 @@ ---- -name: Xamarin.Android - C# Dynamic Test -description: "This samples makes use of dynamic types in DLR. It imports System.Json from ASP.NET MVC sources which includes JsonValue.AsDynamic()" -page_type: sample -languages: -- csharp -products: -- xamarin -urlFragment: dynamictest ---- # C# Dynamic Test This samples makes use of dynamic types in DLR. This sample imports System.Json from ASP.NET MVC sources which includes JsonValue.AsDynamic() which allows users to directly specify object keys as field names. This sample retrieves Twitter public timeline JSON and parses it into the ListAdapter. Hence it requires internet access (and working twitter). Bonus: You can also add reference to mono-reactive for Android from https://github.com/atsushieno/mono-reactive , add REACTIVE symbol to compiler options and get things done asynchronously. diff --git a/Example_WorkingWithAudio/README.md b/Example_WorkingWithAudio/README.md index 25239d4..ef17632 100644 --- a/Example_WorkingWithAudio/README.md +++ b/Example_WorkingWithAudio/README.md @@ -1,22 +1,22 @@ --- -name: Xamarin.Android - Working With Audio – Test Application +name: Xamarin.Android - Working With Audio description: 'Sample code to accompany the article Working With Audio' page_type: sample languages: - csharp products: - xamarin urlFragment: example-workingwithaudio --- # Working With Audio – Test Application Sample code to accompany the article [Working With Audio](https://docs.microsoft.com/xamarin/android/app-fundamentals/android-audio). This simple application provides the following functionality: -* Recording audio using the high-level API (MediaRecorder.) -* Playing audio using the high-level API (MediaPlayer.) -* Recording audio using the low-level API (AudioRecord.) -* Playing audio using the low-level API (AudioTrack.) -* Optionally use Audio notifications. +- Recording audio using the high-level API (MediaRecorder) +- Playing audio using the high-level API (MediaPlayer) +- Recording audio using the low-level API (AudioRecord) +- Playing audio using the low-level API (AudioTrack) +- Optionally use Audio notifications One can only play back what has been recorded in the same session. (For this reason, the playback buttons are disabled on start-up.) Once on operation has been started, it must be stopped. No other actions are allowed in the meantime. The best way to demonstrate recording and playback is to record some sound and then play it back again. The best way to see audio notifications in action is to call the test phone, keep the call open for a while and then end the call while there is an ongoing operation. Audio-focus will be taken away and then granted again when the call is complete. diff --git a/ExportAttribute/Metadata.xml b/ExportAttribute/Metadata.xml deleted file mode 100755 index 12ad35f..0000000 --- a/ExportAttribute/Metadata.xml +++ /dev/null @@ -1,9 +0,0 @@ -<SampleMetadata> - <ID>71097d7e-c1b7-4df5-b07a-40f7db5980fc</ID> - <IsFullApplication>false</IsFullApplication> - <Level>Intermediate</Level> - <Tags>Data</Tags> - <SupportedPlatforms>Android</SupportedPlatforms> - <Gallery>true</Gallery> - <Brief>This is a functional test for "ExportAttribute" which is new in Mono for Android 4.2.</Brief> -</SampleMetadata> diff --git a/ExportAttribute/README.md b/ExportAttribute/README.md index 9b246b7..f9611bf 100644 --- a/ExportAttribute/README.md +++ b/ExportAttribute/README.md @@ -1,15 +1,5 @@ ---- -name: Xamarin.Android - ExportAttributeTest -description: 'This is a functional test for ExportAttribute which is new in Mono for Android 4.2' -page_type: sample -languages: -- csharp -products: -- xamarin -urlFragment: exportattribute ---- # ExportAttributeTest This is a functional test for "ExportAttribute" which is new in Mono for Android 4.2. This contains sample code for android:onClick, java.io.Serializable and android.os.Parcelable. diff --git a/Facebook/README.md b/Facebook/README.md index 14ec12c..4d0e878 100644 --- a/Facebook/README.md +++ b/Facebook/README.md @@ -1,43 +1,48 @@ --- -name: Xamarin.Android - How to build the entire package from source -description: Prerequisites - Android SDK. - Environment variable ANDROIDHOME/path/to/the/sdk - Environment variable PATH must contain $ANDROIDHOME/tools -... +name: Xamarin.Android - Hello Facebook sample +description: Integrate with Facebook from a Xamarin.Android app page_type: sample languages: - csharp products: - xamarin urlFragment: facebook --- -# How to build the entire package from source +# Hello Facebook sample -## Prerequisites +![Facebook login inside Android app](Screenshots/FacebookSimpleSshot.png) + +## How to build the entire package from source + +### Prerequisites - Android SDK. - Environment variable ANDROID_HOME=/path/to/the/sdk - Environment variable PATH must contain $ANDROID_HOME/tools - Oracle JDK 1.6. To generate supported format of JavaDoc you cannot use 1.7. - Apache Ant to build the library project zip. - Apache Maven 3.0 to build the library in its own manner and then Javadoc. -## Build steps +### Build steps Download Facebook Android SDK v3.0.1 from: https://developers.facebook.com/resources/facebook-android-sdk-3.0.1.zip Extract it under this directory. Go to facebook-android-sdk-3.0.1/facebook directory. Copy javadoc.xml into that directory (cp ../../javadoc.xml .) Run the following commands: - android update project -p . - ant debug - LC_ALL=en_US ant -buildfile javadoc.xml doc - zip -r facebook-android-sdk.zip bin/classes.jar bin/AndroidManifest.xml res - mv facebook-android-sdk.zip ../../Xamarin.Facebook/Jars/ +```cmd +android update project -p . +ant debug +LC_ALL=en_US ant -buildfile javadoc.xml doc +zip -r facebook-android-sdk.zip bin/classes.jar bin/AndroidManifest.xml res +mv facebook-android-sdk.zip ../../Xamarin.Facebook/Jars/ +``` (The API Reference is generated by Ant, and it is important to provide parameter names). - diff --git a/FastScroll/README.md b/FastScroll/README.md index 1fb280e..a5b6052 100644 --- a/FastScroll/README.md +++ b/FastScroll/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Fast Scroll description: Implementing fast scroll in a ListView on Android page_type: sample languages: - csharp products: - xamarin urlFragment: fastscroll --- # Fast Scroll -This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/) \ No newline at end of file +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/)
dotnet/android-samples
eb5a0b7774d70311a7ebd7fe5ad30894778a8833
onboard missing samples
diff --git a/CardReader/README.md b/CardReader/README.md index 6bafc39..62ad9e8 100644 --- a/CardReader/README.md +++ b/CardReader/README.md @@ -1,27 +1,27 @@ --- name: Xamarin.Android - CardReader -description: This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data +description: "Demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data" page_type: sample languages: - csharp products: - xamarin urlFragment: cardreader --- # CardReader This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data. This sample is designed to read the virtual loyalty card implemented in the "CardEmulation" sample. ## Instructions -* In order to run this sample, you will need two NFC-capable physical devices. One with this project (CardEmulation) installed, and another with the CardReader sample installed. Run each on the device it was installed on, then place the backs of the two devices together in order to allow NFC communication to occur. +- In order to run this sample, you will need two NFC-capable physical devices. One with this project (CardEmulation) installed, and another with the CardReader sample installed. Run each on the device it was installed on, then place the backs of the two devices together in order to allow NFC communication to occur. ## Build Requirements -Download the latest version of Xamarin Studio. Open CardReader.sln in Xamarin Studio and either build or run the project. This project requires the API level 19 SDK platform. +Download the latest version of Visual Studio. Open CardReader.sln and either build or run the project. This project requires the API level 19 SDK. ![CardReader application screenshot](Screenshots/Screenshot_2014-07-14-13-58-56.png "CardReader application screenshot") ## License Copyright (c) 2005-2008, The Android Open Source Project diff --git a/ContactManager/README.md b/ContactManager/README.md index f3125ed..04680ec 100644 --- a/ContactManager/README.md +++ b/ContactManager/README.md @@ -1,13 +1,15 @@ --- name: Xamarin.Android - Contact Manager description: "This sample demonstrates how to interact with Android's contact manager." page_type: sample languages: - csharp products: - xamarin urlFragment: contactmanager --- # Contact Manager This sample demonstrates how to interact with Android's contact manager. + +![List of contacts on Android app screen](Screenshots/ContactManager.png) diff --git a/ContactsProviderDemo/README.md b/ContactsProviderDemo/README.md index fc4f6f6..31e52e0 100644 --- a/ContactsProviderDemo/README.md +++ b/ContactsProviderDemo/README.md @@ -1,16 +1,16 @@ --- name: Xamarin.Android - ContactsProvider Demo -description: "This example shows how to use the ContactsProvider as well as the device owner's profile in Android" +description: "How to use the ContactsProvider as well as the device owner's profile in Android" page_type: sample languages: - csharp products: - xamarin urlFragment: contactsproviderdemo --- # ContactsProvider Demo This example shows how to use the `ContactsProvider` as well as the device owner's profile in Android. ![Contacts demo app](Screenshots/ContactsProvider.png) diff --git a/ContentProvider/README.md b/ContentProvider/README.md index 7e7d698..ba256f7 100644 --- a/ContentProvider/README.md +++ b/ContentProvider/README.md @@ -1,21 +1,17 @@ --- name: Xamarin.Android - Content Provider Demo description: "Example showing how a Content Provider can be implemented in Xamarin.Android" page_type: sample languages: - csharp products: - xamarin urlFragment: contentprovider --- # Content Provider Demo -Just a small example showing how a Content Provider can be implemented in Mono for Android. +Example showing how a Content Provider can be implemented in Xamarin.Android. -I used this [article](http://www.devx.com/wireless/Article/41133/1954) as reference. +This [article](http://www.devx.com/wireless/Article/41133/1954) was used as a reference. ![Content Provider Demo application screenshot](Screenshots/Output.png "Content Provider Demo application screenshot") - -## Author - -Tomasz Cielecki aka [Cheesebaron](https://github.com/Cheesebaron) diff --git a/CursorTableAdapter/README.md b/CursorTableAdapter/README.md index 219f4d8..bc17c48 100644 --- a/CursorTableAdapter/README.md +++ b/CursorTableAdapter/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Cursor Table Adapter description: This sample is part of the Android ListViews and Adapters series. page_type: sample languages: - csharp products: - xamarin urlFragment: cursortableadapter --- # Cursor Table Adapter -This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/) +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/).
dotnet/android-samples
3719f816ca825fda25efd6a8d17275d0845eb913
onboard missing samples
diff --git a/BasicTableAdapter/README.md b/BasicTableAdapter/README.md index 0fc42a8..b7209d8 100644 --- a/BasicTableAdapter/README.md +++ b/BasicTableAdapter/README.md @@ -1,16 +1,16 @@ --- name: Xamarin.Android - Basic Table Adapter -description: This sample is part of the Android ListViews and Adapters series (UI) +description: "This sample is part of the Android ListViews and Adapters series (UI)" page_type: sample languages: - csharp products: - xamarin extensions: tags: - ui urlFragment: basictableadapter --- # Basic Table Adapter -This sample is part of the [Xamarin.Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). \ No newline at end of file +This sample is part of the [Xamarin.Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). diff --git a/BouncingGameCompleteAndroid/Metadata.xml b/BouncingGameCompleteAndroid/Metadata.xml deleted file mode 100644 index 3bfd359..0000000 --- a/BouncingGameCompleteAndroid/Metadata.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<SampleMetadata> - <ID>a41fe5e7-bf65-4818-b8b6-7454dc7f4b01</ID> - <IsFullApplication>false</IsFullApplication> - <Level>Beginning</Level> - <LicenseRequirement>Indie</LicenseRequirement> - <Tags>Getting Started, Games</Tags> - <Gallery>false</Gallery> - <Brief>Demonstration of the result of working through the the entire Introduction to CocosSharp walkthrough.</Brief> -</SampleMetadata> diff --git a/BouncingGameCompleteAndroid/README.md b/BouncingGameCompleteAndroid/README.md index c112a50..ffe2c4b 100644 --- a/BouncingGameCompleteAndroid/README.md +++ b/BouncingGameCompleteAndroid/README.md @@ -1,23 +1,13 @@ ---- -name: Xamarin.Android - CocosSharp BouncingGame Project for Android -description: This is a small, complete game using CocosSharp for Android. It is the result of working through the the entire Introduction to CocosSharp... -page_type: sample -languages: -- csharp -products: -- xamarin -urlFragment: bouncinggamecompleteandroid ---- # CocosSharp BouncingGame Project for Android This is a small, complete game using CocosSharp for Android. It is the result of working through the the entire Introduction to CocosSharp walkthrough. This single solution contains two projects: one for Android and one cross-platform portable class library. The game can be played by touching the screen to move the paddle at the bottom of the screen horizontally. The goal is to keep the ball from falling off-screen. Each bounce awards the player one point. ![CocosSharp BouncingGame Project for Android application screenshot](Screenshots/FinalBouncingGameScreen.png "CocosSharp BouncingGame Project for Android application screenshot") ## Author Victor Chelaru \ No newline at end of file diff --git a/BouncingGameEmptyAndroid/Metadata.xml b/BouncingGameEmptyAndroid/Metadata.xml deleted file mode 100644 index a59244f..0000000 --- a/BouncingGameEmptyAndroid/Metadata.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<SampleMetadata> - <ID>3dfd8a58-64ad-460f-b242-695248f264ce</ID> - <IsFullApplication>false</IsFullApplication> - <Level>Beginning</Level> - <LicenseRequirement>Indie</LicenseRequirement> - <Tags>Getting Started, Games</Tags> - <Gallery>false</Gallery> - <Brief>Demonstration of the result of working through the Part 2 - Creating Android CocosSharp Project walkthrough.</Brief> -</SampleMetadata> diff --git a/BouncingGameEmptyAndroid/README.md b/BouncingGameEmptyAndroid/README.md index afe076b..364fb46 100644 --- a/BouncingGameEmptyAndroid/README.md +++ b/BouncingGameEmptyAndroid/README.md @@ -1,23 +1,13 @@ ---- -name: Xamarin.Android - CocosSharp Empty Project for Android -description: This project serves as a starting-point for CocosSharp Android projects. It is the result of working through the Part 2 - Creating Android... -page_type: sample -languages: -- csharp -products: -- xamarin -urlFragment: bouncinggameemptyandroid ---- # CocosSharp Empty Project for Android This project serves as a starting-point for CocosSharp Android projects. It is the result of working through the Part 2 - Creating Android CocosSharp Project walkthrough. It is titled BouncingGame as that is the name of the project created by the full Introduction to CocosSharp walkthrough. This single solution contains two projects: one for Android and one cross-platform portable class library. When executed this project displays only a black screen. ![CocosSharp Empty Project for Android application screenshot](Screenshots/Screenshot1.png "CocosSharp Empty Project for Android application screenshot") ## Author Victor Chelaru \ No newline at end of file diff --git a/Button/README.md b/Button/README.md index 8f2e0c0..9f26eb0 100644 --- a/Button/README.md +++ b/Button/README.md @@ -1,13 +1,16 @@ --- name: Xamarin.Android - Button Widget -description: Shows how to use a simple button widget. +description: "Shows how to use a simple button widget (UI)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - ui urlFragment: button --- # Button Widget -Shows how to use a simple button widget. +Shows how to use a simple button widget - see the [documentation](https://docs.microsoft.com/xamarin/android/user-interface/controls/buttons/). diff --git a/CalendarDemo/README.md b/CalendarDemo/README.md index 4ad5d0a..29eb240 100644 --- a/CalendarDemo/README.md +++ b/CalendarDemo/README.md @@ -1,16 +1,21 @@ --- name: Xamarin.Android - Calendar Demo -description: "Shows how to use the calendar API to list calendars and events. It also shows how to add an event and view it..." +description: "How to use the calendar API to list calendars and events. It also shows how to add an event... (UI)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - ui urlFragment: calendardemo --- # Calendar Demo This example shows how to use the calendar API to list calendars and events. It also shows how to add an event and view it using the built-in calendar app. ![Demo of a calendar with two events](Screenshots/Calendar1.png) + +Also see the [documentation](https://docs.microsoft.com/xamarin/android/user-interface/controls/calendar).
dotnet/android-samples
c349623847e9cbc4dd7764310b526008b9e93fc0
onboard missing samples
diff --git a/ApiDemo/README.md b/ApiDemo/README.md index deb02ea..54fea99 100644 --- a/ApiDemo/README.md +++ b/ApiDemo/README.md @@ -1,30 +1,32 @@ --- name: Xamarin.Android - Android API Demo -description: 'This sample includes a variety of small applications that illustrate the use of various Android APIs. It includes samples of: - Notifications -...' +description: "Includes a variety of small applications that illustrate the use of various Android APIs" page_type: sample languages: - csharp products: - xamarin urlFragment: apidemo --- # Android API Demo This sample includes a variety of small applications that illustrate the use of various Android APIs. It includes samples of: - - Notifications - - Alarms - - Progress Dialogs - - Intents - - Menus - - Search - - Persistent application state - - Preferences - - Background Services - - App Widgets - - Voice Recognition - - And many many more... + +- Notifications +- Alarms +- Progress Dialogs +- Intents +- Menus +- Search +- Persistent application state +- Preferences +- Background Services +- App Widgets +- Voice Recognition +- And many many more... ## Build Requirements + Building this sample requires that the API 19 (KitKat) SDK be installed, as well as Android SDK Build-tools 19.0.1 or greater. diff --git a/AsyncImageAndroid/README.md b/AsyncImageAndroid/README.md index e915a21..d144d6e 100644 --- a/AsyncImageAndroid/README.md +++ b/AsyncImageAndroid/README.md @@ -1,21 +1,21 @@ --- -name: Xamarin.Android - AsyncImageAndroid -description: "Demonstrates how to use the new async/await feature" +name: Xamarin.Android - Async Image +description: "Demonstrates how to use the new async/await feature in Xamarin.Android" page_type: sample languages: - csharp products: - xamarin extensions: tags: - androidpie urlFragment: asyncimageandroid --- -# AsyncImageAndroid +# Async Image Android This sample application demonstrates how to use the new async/await feature which is available in Xamarin.Android 4.8. The sample download a large image from Internet using the DownloadDataTaskAsync in WebClient. Saving and resizing the image also use the new async feature. > [!NOTE] > Will not work with AOT + armeabi configuration. diff --git a/BasicImmersiveMode/README.md b/BasicImmersiveMode/README.md index a3b9520..9d29142 100644 --- a/BasicImmersiveMode/README.md +++ b/BasicImmersiveMode/README.md @@ -1,22 +1,22 @@ --- name: Xamarin.Android - Basic Immersive Mode -description: Provide a more immersive screen experience in your app, by letting users show or hide the status bar +description: "Provide a more immersive screen experience in your app, by letting users show or hide the status bar" page_type: sample languages: - csharp products: - xamarin extensions: tags: - androidkitkat urlFragment: basicimmersivemode --- # Basic Immersive Mode Android 4.4 introduces a way for you to provide a more immersive screen experience in your app, by letting users show or hide the status bar and navigation bar with a swipe. This sample demonstrates how to enable and disable this feature programmatically. -See the `Advanced Immersive Mode` sample for more details. +See the _Advanced Immersive Mode_ sample for more details.
dotnet/android-samples
0ec720ec6322b56e566eff28f27cf71695529c23
onboard missing samples
diff --git a/android5.0/LNotifications/README.md b/android5.0/LNotifications/README.md index c3da491..2bb2fc6 100644 --- a/android5.0/LNotifications/README.md +++ b/android5.0/LNotifications/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Android L Notifications -description: This sample demonstrates how new features for notifications introduced in Android L are used such as Heads-Up notifications, visibility, people,... +description: "Demonstrates how new features for notifications introduced such as Heads-Up notifications, visibility, people,... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-lnotifications --- # Android L Notifications This sample demonstrates how new features for notifications introduced in Android L are used such as Heads-Up notifications, visibility, people, category and priority metadata. (Priority metadata has been present since Jelly Bean, but actually unused). +![Android L Notifications application screenshot](Screenshots/HeadsUp.png "Android L Notifications application screenshot") + ## Instructions -* Run the project -* Each tab allows you to change different metadata settings for the notifications. -* To show the notification, tap the Show Notification button. +- Run the project +- Each tab allows you to change different metadata settings for the notifications. +- To show the notification, tap the Show Notification button. ## Build Requirements -* Xamarin Studio 5.3+ -* Xamarin Android 4.17+ -* Android SDK (L Preview) -![Android L Notifications application screenshot](Screenshots/HeadsUp.png "Android L Notifications application screenshot") +- Xamarin Studio 5.3+ +- Xamarin Android 4.17+ +- Android SDK (L Preview) -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/Topeka/README.md b/android5.0/Topeka/README.md index 6fe291b..b1cae3d 100644 --- a/android5.0/Topeka/README.md +++ b/android5.0/Topeka/README.md @@ -1,27 +1,28 @@ --- name: Xamarin.Android - Topeka for Android -description: A quiz game that showcases material design on Android. This sample makes use of JSON.NET, SQLite.NET and heavy principles of Material Design. You... +description: "A quiz game that showcases material design on Android. This sample also makes use of JSON.NET and SQLite.NET (game)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop + - game urlFragment: android50-topeka --- # Topeka for Android A quiz game that showcases material design on Android. This sample makes use of JSON.NET, SQLite.NET and heavy principles of [Material Design](https://www.google.com/design/spec/material-design/introduction.html). You can read all about the original sample on the [Android Developers blog](http://android-developers.blogspot.co.uk/2015/06/more-material-design-with-topeka-for_16.html). -### Screenshots +## Screenshots -<img src="Screenshots/Screenshot1.png" width="30%" /> -<img src="Screenshots/Screenshot2.png" width="30%" /> -<img src="Screenshots/Screenshot3.png" width="30%" /> +![Sign in screen](Screenshots/Screenshot1.png) +![Game menu](Screenshots/Screenshot2.png) +![Screen with music playing](Screenshots/Screenshot3.png) -#![Topeka for Android application screenshot](Screenshots/Screenshot1.png "Topeka for Android application screenshot") - -## Authors +## License Copyright (c) 2015 Google, Inc. Ported from [Topeka for Android](https://github.com/googlesamples/android-topeka) -Ported to Xamarin.Android by Aaron Sky
dotnet/android-samples
f53f2910eff74dabc4e131c5fa75937ef9a76e65
fix bad yaml
diff --git a/BasicTableAndroid/README.md b/BasicTableAndroid/README.md index 59ac528..b33f46c 100644 --- a/BasicTableAndroid/README.md +++ b/BasicTableAndroid/README.md @@ -1,16 +1,16 @@ --- name: Xamarin.Android - Basic Table Android description: This sample is part of the Android ListViews and Adapters series. page_type: sample languages: - csharp products: - xamarin -- extensions: +extensions: tags: - ui urlFragment: basictableandroid --- # Basic Table Android This sample is part of the [Xamarin.Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). diff --git a/BatchStepSensor/README.md b/BatchStepSensor/README.md index ef7a060..ad034dd 100644 --- a/BatchStepSensor/README.md +++ b/BatchStepSensor/README.md @@ -1,24 +1,24 @@ --- name: Xamarin.Android - Batch Step Sensor description: "How to set up and use Android 4.4's step counting APIs with batching – multiple step events... (Android KitKat)" page_type: sample languages: - csharp products: - xamarin -- extensions: +extensions: tags: - androidkitkat urlFragment: batchstepsensor --- # Batch Step Sensor for Xamarin.Android This sample demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events before returning them to the application.) ## How to Build and Run this Sample To build, install Visual Studio with Mobile Development for .NET (Xamarin) workload, open the project and build. In order to fully use this sample, you should deploy to a device that had step counting sensors. This sample requires Android 4.4 (KitKat). ![Screenshot with sensor batching options](Screenshots/Sensor registration.png) diff --git a/BorderlessButtons/README.md b/BorderlessButtons/README.md index 612c4f0..31763a3 100644 --- a/BorderlessButtons/README.md +++ b/BorderlessButtons/README.md @@ -1,21 +1,21 @@ --- name: Xamarin.Android - Borderless Buttons description: "Demonstrates the borderless button styling from the Holo visual language (UI)" page_type: sample languages: - csharp products: - xamarin -- extensions: +extensions: tags: - ui urlFragment: borderlessbuttons --- # Borderless Buttons This sample demonstrates the **borderless button** styling from the Holo visual language. The most interesting bits in this sample are in the layout files (res/layout/). See [borderless buttons](http://developer.android.com/design/building-blocks/buttons.html#borderless) at the Android Design guide for a discussion of this visual style. Based on the Google Android-18 sample "BorderlessButtons". diff --git a/CardEmulation/Readme.md b/CardEmulation/Readme.md index a21aeb5..4674c0f 100644 --- a/CardEmulation/Readme.md +++ b/CardEmulation/Readme.md @@ -1,32 +1,32 @@ --- -name: Xamarin.Android - CardEmulation Sample +name: Xamarin.Android - Card Emulation Sample description: "Demonstrates the use of the new Host Card Emulation (HCE) APIs in Android 4.4 (KitKat)" page_type: sample languages: - csharp products: - xamarin -- extensions: +extensions: tags: - androidkitkat urlFragment: cardemulation --- -# CardEmulation Sample +# Card Emulation Sample This sample demonstrates the use of the new Host Card Emulation (HCE) APIs in Android 4.4 (KitKat). This sample also demonstrates how to declare an Android service using C# attributes (CardService.cs) which will be automatically added to the AnroidManifest.xml. ## Instructions * In order to run this sample, you will need two NFC-capable physical devices. One with this project (CardEmulation) installed, and another with the CardReader sample installed. Run each on the device it was installed on, then place the backs of the two devices together in order to allow NFC communication to occur. ## Build Requirements Download the latest version of Xamarin Studio. Open CardEmulation.sln in Xamarin Studio and either build or run the project. ![CardEmulation Sample application screenshot](Screenshots/Main - No Log.png "CardEmulation Sample application screenshot") ## License Copyright (c) 2005-2008, The Android Open Source Project
dotnet/android-samples
8c685aeca24a45c8d97e9d6f969de7aae55e1901
updating yaml for more Android5 samples
diff --git a/ApplicationFundamentals/FingerPaint/README.md b/ApplicationFundamentals/FingerPaint/README.md index f95d129..73f97c8 100644 --- a/ApplicationFundamentals/FingerPaint/README.md +++ b/ApplicationFundamentals/FingerPaint/README.md @@ -1,15 +1,15 @@ --- name: "Xamarin.Android - Multi-Touch Tracking" description: "FingerPaint sample for multi-touch tracking" page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-fingerpaint --- # Multi-Touch Tracking in Android -FingerPaint sample for [Multi-Touch Tracking](https://docs.microsoft.com/xamarin/android/app-fundamentals/touch/touch-tracking) +FingerPaint sample for the [Multi-Touch Tracking](https://docs.microsoft.com/xamarin/android/app-fundamentals/touch/touch-tracking) Xamarin.Android doc. ![Multi-Touch Tracking screenshot](Screenshots/image01.png) diff --git a/BatchStepSensor/README.md b/BatchStepSensor/README.md index 13e605c..ef7a060 100644 --- a/BatchStepSensor/README.md +++ b/BatchStepSensor/README.md @@ -1,22 +1,24 @@ --- -name: Xamarin.Android - BatchStepSensor -description: "Demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events..." +name: Xamarin.Android - Batch Step Sensor +description: "How to set up and use Android 4.4's step counting APIs with batching – multiple step events... (Android KitKat)" page_type: sample languages: - csharp products: - xamarin - extensions: tags: - androidkitkat urlFragment: batchstepsensor --- -# BatchStepSensor +# Batch Step Sensor for Xamarin.Android This sample demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events before returning them to the application.) ## How to Build and Run this Sample To build, install Visual Studio with Mobile Development for .NET (Xamarin) workload, open the project and build. In order to fully use this sample, you should deploy to a device that had step counting sensors. This sample requires Android 4.4 (KitKat). + +![Screenshot with sensor batching options](Screenshots/Sensor registration.png) diff --git a/BluetoothChat/README.md b/BluetoothChat/README.md index 645a287..055d7a3 100644 --- a/BluetoothChat/README.md +++ b/BluetoothChat/README.md @@ -1,17 +1,20 @@ --- name: Xamarin.Android - Bluetooth Chat description: "Port of the Android BluetoothChat sample. It demonstrates using the Bluetooth APIs to create a sample chat client" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - bluetooth urlFragment: bluetoothchat --- # Bluetooth Chat This is a port of the [Android BluetoothChat sample](https://github.com/googlesamples/android-BluetoothChat). It demonstrates using the Bluetooth APIs to create a sample chat client. This sample has a MinSDK of API level 23 (Android 6.0) and targets API level 27 (Android 8.1). diff --git a/android5.0/DirectorySelection/README.md b/android5.0/DirectorySelection/README.md index 9c9b699..bb3df3a 100644 --- a/android5.0/DirectorySelection/README.md +++ b/android5.0/DirectorySelection/README.md @@ -1,42 +1,43 @@ --- name: Xamarin.Android - Directory Selection Sample -description: This sample shows how to use the Directory Selection API to let users select an entire directory subtree, which extends the Storage Access... +description: "Use the Directory Selection API to let users select an entire directory subtree, which extends the Storage Access... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-directoryselection --- # Directory Selection Sample This sample shows how to use the Directory Selection API to let users select an entire directory subtree, which extends the Storage Access Framework introduced in Android 4.4 (API level 19). ## Introduction The Directory Selection API, which was introduced in Android 5.0 (API level 21) extends the Storage Access Framework to let users select an entire directory subtree, giving apps read/write access to all contained documents without requiring user confirmation for each item. ## Instructions * Tap on the "Open Directory" button * Select any directory * Observe the app displaying the contents of the folder * Tap on the "Create Directory" button, create a directory with any name * Observe the newly created directory being listed in addition to the already existing contents ## Build Requirements + Using this sample requires the Android SDK platform for Android 5.0 (API level 21). ## Screenshots -<img src="Screenshots/1-landing-page.png" height="400" alt="Screenshot"/> <img src="Screenshots/2-directory-selection.png" height="400" alt="Screenshot"/> <img src="Screenshots/3-open-directory.png" height="400" alt="Screenshot"/> <img src="Screenshots/4-create-directory.png" height="400" alt="Screenshot"/> <img src="Screenshots/5-created-directory.png" height="400" alt="Screenshot"/> +![Android app showing file operations](Screenshots/5-created-directory.png) -![Directory Selection Sample application screenshot](Screenshots/1-landing-page.png "Directory Selection Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android DirectorySelection Sample](https://github.com/googlesamples/android-DirectorySelection) - -Ported to Xamarin.Android by Dylan Kelly diff --git a/android5.0/DocumentCentricApps/README.md b/android5.0/DocumentCentricApps/README.md index 9b4bf5a..4d21704 100644 --- a/android5.0/DocumentCentricApps/README.md +++ b/android5.0/DocumentCentricApps/README.md @@ -1,31 +1,34 @@ --- -name: Xamarin.Android - DocumentCentricApps -description: This sample demonstrates the basic usage of the new Document-Centric Apps API. Instructions Run the project Tap the Create New Document button to... +name: Xamarin.Android - Document Centric Apps +description: "Demonstrates the basic usage of the new Document-Centric Apps API (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-documentcentricapps --- # DocumentCentricApps This sample demonstrates the basic usage of the new Document-Centric Apps API. ## Instructions * Run the project * Tap the Create New Document button to show a new document activity. * Enable the Task per document checkbox to make it so that each document is a new document in the task manager. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.20+ * Android SDK v21 ![DocumentCentricApps application screenshot](Screenshots/MainActivity.png "DocumentCentricApps application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/DocumentCentricRelinquishIdentity/README.md b/android5.0/DocumentCentricRelinquishIdentity/README.md index a072281..ebd7398 100644 --- a/android5.0/DocumentCentricRelinquishIdentity/README.md +++ b/android5.0/DocumentCentricRelinquishIdentity/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - DocumentCentricRelinquishIdentity -description: This sample demonstrates how to change the label of a document activity in recents using the Document-Centric API. Instructions Run the project Tap... +description: "Demonstrates how to change the label of a document activity in recents using the Document-Centric API (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-documentcentricrelinquishidentity --- # DocumentCentricRelinquishIdentity This sample demonstrates how to change the label of a document activity in recents using the Document-Centric API. ## Instructions * Run the project * Tap the Create New Document button to show a new document activity. * Enable the Task per document checkbox to make it so that each document is a new document in the task manager. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.20+ * Android SDK v21 ![DocumentCentricRelinquishIdentity application screenshot](Screenshots/New Label.png "DocumentCentricRelinquishIdentity application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/DrawableTinting/README.md b/android5.0/DrawableTinting/README.md index ca4d606..644def8 100644 --- a/android5.0/DrawableTinting/README.md +++ b/android5.0/DrawableTinting/README.md @@ -1,35 +1,37 @@ --- name: Xamarin.Android - Drawable Tinting -description: Sample that shows applying tinting and color filters to Drawables both programmatically and as Drawable resources in XML Tinting is set on a... +description: "Shows applying tinting and color filters to Drawables both programmatically and as Drawable resources in XML (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-drawabletinting --- # Drawable Tinting Sample that shows applying tinting and color filters to Drawables both programmatically and as Drawable resources in XML Tinting is set on a nine-patch drawable through the "tint" and "tintMode" parameters.A color state list is referenced as the tint color, which defines colors for different states of a View (for example disabled/enabled, focused, pressed or selected). Programmatically, tinting is applied to a Drawable through its "setColorFilter" method, with a reference to a color and a PorterDuff blend mode. The color and blend mode can be changed from the UI to see the effect of different options. ## Instructions * Run the project * Adjust the sliders and tint mode and see how it affects the images on the screen * To see the log output, tap the Show Log button ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ * Android SDK (L Preview) ![Drawable Tinting application screenshot](Screenshots/Screenshot_2014-10-07-16-08-12.png "Drawable Tinting application screenshot") -## Author +## License Copyright 2014 The Android Open Source Project - -Ported to Xamarin.Android by John Pilczak diff --git a/android5.0/ElevationBasic/README.md b/android5.0/ElevationBasic/README.md index 0b16262..da7280a 100644 --- a/android5.0/ElevationBasic/README.md +++ b/android5.0/ElevationBasic/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Elevation Basic -description: This sample demonstrates two alternative ways to move a view in the z-axis. The first view has a fixed elevation using XML and the second one is... +description: "Demonstrates two alternative ways to move a view in the z-axis. The first view has a fixed elevation using XML... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-elevationbasic --- # Elevation Basic This sample demonstrates two alternative ways to move a view in the z-axis. The first view has a fixed elevation using XML and the second one is raised when the user taps on it, using TranslationZ = (int). This layering is part of Android's new [Material Design](https://developer.android.com/preview/material/index.html) ## Instructions * Run the project * Click on the purple square to raise the view. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ ![Elevation Basic application screenshot](Screenshots/down.png "Elevation Basic application screenshot") -## Author -Copyright (c) 2013, The Android Open Source Project +## License -Ported to Xamarin.Android by Ben O'Halloran +Copyright (c) 2013, The Android Open Source Project diff --git a/android5.0/ElevationDrag/README.md b/android5.0/ElevationDrag/README.md index a74db35..fb43db0 100644 --- a/android5.0/ElevationDrag/README.md +++ b/android5.0/ElevationDrag/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Elevation Drag -description: This sample demonstrates a drag and drop action on different shapes. Elevation and z-translation are used to render the shadows. The views are... +description: "Demonstrates a drag and drop action on different shapes. Elevation and z-translation are used to render the shadows (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-elevationdrag --- # Elevation Drag This sample demonstrates a drag and drop action on different shapes. Elevation and z-translation are used to render the shadows. The views are clipped using different outlines. Elevation and z-translation are part of Android's new [Material Design](https://developer.android.com/preview/material/index.html). ## Instructions * Run the project * Click on the purple square to raise the view. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ ![Elevation Drag application screenshot](Screenshots/circle.png "Elevation Drag application screenshot") -## Author -Copyright (c) 2013, The Android Open Source Project +## License -Ported to Xamarin.Android by Ben O'Halloran +Copyright (c) 2013, The Android Open Source Project diff --git a/android5.0/FloatingActionButtonBasic/README.md b/android5.0/FloatingActionButtonBasic/README.md index 3b2ab00..a613138 100644 --- a/android5.0/FloatingActionButtonBasic/README.md +++ b/android5.0/FloatingActionButtonBasic/README.md @@ -1,30 +1,33 @@ --- name: Xamarin.Android - Floating Action Button Basic -description: This sample shows the two sizes of Floating Action Buttons and how to interact with them. Instructions Run the project Click on each floating... +description: "Shows the two sizes of Floating Action Buttons and how to interact with them. Instructions Run the project Click on each floating..." page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-floatingactionbuttonbasic --- # Floating Action Button Basic This sample shows the two sizes of Floating Action Buttons and how to interact with them. ## Instructions * Run the project * Click on each floating action button to check or uncheck the button. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ * Android SDK (L Preview) ![Floating Action Button Basic application screenshot](Screenshots/Checked.png "Floating Action Button Basic application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/Interpolator/README.md b/android5.0/Interpolator/README.md index 7fdd73a..1560bb9 100644 --- a/android5.0/Interpolator/README.md +++ b/android5.0/Interpolator/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Interpolator -description: This sample demonstrates the use of animation interpolators and path animations for Material Design. It shows how an ObjectAnimator is used to... +description: "Demonstrates the use of animation interpolators and path animations for Material Design (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-interpolator --- # Interpolator This sample demonstrates the use of animation interpolators and path animations for Material Design. It shows how an ObjectAnimator is used to animate two properties of a view (scale X and Y) along a path. ## Instructions * Run the project * Adjust which interpolator type to use along with the duration of the interpolation using the Spinner and SeekBar respectively. * Tap the "Animate!" button to show an interpolation with the desired settings on the purple rectangle. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ * Android SDK (L Preview) ![Interpolator application screenshot](Screenshots/After.png "Interpolator application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/JobScheduler/README.md b/android5.0/JobScheduler/README.md index 42395c9..27e4451 100644 --- a/android5.0/JobScheduler/README.md +++ b/android5.0/JobScheduler/README.md @@ -1,32 +1,38 @@ --- name: Xamarin.Android - Job Scheduler -description: This sample demonstrates the new JobScheduler API. The JobScheduler API is part of Android-L's 'Project Volta' which provides new APIs to increase... +description: "Demonstrates the new JobScheduler API. The JobScheduler API is part of Android-L's 'Project Volta' which provides new APIs (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-jobscheduler --- # Job Scheduler + This sample demonstrates the new JobScheduler API. The JobScheduler API is part of Android-L's 'Project Volta' which provides new APIs to increase battery life. -JobScheduler allows applications to request non-user facing tasks to be run by the Android system in such a way as to maximize battery life. +JobScheduler allows applications to request non-user facing tasks to be run by the Android system in such a way as to maximize battery life. This sample doesn't do any actual 'work', but demonstrates how to use the API. ## Instructions + * Select any parameters from the main screen to restrict when the job can run. * Set a small deadline time. Android will automatically run the job after the deadline has passed. * Hit 'Schedule Job' * The job will begin running no latter than the deadline. When the job begins, onStartTask will light up green. * When the job terminates, onStopTask will light up red. ## Build Requirements + Download the latest version of Xamarin Studio. Open JobScheduler.sln in Xamarin Studio and run the project. This project requires the API level 21 (L) SDK platform. ![Job Scheduler application screenshot](Screenshots/main.png "Job Scheduler application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Ben O'Halloran diff --git a/android5.0/KitchenSink/README.md b/android5.0/KitchenSink/README.md index 82a354a..2f7430f 100644 --- a/android5.0/KitchenSink/README.md +++ b/android5.0/KitchenSink/README.md @@ -1,36 +1,40 @@ --- name: Xamarin.Android - Android L Kitchen Sink -description: Basic samples of new Android L features including support v7. Features Activity Transitions CardView Elevation RecyclerView Material Themes Tinting... +description: "Examples of new Android L features: Activity Transitions CardView Elevation RecyclerView Material Themes Tinting... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-kitchensink --- # Android L Kitchen Sink Basic samples of new Android L features including support v7. ## Features + * Activity Transitions * CardView * Elevation * RecyclerView * Material Themes * Tinting * Lollipop Notifications * Palette * Reveal ## Build Requirements + * Xamarin Studio 5.5+ * Xamarin Android 4.20+ * Android SDK with Android 5.0 ![Android L Kitchen Sink application screenshot](Screenshots/CardView.png "Android L Kitchen Sink application screenshot") -## Author -Copyright 2014 Xamarin +## License -Created by James Montemagno +Copyright 2014 Xamarin diff --git a/android5.0/MediaBrowserService/README.md b/android5.0/MediaBrowserService/README.md index f1301e0..d027b80 100644 --- a/android5.0/MediaBrowserService/README.md +++ b/android5.0/MediaBrowserService/README.md @@ -1,25 +1,28 @@ --- name: Xamarin.Android - MediaBrowserService -description: This sample demonstrates how to implement a media player app the new MediaBrowserService API introduced in Android Lollipop. MediaBrowserService... +description: "How to implement a media player app with the MediaBrowserService API. It exposes a media-playing interface... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-mediabrowserservice --- # MediaBrowserService This sample demonstrates how to implement a media player app the new MediaBrowserService API introduced in Android Lollipop. MediaBrowserService exposes a system-standard media-playing interface that is usable with notifications, Android Auto, and between apps. ## Build Requirements + Using this sample requires the Android SDK platform for Android 5.0 (API level 21). ![MediaBrowserService application screenshot](Screenshots/Screenshot1.png "MediaBrowserService application screenshot") -## Authors +## License + Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android MediaBrowserService Sample](https://github.com/googlesamples/android-MediaBrowserService) - -Ported to Xamarin.Android by Aaron Sky \ No newline at end of file diff --git a/android5.0/NavigationDrawer/README.md b/android5.0/NavigationDrawer/README.md index fcea614..d34f129 100644 --- a/android5.0/NavigationDrawer/README.md +++ b/android5.0/NavigationDrawer/README.md @@ -1,47 +1,54 @@ --- -name: Xamarin.Android - NavigationDrawer -description: This example illustrates a common usage of the DrawerLayout widget in the Android support library. When a navigation (left) drawer is present, the... +name: Xamarin.Android - Navigation Drawer +description: :Usage of the DrawerLayout widget in the Android support library. When a navigation (left) drawer is present, the... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-navigationdrawer --- # NavigationDrawer - This example illustrates a common usage of the DrawerLayout widget + +This example illustrates a common usage of the DrawerLayout widget in the Android support library. When a navigation (left) drawer is present, the host activity should detect presses of the action bar's Up affordance as a signal to open and close the navigation drawer. The ActionBarDrawerToggle facilitates this behavior. - Items within the drawer should fall into one of two categories: - * **View switches**. A view switch follows the same basic policies as + Items within the drawer should fall into one of two categories: + +- **View switches**. A view switch follows the same basic policies as list or tab navigation in that a view switch does not create navigation history. This pattern should only be used at the root activity of a task, leaving some form of Up navigation active for activities further down the navigation hierarchy. - * **Selective Up**. The drawer allows the user to choose an alternate +- **Selective Up**. The drawer allows the user to choose an alternate parent for Up navigation. This allows a user to jump across an app's navigation hierarchy at will. The application should treat this as it treats Up navigation from a different task, replacing the current task stack using TaskStackBuilder or similar. This is the only form of navigation drawer that should be used outside of the root activity of a task. Right side drawers should be used for actions, not navigation. This follows the pattern established by the Action Bar that navigation should be to the left and actions to the right. An action should be an operation performed on the current contents of the window, for example enabling or disabling a data overlay on top of the current content. ## Instructions -* Select 'Navigation Drawer Example' from the main screen -* Bring up the Navigation Drawer by hitting the three horizontal bars or by swipping in from the left side of the device -* Select a planet to display + +- Select 'Navigation Drawer Example' from the main screen +- Bring up the Navigation Drawer by hitting the three horizontal bars or by swipping in from the left side of the device +- Select a planet to display ## Build Requirements -* Xamarin Studio 5.3+ -* Xamarin Android 4.17+ + +- Xamarin Studio 5.3+ +- Xamarin Android 4.17+ ![NavigationDrawer application screenshot](Screenshots/drawer open.png "NavigationDrawer application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Ben O'Halloran diff --git a/android5.0/PermissionRequest/README.md b/android5.0/PermissionRequest/README.md index 99fe036..6c77475 100644 --- a/android5.0/PermissionRequest/README.md +++ b/android5.0/PermissionRequest/README.md @@ -1,62 +1,64 @@ --- name: Xamarin.Android - Permission Request Sample -description: This sample demonstrates how to use the PermissionRequest API to securely provide access to restricted system features (such as a camera or... +description: "How to use the PermissionRequest API to securely provide access to restricted system features, such as a camera or... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-permissionrequest --- # Permission Request Sample This sample demonstrates how to use the PermissionRequest API to securely provide access to restricted system features (such as a camera or microphone) from within a WebView. In this example, a dialog is created to allow users to explicitly approve or reject each request. ## Introduction PermissionRequest can be used by setting up a custom WebChromeClient. ```csharp mWebView.SetWebChromeClient(mWebChromeClient); ``` In you WebChromeClient implementation, you need to override OnPermissionRequest. This method is called when the web content is requesting permission to access some resources, providing an opportunity to approve or reject the request. In this implementation, we display a dialog to allow the user to approve or reject any request. In other applications, you may want to implement a whitelist of allowed APIs. Also, override OnPermissionRequestCanceled for handling cancellation of the PermissionRequest by the web content. When the user confirms or denies the request, you can respond back to the web content by grant or deny respectively. + ## Instructions * Tap on the "Start" button * Grant permission for android.webkit.resource.VIDEO_CAPTURE * Observe camera turn on * Tap on the "Stop" button * Tap on the "Start" button * Do not grant permission for android.webkit.resource.VIDEO_CAPTURE * Observe camera does not turn on ## Build Requirements + Using this sample requires the Android SDK platform for Android 5.0 (API level 21). ## Screenshots -<img src="Screenshots/1-permission-request.png" height="400" alt="Screenshot"/> <img src="Screenshots/2-permission-granted.png" height="400" alt="Screenshot"/> +![Android permission request popup](Screenshots/1-permission-request.png) -![Permission Request Sample application screenshot](Screenshots/1-permission-request.png "Permission Request Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android PermissionRequest Sample](https://github.com/googlesamples/android-permissionRequest) - -Ported to Xamarin.Android by Dylan Kelly \ No newline at end of file diff --git a/android5.0/RecyclerViewSample/README.md b/android5.0/RecyclerViewSample/README.md index 22a4955..10e4cf7 100644 --- a/android5.0/RecyclerViewSample/README.md +++ b/android5.0/RecyclerViewSample/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - RecyclerView -description: Demonstration of using RecyclerView with a LinearLayoutManager to create a vertical ListView. Instructions Run the project Tap the Show Log button... +description: "Use RecyclerView with a LinearLayoutManager to create a vertical ListView (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-recyclerviewsample --- # RecyclerView Demonstration of using RecyclerView with a LinearLayoutManager to create a vertical ListView. ## Instructions * Run the project * Tap the Show Log button to show the log * Scroll through the elements and watch the log to see the RecyclerView in action. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ * Android SDK (L Preview) ![RecyclerView application screenshot](Screenshots/Screenshot.png "RecyclerView application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/RecyclerViewer/README.md b/android5.0/RecyclerViewer/README.md index 8371909..14c494c 100755 --- a/android5.0/RecyclerViewer/README.md +++ b/android5.0/RecyclerViewer/README.md @@ -1,36 +1,39 @@ --- name: Xamarin.Android - RecyclerViewer -description: This sample app accompanies the articles CardView and RecyclerView. You can use this sample to learn how to use the new CardView and RecyclerView... +description: "Sample for the CardView and RecyclerView docs. Use this sample to learn how to use the new CardView and RecyclerView... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-recyclerviewer --- # RecyclerViewer This sample app accompanies the articles [CardView](https://docs.microsoft.com/xamarin/android/user-interface/controls/card-view) and [RecyclerView](https://docs.microsoft.com/xamarin/android/user-interface/layouts/recycler-view/). You can use this sample to learn how to use the new `CardView` and `RecyclerView` widgets introduced with Android 5.0 Lollipop. This app is a simple "Photo Album Viewer" that lets the user scroll up and down to view a collection of photos. Each photo, which consists of an image with caption text, is displayed as a row item in the `RecyclerView`. The **Random Pick** button randomly swaps a photo in the collection with the first photo to demonstrate how `RecyclerView` is updated when the data set changes. When the user taps a photo, a toast appears to display the number of the photo within the collection &ndash; this demonstrates how item view click handlers work. Each image/caption (photo) row item is displayed in a `CardView` layout, and the app uses a single `RecyclerView` layout to hold and display over thirty unique row items. An *adapter* is used to connect the `RecyclerView` with a simple "Photo Album" database, a *view-holder* is used to cache view references, and a linear *layout manager* positions the `CardView` row items within the `RecyclerView`. ![RecyclerViewer application screenshot](Screenshots/screen-1.png "RecyclerViewer application screenshot") diff --git a/android5.0/RevealEffectBasic/README.md b/android5.0/RevealEffectBasic/README.md index 8e12473..8feb0f3 100644 --- a/android5.0/RevealEffectBasic/README.md +++ b/android5.0/RevealEffectBasic/README.md @@ -1,30 +1,33 @@ --- name: Xamarin.Android - Reveal Effect Basic -description: Basic sample to demonstrate the reveal effect. Instructions Run the project Click on the Reveal button to demonstrate the reveal effect on the... +description: "Demonstrates the reveal effect (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-revealeffectbasic --- # Reveal Effect Basic Basic sample to demonstrate the reveal effect. ## Instructions * Run the project * Click on the "Reveal" button to demonstrate the reveal effect on the purple square. ## Build Requirements + * Xamarin Studio 5.3+ * Xamarin Android 4.17+ * Android SDK (L Preview) ![Reveal Effect Basic application screenshot](Screenshots/Screenshot.png "Reveal Effect Basic application screenshot") -## Author -Copyright 2014 The Android Open Source Project +## License -Ported to Xamarin.Android by John Pilczak +Copyright 2014 The Android Open Source Project diff --git a/android5.0/ScreenCapture/README.md b/android5.0/ScreenCapture/README.md index b3952e6..9e2a9bb 100644 --- a/android5.0/ScreenCapture/README.md +++ b/android5.0/ScreenCapture/README.md @@ -1,33 +1,35 @@ --- name: Xamarin.Android - ScreenCapture -description: This sample demonstrates how to use Media Projection API to capture device screen in real time and show it on a SurfaceView. Instructions Launch... +description: "Demonstrates how to use Media Projection API to capture device screen in real time and show it on a SurfaceView (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-screencapture --- # ScreenCapture This sample demonstrates how to use Media Projection API to capture device screen in real time and show it on a SurfaceView. ## Instructions + * Launch the app on a Lollipop device or emulator. * On devices with display widths under 720dp, tap the Show Log button to show the sample's log. -* Tap the start button to start capturing the screen and displaying it in the ScreenCaptureFragment's SurfaceView. +* Tap the start button to start capturing the screen and displaying it in the ScreenCaptureFragment's SurfaceView. ## Build Requirements * Xamarin.Android 4.20 * Android SDK v21 * Android Support Repository * Android Build Tools v21.1.1 ![ScreenCapture application screenshot](Screenshots/Screen Capture.png "ScreenCapture application screenshot") -## Author +## License Copyright 2014 The Android Open Source Project, Inc. - -Ported to Xamarin.Android by John Pilczak
dotnet/android-samples
61b1224d0e146d5a9c380eebad98fcefaa31089d
header yaml updates
diff --git a/AccessoryViews/README.md b/AccessoryViews/README.md index 5c3d9ec..d253ebc 100644 --- a/AccessoryViews/README.md +++ b/AccessoryViews/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - AccessoryViews -description: This sample is part of the Android ListViews and Adapters series. +description: "How to add an accessory view to a ListView" page_type: sample languages: - csharp products: - xamarin urlFragment: accessoryviews --- # Xamarin.Android AccessoryViews This sample is part of the Android ListViews and Adapters [documentation](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). diff --git a/CalendarDemo/README.md b/CalendarDemo/README.md index e15ba49..4ad5d0a 100644 --- a/CalendarDemo/README.md +++ b/CalendarDemo/README.md @@ -1,14 +1,16 @@ --- name: Xamarin.Android - Calendar Demo -description: This example shows how to use the calendar API to list calendars and events. It also shows how to add an event and view it using the built-in... +description: "Shows how to use the calendar API to list calendars and events. It also shows how to add an event and view it..." page_type: sample languages: - csharp products: - xamarin urlFragment: calendardemo --- # Calendar Demo This example shows how to use the calendar API to list calendars and events. It also shows how to add an event and view it using the built-in calendar app. + +![Demo of a calendar with two events](Screenshots/Calendar1.png) diff --git a/CardEmulation/Readme.md b/CardEmulation/Readme.md index 9dc26cd..a21aeb5 100644 --- a/CardEmulation/Readme.md +++ b/CardEmulation/Readme.md @@ -1,27 +1,32 @@ --- name: Xamarin.Android - CardEmulation Sample -description: This sample demonstrates the use of the new Host Card Emulation (HCE) APIs in Android 4.4 (KitKat). This sample also demonstrates how to declare an... +description: "Demonstrates the use of the new Host Card Emulation (HCE) APIs in Android 4.4 (KitKat)" page_type: sample languages: - csharp products: - xamarin +- extensions: + tags: + - androidkitkat urlFragment: cardemulation --- # CardEmulation Sample + This sample demonstrates the use of the new Host Card Emulation (HCE) APIs in Android 4.4 (KitKat). This sample also demonstrates how to declare an Android service using C# attributes (CardService.cs) which will be automatically added to the AnroidManifest.xml. ## Instructions + * In order to run this sample, you will need two NFC-capable physical devices. One with this project (CardEmulation) installed, and another with the CardReader sample installed. Run each on the device it was installed on, then place the backs of the two devices together in order to allow NFC communication to occur. ## Build Requirements + Download the latest version of Xamarin Studio. Open CardEmulation.sln in Xamarin Studio and either build or run the project. ![CardEmulation Sample application screenshot](Screenshots/Main - No Log.png "CardEmulation Sample application screenshot") -## Author -Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Christopher Blackman +## License +Copyright (c) 2005-2008, The Android Open Source Project diff --git a/CardReader/README.md b/CardReader/README.md index 155c87d..6bafc39 100644 --- a/CardReader/README.md +++ b/CardReader/README.md @@ -1,24 +1,27 @@ --- name: Xamarin.Android - CardReader -description: This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data. This sample... +description: This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data page_type: sample languages: - csharp products: - xamarin urlFragment: cardreader --- # CardReader + This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data. This sample is designed to read the virtual loyalty card implemented in the "CardEmulation" sample. ## Instructions + * In order to run this sample, you will need two NFC-capable physical devices. One with this project (CardEmulation) installed, and another with the CardReader sample installed. Run each on the device it was installed on, then place the backs of the two devices together in order to allow NFC communication to occur. ## Build Requirements + Download the latest version of Xamarin Studio. Open CardReader.sln in Xamarin Studio and either build or run the project. This project requires the API level 19 SDK platform. ![CardReader application screenshot](Screenshots/Screenshot_2014-07-14-13-58-56.png "CardReader application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Sean Pearl diff --git a/ContactManager/README.md b/ContactManager/README.md index 3ff7f4d..f3125ed 100644 --- a/ContactManager/README.md +++ b/ContactManager/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Contact Manager -description: This sample demonstrates how to interact with Android's contact manager. +description: "This sample demonstrates how to interact with Android's contact manager." page_type: sample languages: - csharp products: - xamarin urlFragment: contactmanager --- # Contact Manager This sample demonstrates how to interact with Android's contact manager. diff --git a/ContactsProviderDemo/README.md b/ContactsProviderDemo/README.md index 7f1e05e..fc4f6f6 100644 --- a/ContactsProviderDemo/README.md +++ b/ContactsProviderDemo/README.md @@ -1,14 +1,16 @@ --- name: Xamarin.Android - ContactsProvider Demo -description: This example shows how to use the ContactsProvider as well as the device owner's profile in Android. +description: "This example shows how to use the ContactsProvider as well as the device owner's profile in Android" page_type: sample languages: - csharp products: - xamarin urlFragment: contactsproviderdemo --- # ContactsProvider Demo This example shows how to use the `ContactsProvider` as well as the device owner's profile in Android. + +![Contacts demo app](Screenshots/ContactsProvider.png) diff --git a/ContentProvider/README.md b/ContentProvider/README.md index e3b2352..7e7d698 100644 --- a/ContentProvider/README.md +++ b/ContentProvider/README.md @@ -1,21 +1,21 @@ --- name: Xamarin.Android - Content Provider Demo -description: Just a small example showing how a Content Provider can be implemented in Mono for Android. I used this article as reference. +description: "Example showing how a Content Provider can be implemented in Xamarin.Android" page_type: sample languages: - csharp products: - xamarin urlFragment: contentprovider --- # Content Provider Demo Just a small example showing how a Content Provider can be implemented in Mono for Android. I used this [article](http://www.devx.com/wireless/Article/41133/1954) as reference. ![Content Provider Demo application screenshot](Screenshots/Output.png "Content Provider Demo application screenshot") ## Author Tomasz Cielecki aka [Cheesebaron](https://github.com/Cheesebaron) diff --git a/CursorTableAdapter/README.md b/CursorTableAdapter/README.md index 3a8622e..219f4d8 100644 --- a/CursorTableAdapter/README.md +++ b/CursorTableAdapter/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Cursor Table Adapter description: This sample is part of the Android ListViews and Adapters series. page_type: sample languages: - csharp products: - xamarin urlFragment: cursortableadapter --- # Cursor Table Adapter -This sample is part of the Android ListViews and Adapters series. \ No newline at end of file +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/) diff --git a/CustomRowView/README.md b/CustomRowView/README.md index b8b2358..bab7539 100644 --- a/CustomRowView/README.md +++ b/CustomRowView/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Custom Row Views -description: This sample is part of the Android ListViews and Adapters series. +description: Creating a custom view for a row in a ListView. page_type: sample languages: - csharp products: - xamarin urlFragment: customrowview --- # Custom Row Views -This sample is part of the Android ListViews and Adapters series. \ No newline at end of file +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). \ No newline at end of file diff --git a/CustomTransitions/README.md b/CustomTransitions/README.md index 32ceb05..2e6156a 100644 --- a/CustomTransitions/README.md +++ b/CustomTransitions/README.md @@ -1,25 +1,28 @@ --- name: Xamarin.Android - Custom Transitions -description: This sample demonstrates how to create custom transitions to go from one scene in their app to the next. The transition created in this sample... +description: This sample demonstrates how to create custom transitions to go from one scene in their app to the next page_type: sample languages: - csharp products: - xamarin urlFragment: customtransitions --- # Custom Transitions + This sample demonstrates how to create custom transitions to go from one scene in their app to the next. The transition created in this sample smoothly changes between three scenes which each have three colored boxes with the colors in a different order in each scene. ## Instructions + * Press the "Show next scene" button to cycle the colors using a custom transition. * Press the "Show Log" button to show what is logged as the transitions occur ## Build Requirements + This sample requires the SDK platform level 19 to build and a device that is level 19 or newer to run. ![Custom Transitions application screenshot](Screenshots/Screenshot_2014-07-03-15-58-07.png "Custom Transitions application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by John Pilczak diff --git a/DynamicTest/README.md b/DynamicTest/README.md index b5d1c17..8bac474 100644 --- a/DynamicTest/README.md +++ b/DynamicTest/README.md @@ -1,23 +1,23 @@ --- name: Xamarin.Android - C# Dynamic Test -description: This samples makes use of dynamic types in DLR. This sample imports System.Json from ASP.NET MVC sources which includes JsonValue.AsDynamic() which... +description: "This samples makes use of dynamic types in DLR. It imports System.Json from ASP.NET MVC sources which includes JsonValue.AsDynamic()" page_type: sample languages: - csharp products: - xamarin urlFragment: dynamictest --- # C# Dynamic Test This samples makes use of dynamic types in DLR. This sample imports System.Json from ASP.NET MVC sources which includes JsonValue.AsDynamic() which allows users to directly specify object keys as field names. This sample retrieves Twitter public timeline JSON and parses it into the ListAdapter. Hence it requires internet access (and working twitter). Bonus: You can also add reference to mono-reactive for Android from https://github.com/atsushieno/mono-reactive , add REACTIVE symbol to compiler options and get things done asynchronously. diff --git a/Example_WorkingWithAudio/README.md b/Example_WorkingWithAudio/README.md index 209c1d2..25239d4 100644 --- a/Example_WorkingWithAudio/README.md +++ b/Example_WorkingWithAudio/README.md @@ -1,22 +1,22 @@ --- name: Xamarin.Android - Working With Audio – Test Application -description: 'Sample code to accompany the article Working With Audio. This simple application provides the following functionality: Recording audio using the...' +description: 'Sample code to accompany the article Working With Audio' page_type: sample languages: - csharp products: - xamarin urlFragment: example-workingwithaudio --- # Working With Audio – Test Application -Sample code to accompany the article Working With Audio. This simple application provides the following functionality: +Sample code to accompany the article [Working With Audio](https://docs.microsoft.com/xamarin/android/app-fundamentals/android-audio). This simple application provides the following functionality: * Recording audio using the high-level API (MediaRecorder.) * Playing audio using the high-level API (MediaPlayer.) * Recording audio using the low-level API (AudioRecord.) * Playing audio using the low-level API (AudioTrack.) * Optionally use Audio notifications. One can only play back what has been recorded in the same session. (For this reason, the playback buttons are disabled on start-up.) Once on operation has been started, it must be stopped. No other actions are allowed in the meantime. The best way to demonstrate recording and playback is to record some sound and then play it back again. The best way to see audio notifications in action is to call the test phone, keep the call open for a while and then end the call while there is an ongoing operation. Audio-focus will be taken away and then granted again when the call is complete. diff --git a/ExportAttribute/README.md b/ExportAttribute/README.md index 30e370c..9b246b7 100644 --- a/ExportAttribute/README.md +++ b/ExportAttribute/README.md @@ -1,19 +1,15 @@ --- name: Xamarin.Android - ExportAttributeTest -description: This is a functional test for ExportAttribute which is new in Mono for Android 4.2. This contains sample code for android:onClick,... +description: 'This is a functional test for ExportAttribute which is new in Mono for Android 4.2' page_type: sample languages: - csharp products: - xamarin urlFragment: exportattribute --- # ExportAttributeTest This is a functional test for "ExportAttribute" which is new in Mono for Android 4.2. This contains sample code for android:onClick, java.io.Serializable and android.os.Parcelable. - -## Authors -Atsushi Eno (C# port) - diff --git a/FastScroll/README.md b/FastScroll/README.md index 1818c19..1fb280e 100644 --- a/FastScroll/README.md +++ b/FastScroll/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Fast Scroll -description: This sample is part of the Android ListViews and Adapters series. +description: Implementing fast scroll in a ListView on Android page_type: sample languages: - csharp products: - xamarin urlFragment: fastscroll --- # Fast Scroll -This sample is part of the Android ListViews and Adapters series. \ No newline at end of file +This sample is part of the [Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/) \ No newline at end of file
dotnet/android-samples
1525b9cb12486cc83143bdefded045fdd2d831b6
header yaml updates
diff --git a/ApplicationFundamentals/FingerPaint/README.md b/ApplicationFundamentals/FingerPaint/README.md index 68f687f..193a244 100644 --- a/ApplicationFundamentals/FingerPaint/README.md +++ b/ApplicationFundamentals/FingerPaint/README.md @@ -1,18 +1,15 @@ --- name: Xamarin.Android - Multi-Touch Tracking in Android -description: FingerPaint sample for Multi-Touch Tracking +description: "FingerPaint sample for multi-touch tracking" page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-fingerpaint --- # Multi-Touch Tracking in Android -FingerPaint sample for [Multi-Touch Tracking](/guides/android/application_fundamentals/touch/touch_tracking/) +FingerPaint sample for [Multi-Touch Tracking](https://docs.microsoft.com/xamarin/android/app-fundamentals/touch/touch-tracking) ![Multi-Touch Tracking in Android application screenshot](Screenshots/image01.png "Multi-Touch Tracking in Android application screenshot") - -## Author -Charles Petzold diff --git a/AsyncImageAndroid/README.md b/AsyncImageAndroid/README.md index 342684d..e915a21 100644 --- a/AsyncImageAndroid/README.md +++ b/AsyncImageAndroid/README.md @@ -1,17 +1,21 @@ --- name: Xamarin.Android - AsyncImageAndroid -description: This sample application demonstrates how to use the new Async/Await feature which is available in Xamarin.Android 4.8. The sample download a large... +description: "Demonstrates how to use the new async/await feature" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidpie urlFragment: asyncimageandroid --- # AsyncImageAndroid -This sample application demonstrates how to use the new Async/Await feature which is available in Xamarin.Android 4.8. +This sample application demonstrates how to use the new async/await feature which is available in Xamarin.Android 4.8. The sample download a large image from Internet using the DownloadDataTaskAsync in WebClient. Saving and resizing the image also use the new async feature. -Note: Will not work with AOT + armeabi configuration. +> [!NOTE] +> Will not work with AOT + armeabi configuration. diff --git a/BasicImmersiveMode/README.md b/BasicImmersiveMode/README.md index 3994d5c..a3b9520 100644 --- a/BasicImmersiveMode/README.md +++ b/BasicImmersiveMode/README.md @@ -1,17 +1,22 @@ --- name: Xamarin.Android - Basic Immersive Mode -description: Android 4.4 introduces a way for you to provide a more immersive screen experience in your app, by letting users show or hide the status bar and... +description: Provide a more immersive screen experience in your app, by letting users show or hide the status bar page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidkitkat urlFragment: basicimmersivemode --- # Basic Immersive Mode -Android 4.4 introduces a way for you to provide a more immersive -screen experience in your app, by letting users show or hide + +Android 4.4 introduces a way for you to provide a more immersive +screen experience in your app, by letting users show or hide the status bar and navigation bar with a swipe. This sample demonstrates how to enable and disable this feature programmatically. -See the `Advanced Immersive Mode` sample for more details. \ No newline at end of file + +See the `Advanced Immersive Mode` sample for more details. diff --git a/BasicTableAdapter/README.md b/BasicTableAdapter/README.md index 311d9e7..0fc42a8 100644 --- a/BasicTableAdapter/README.md +++ b/BasicTableAdapter/README.md @@ -1,13 +1,16 @@ --- name: Xamarin.Android - Basic Table Adapter -description: This sample is part of the Android ListViews and Adapters series. +description: This sample is part of the Android ListViews and Adapters series (UI) page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - ui urlFragment: basictableadapter --- # Basic Table Adapter -This sample is part of the Android ListViews and Adapters series. \ No newline at end of file +This sample is part of the [Xamarin.Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). \ No newline at end of file diff --git a/BasicTableAndroid/README.md b/BasicTableAndroid/README.md index beff81b..59ac528 100644 --- a/BasicTableAndroid/README.md +++ b/BasicTableAndroid/README.md @@ -1,13 +1,16 @@ --- name: Xamarin.Android - Basic Table Android description: This sample is part of the Android ListViews and Adapters series. page_type: sample languages: - csharp products: - xamarin +- extensions: + tags: + - ui urlFragment: basictableandroid --- # Basic Table Android -This sample is part of the Android ListViews and Adapters series. \ No newline at end of file +This sample is part of the [Xamarin.Android ListViews and Adapters series](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/). diff --git a/BatchStepSensor/README.md b/BatchStepSensor/README.md index ead6a2f..13e605c 100644 --- a/BatchStepSensor/README.md +++ b/BatchStepSensor/README.md @@ -1,17 +1,22 @@ --- name: Xamarin.Android - BatchStepSensor -description: This sample demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events... +description: "Demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events..." page_type: sample languages: - csharp products: - xamarin +- extensions: + tags: + - androidkitkat urlFragment: batchstepsensor --- # BatchStepSensor + This sample demonstrates how to set up and use Android 4.4's step counting APIs with batching (letting the system collect multiple step events before returning them to the application.) -# How to Build and Run this Sample -To build, install Xamarin Studio or Xamarin for Visual Studio, open the project in your selected IDE and build. In order to fully use this sample, you should deploy to a device that had step counting sensors. +## How to Build and Run this Sample + +To build, install Visual Studio with Mobile Development for .NET (Xamarin) workload, open the project and build. In order to fully use this sample, you should deploy to a device that had step counting sensors. -This sample requires Android 4.4 (KitKat). \ No newline at end of file +This sample requires Android 4.4 (KitKat). diff --git a/BluetoothChat/README.md b/BluetoothChat/README.md index ef656d5..645a287 100644 --- a/BluetoothChat/README.md +++ b/BluetoothChat/README.md @@ -1,17 +1,17 @@ --- name: Xamarin.Android - Bluetooth Chat -description: This is a port of the Android BluetoothChat sample. It demonstrates using the Bluetooth APIs to create a sample chat client. This sample has a... +description: "Port of the Android BluetoothChat sample. It demonstrates using the Bluetooth APIs to create a sample chat client" page_type: sample languages: - csharp products: - xamarin urlFragment: bluetoothchat --- # Bluetooth Chat This is a port of the [Android BluetoothChat sample](https://github.com/googlesamples/android-BluetoothChat). It demonstrates using the Bluetooth APIs to create a sample chat client. This sample has a MinSDK of API level 23 (Android 6.0) and targets API level 27 (Android 8.1). diff --git a/BorderlessButtons/README.md b/BorderlessButtons/README.md index 657ed92..612c4f0 100644 --- a/BorderlessButtons/README.md +++ b/BorderlessButtons/README.md @@ -1,21 +1,21 @@ --- name: Xamarin.Android - Borderless Buttons -description: This sample demonstrates the borderless button styling from the Holo visual language. The most interesting bits in this sample are in the layout... +description: "Demonstrates the borderless button styling from the Holo visual language (UI)" page_type: sample languages: - csharp products: - xamarin +- extensions: + tags: + - ui urlFragment: borderlessbuttons --- # Borderless Buttons This sample demonstrates the **borderless button** styling from the Holo visual language. The most interesting bits in this sample are in the layout files (res/layout/). See [borderless buttons](http://developer.android.com/design/building-blocks/buttons.html#borderless) at the Android Design guide for a discussion of this visual style. Based on the Google Android-18 sample "BorderlessButtons". - -Ported by: Peter Collins -
dotnet/android-samples
c981cd63d0c1e312c3a667008299c63e965e7589
header yaml updates
diff --git a/PlatformFeatures/SimpleContentProvider/README.md b/PlatformFeatures/SimpleContentProvider/README.md index bc408ba..28f412e 100644 --- a/PlatformFeatures/SimpleContentProvider/README.md +++ b/PlatformFeatures/SimpleContentProvider/README.md @@ -1,13 +1,15 @@ --- name: Xamarin.Android - SimpleContentProvider description: Sample for Creating a Custom ContentProvider page_type: sample languages: - csharp products: - xamarin urlFragment: platformfeatures-simplecontentprovider --- -# SimpleContentProvider +# SimpleContentProvider for Xamarin.Android -Sample for [Creating a Custom ContentProvider](http://developer.xamarin.com/guides/android/platform_features/intro_to_content_providers/part_3_-_creating_a_custom_contentprovider/) +Sample for [Creating a Custom ContentProvider](https://docs.microsoft.com/en-us/xamarin/android/platform/content-providers/custom-contentprovider) + +![Screenshots of list using a content provider](Screenshots/ContentProvider.png) diff --git a/PlatformFeatures/SpeechToText/README.md b/PlatformFeatures/SpeechToText/README.md index 41b23e7..65ed29a 100644 --- a/PlatformFeatures/SpeechToText/README.md +++ b/PlatformFeatures/SpeechToText/README.md @@ -1,15 +1,15 @@ --- name: Xamarin.Android - Speech to Text -description: Sample for Android Speech ![](Screenshots/SpeechToText.png) +description: "Sample for Android Speech to Text" page_type: sample languages: - csharp products: - xamarin urlFragment: platformfeatures-speechtotext --- # Speech to Text -Sample for [Android Speech](http://developer.xamarin.com/guides/android/platform_features/speech/) +Sample for [Android Speech](https://docs.microsoft.com/xamarin/android/platform/speech) -![](Screenshots/SpeechToText.png) +![Screenshot with record button to convert speech to text](Screenshots/SpeechToText.png) diff --git a/SystemUIVisibilityDemo/README.md b/SystemUIVisibilityDemo/README.md index f663d50..e377092 100644 --- a/SystemUIVisibilityDemo/README.md +++ b/SystemUIVisibilityDemo/README.md @@ -1,13 +1,15 @@ --- name: Xamarin.Android - System UI Visibility Demo description: This example shows how to change the appearance of the Navigation Bar in Ice Cream Sandwich. page_type: sample languages: - csharp products: - xamarin urlFragment: systemuivisibilitydemo --- # System UI Visibility Demo This example shows how to change the appearance of the Navigation Bar in Ice Cream Sandwich. + +![Three screenshots showing different navigation bar views](Screenshots/SystemUIVisibility.png) \ No newline at end of file diff --git a/TextSwitcher/README.md b/TextSwitcher/README.md index 694d8e7..41082da 100644 --- a/TextSwitcher/README.md +++ b/TextSwitcher/README.md @@ -1,25 +1,24 @@ --- name: Xamarin.Android - TextSwitcher Sample -description: This sample illustrates the use of a TextSwitcher to display animations for text changes. Build Requirements Using this sample requires the Android... +description: "Illustrates the use of a TextSwitcher to display animations for text changes" page_type: sample languages: - csharp products: - xamarin urlFragment: textswitcher --- # TextSwitcher Sample This sample illustrates the use of a TextSwitcher to display animations for text changes. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. ![TextSwitcher Sample application screenshot](Screenshots/Home.png "TextSwitcher Sample application screenshot") -## Authors +## License + Copyright (c) 2016 The Android Open Source Project, Inc. -Ported from [Android TextSwitcher Sample](https://github.com/googlesamples/android-TextSwitcher). -Ported to Xamarin.Android by Gonzalo Martin. \ No newline at end of file +Ported from [Android TextSwitcher Sample](https://github.com/googlesamples/android-TextSwitcher). \ No newline at end of file diff --git a/TextureViewDemo/README.md b/TextureViewDemo/README.md index 01da399..d7ec5fd 100644 --- a/TextureViewDemo/README.md +++ b/TextureViewDemo/README.md @@ -1,17 +1,19 @@ --- name: Xamarin.Android - TextureView Demo -description: This example shows how to use a TextureView with Ice Cream Sandwich. A device is required for this example as the TextureView uses hardware... +description: "Shows how to use a TextureView with Ice Cream Sandwich. A device is required for this example" page_type: sample languages: - csharp products: - xamarin urlFragment: textureviewdemo --- # TextureView Demo This example shows how to use a TextureView with Ice Cream Sandwich. A device is required for this example as the TextureView uses hardware acceleration. -This exmaple is ported from the sample code at http://developer.android.com/reference/android/view/TextureView.html +This example is ported from the sample code at http://developer.android.com/reference/android/view/TextureView.html + +![App showing rotated image as a texture](Screenshots/TextureViewDemo.png) \ No newline at end of file diff --git a/TexturedCube-1.0/README.md b/TexturedCube-1.0/README.md index 1f57542..6b27d0e 100644 --- a/TexturedCube-1.0/README.md +++ b/TexturedCube-1.0/README.md @@ -1,17 +1,18 @@ --- name: Xamarin.Android - GL Textured Cube -description: This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. See Also GLTexturedCube +description: "This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs" page_type: sample languages: - csharp products: - xamarin urlFragment: texturedcube-10 --- # GL Textured Cube This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. ## See Also + * [GLTexturedCube](https://github.com/xamarin/monodroid-samples/tree/master/TexturedCube) diff --git a/TexturedCube/Metadata.xml b/TexturedCube/Metadata.xml deleted file mode 100644 index 4eaf548..0000000 --- a/TexturedCube/Metadata.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<SampleMetadata> - <ID>1ee53aea-8211-4fac-978c-64515b790e7e</ID> - <IsFullApplication>false</IsFullApplication> - <Level>Beginning</Level> - <Tags>Graphics</Tags> - <Gallery>false</Gallery> - <Brief>This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs.</Brief> -</SampleMetadata> diff --git a/TexturedCube/README.md b/TexturedCube/README.md index f9866ca..bfef6ae 100644 --- a/TexturedCube/README.md +++ b/TexturedCube/README.md @@ -1,16 +1,6 @@ ---- -name: Xamarin.Android - GL Textured Cube -description: This sample is now obsolete. Please use TexturedCube-1.0. This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. -page_type: sample -languages: -- csharp -products: -- xamarin -urlFragment: texturedcube ---- # GL Textured Cube ### This sample is now obsolete. Please use TexturedCube-1.0. This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. diff --git a/TexturedCubeES30-1.0/README.md b/TexturedCubeES30-1.0/README.md index 899bb97..0a14b7d 100644 --- a/TexturedCubeES30-1.0/README.md +++ b/TexturedCubeES30-1.0/README.md @@ -1,14 +1,16 @@ --- name: Xamarin.Android - GL Textured Cube -description: This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. +description: "This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs." page_type: sample languages: - csharp products: - xamarin urlFragment: texturedcubees30-10 --- # GL Textured Cube This sample demonstrates a rotating cube rendered with textures via OpenTK's GL APIs. + +![App showing a 3D cube](Screenshots/plain.png) \ No newline at end of file diff --git a/UpdateUsersProfile/README.md b/UpdateUsersProfile/README.md index 5b0c08d..42341fb 100644 --- a/UpdateUsersProfile/README.md +++ b/UpdateUsersProfile/README.md @@ -1,22 +1,22 @@ --- name: Xamarin.Android - Update the User's Profile -description: This sample app accompanies the recipe, Update the User's Profile. This sample creates a display name for the owner of the device (John Doe) and... +description: 'This sample creates a display name for the owner of the device (John Doe) and adds to the user profile' page_type: sample languages: - csharp products: - xamarin urlFragment: updateusersprofile --- # Update the User's Profile in Xamarin.Android This sample app accompanies the recipe, [Update the User's Profile](https://github.com/xamarin/docs-archive/tree/master/Recipes/android/data/contentproviders/update_the_users_profile). This sample creates a display name for the owner of the device ("John Doe") and adds this name to the user profile. The user profile data is read back to confirm that the name was set, then launches the **Contacts** app to view the user's profile. A single screen provides a button that initiates the update and view sequence: ![Update the User's Profile application screenshot](Screenshots/screenshot-1.png "Update the User's Profile application screenshot")
dotnet/android-samples
2346524b9dc9d789485e9d3449b666343feac5f3
header yaml updates
diff --git a/PlatformFeatures/TextToSpeech/README.md b/PlatformFeatures/TextToSpeech/README.md index 3f5e3eb..e77284f 100644 --- a/PlatformFeatures/TextToSpeech/README.md +++ b/PlatformFeatures/TextToSpeech/README.md @@ -1,15 +1,15 @@ --- name: Xamarin.Android - Text to Speech -description: Sample for Android Speech ![](Screenshots/TextToSpeech.png) +description: 'Sample for Android Speech doc' page_type: sample languages: - csharp products: - xamarin urlFragment: platformfeatures-texttospeech --- # Text to Speech -Sample for [Android Speech](http://developer.xamarin.com/guides/android/platform_features/speech/) +Sample for [Android Speech](https://docs.microsoft.com/xamarin/android/platform/speech) -![](Screenshots/TextToSpeech.png) +![Text to speech Android app screenshot](Screenshots/TextToSpeech.png) diff --git a/UserInterface/ActionBarTabs/README.md b/UserInterface/ActionBarTabs/README.md index 2553c14..f991bed 100644 --- a/UserInterface/ActionBarTabs/README.md +++ b/UserInterface/ActionBarTabs/README.md @@ -1,16 +1,16 @@ --- -name: Xamarin.Android - Tabbed Layouts ActionBar Sample -description: This sample app accompanies the article, Tabbed Layouts with the ActionBar. +name: Xamarin.Android - Tabbed Layouts ActionBar +description: 'This sample app accompanies the Tabbed Layouts with the ActionBar doc' page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-actionbartabs --- -# Tabbed Layouts ActionBar Sample - -This sample app accompanies the article, -[Tabbed Layouts with the ActionBar](https://developer.xamarin.com/guides/android/user_interface/tab_layout/actionbar/). +# Tabbed Layouts ActionBar Sample +This sample app accompanies the article, +[Tabbed Layouts with the ActionBar](https://docs.microsoft.com/xamarin/android/user-interface/layouts/tab-layout/with-action-bar). +![Android emulator with action bar tabs](Screenshots/screenshot.png) diff --git a/UserInterface/EditTextSample/README.md b/UserInterface/EditTextSample/README.md index 2802fc1..bd6510b 100755 --- a/UserInterface/EditTextSample/README.md +++ b/UserInterface/EditTextSample/README.md @@ -1,16 +1,16 @@ --- name: Xamarin.Android - Edit Text Sample -description: This sample app accompanies the user interface article, Edit Text. +description: 'This sample app accompanies the user interface article, Edit Text' page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-edittextsample --- -# Edit Text Sample +# Edit Text Sample -This sample app accompanies the user interface article, +This sample app accompanies the user interface article, [Edit Text](https://docs.microsoft.com/xamarin/android/user-interface/controls/edit-text). - +![Screenshot of edit text in an app](Screenshots/01-edit-text-entry.png) diff --git a/UserInterface/FlashCardPager/README.md b/UserInterface/FlashCardPager/README.md index 62b1727..3786cb4 100644 --- a/UserInterface/FlashCardPager/README.md +++ b/UserInterface/FlashCardPager/README.md @@ -1,37 +1,33 @@ --- name: Xamarin.Android - FlashCardPager -description: FlashCardPager is a sample app that accompanies the article, ViewPager. This sample demonstrates how to use ViewPager and PagerTabStrip together to... +description: 'FlashCardPager is a sample app that accompanies the ViewPager doc' page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-flashcardpager --- -# FlashCardPager +# FlashCardPager **FlashCardPager** is a sample app that accompanies the article, -[ViewPager](http://developer.xamarin.com/guides/android/user_interface/viewpager/). +[ViewPager](https://docs.microsoft.com/xamarin/android/user-interface/controls/view-pager/). This sample demonstrates how to use `ViewPager` and `PagerTabStrip` together to implement an app that presents a series of math problems on flash cards. The user can swipe left and right through the flash cards and tap on a math problem to reveal the answer. This app creates a `Fragment` for each flash card and implements an adapter derived from `FragmentPagerAdapter`. The heavy lifting of this app takes place in **FlashCardDeckAdapter.cs**, which adapts a flash card deck (implemented in **FlashCardDeck.cs**) to a `ViewPager` that is located and initialized in **MainActivity.cs**. The `ViewPager` layout includes a `PagerTabStrip` in **Main.axml**. Note that this app -depends on -[Android Support Library v4](https://components.xamarin.com/gettingstarted/xamandroidsupportv4-18). - +depends on Android Support Library v4. ![FlashCardPager application screenshot](Screenshots/screen-1.png "FlashCardPager application screenshot") -## Author +## License Copyright 2016 Xamarin - -Created by Mark Mclemore diff --git a/UserInterface/TabHostWalkthrough/README.md b/UserInterface/TabHostWalkthrough/README.md index a3dbf2a..791a3d8 100644 --- a/UserInterface/TabHostWalkthrough/README.md +++ b/UserInterface/TabHostWalkthrough/README.md @@ -1,16 +1,14 @@ --- name: Xamarin.Android - TabHost Walkthrough Start description: This sample app provides the starting point for the article, Walkthrough - Creating a tabbed UI with TabHost. page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-tabhostwalkthrough --- -# TabHost Walkthrough Start - -This sample app provides the starting point for the article, -[Walkthrough - Creating a tabbed UI with TabHost](https://developer.xamarin.com/guides/android/user_interface/tab_layout/Walkthrough_Creating_a_tabbed_ui/). - +# TabHost Walkthrough Start +This sample app provides the starting point for the article, +[Walkthrough - Creating a tabbed UI with TabHost](https://docs.microsoft.com/xamarin/android/user-interface/layouts/tab-layout/with-action-bar). diff --git a/UserInterface/TimePickerDemo/README.md b/UserInterface/TimePickerDemo/README.md index 8cc417f..6a99db3 100644 --- a/UserInterface/TimePickerDemo/README.md +++ b/UserInterface/TimePickerDemo/README.md @@ -1,28 +1,26 @@ --- name: Xamarin.Android - TimePickerDemo -description: TimePickerDemo is a sample app that accompanies the article, Time Picker. This sample demonstrates how to use the TimePickerDialog, wrapped in a... +description: 'TimePickerDemo is a sample app that accompanies the article, Time Picker. This sample demonstrates how to use the TimePickerDialog' page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-timepickerdemo --- -# TimePickerDemo +# TimePickerDemo **TimePickerDemo** is a sample app that accompanies the article, -[Time Picker](https://developer.xamarin.com/guides/android/user_interface/controls/pickers/time-picker/). +[Time Picker](https://docs.microsoft.com/xamarin/android/user-interface/controls/pickers/time-picker). This sample demonstrates how to use the `TimePickerDialog`, wrapped in a `DialogFragment`. This application displays the `TimePickerDialog` as a modal dialog when the user clicks a button on an Activity. When the time is set by the user, the dialog exits and a handler updates a `TextView` on the Activity screen with the time that was selected. ![TimePickerDemo application screenshot](Screenshots/01-initial-screen.png "TimePickerDemo application screenshot") -## Author +## License Copyright 2017 Xamarin - -Created by Mark Mclemore diff --git a/UserInterface/TreePager/README.md b/UserInterface/TreePager/README.md index 5000709..eb82c8d 100755 --- a/UserInterface/TreePager/README.md +++ b/UserInterface/TreePager/README.md @@ -1,38 +1,34 @@ --- name: Xamarin.Android - TreePager -description: TreePager is a sample app that accompanies the article, ViewPager. This sample demonstrates how to use ViewPager and PagerTabStrip together to... +description: TreePager is a sample app that accompanies the article, ViewPager. This sample demonstrates how to use ViewPager and PagerTabStrip together page_type: sample languages: - csharp products: - xamarin urlFragment: userinterface-treepager --- -# TreePager +# TreePager -**TreePager** is a sample app that accompanies the article, -[ViewPager](http://developer.xamarin.com/guides/android/user_interface/viewpager/). +**TreePager** is a sample app that accompanies the article, +[ViewPager](https://docs.microsoft.com/xamarin/android/user-interface/controls/view-pager/). This sample demonstrates how to use `ViewPager` and `PagerTabStrip` together to implement a simple image gallery of deciduous and evergreen trees. The user swipes left and right through a tree catalog. On each page of the catalog, the name of the tree is listed in the `PagerTabStrip` and an image of the tree is displayed in an `ImageView`. Because of the relative simplicity of this app, the added complexity of using Fragments is unnecessary. The heavy lifting of this app takes place in **TreePagerAdapter.cs**, which adapts a tree catalog (implemented in **TreeCatalog.cs**) to a `ViewPager` that is located and initialized in **MainActivity.cs**. The `ViewPager` layout includes a `PagerTabStrip` in **Main.axml**. Note -that this app depends on -[Android Support Library v4](https://components.xamarin.com/gettingstarted/xamandroidsupportv4-18). - +that this app depends on Android Support Library v4. ![TreePager application screenshot](Screenshots/1-larch.png "TreePager application screenshot") -## Author +## License Copyright 2016 Xamarin - -Created by Mark Mclemore diff --git a/ViewPagerIndicator/README.md b/ViewPagerIndicator/README.md index b78dfc3..d21f4fc 100644 --- a/ViewPagerIndicator/README.md +++ b/ViewPagerIndicator/README.md @@ -1,34 +1,34 @@ --- name: Xamarin.Android - ViewPagerIndicator -description: This is a port of the wonderful [ViewPagerIndicator library by JakeWharton][1] License Copyright 2011 Patrik Åkerfeldt Copyright 2011 Francisco... +description: This is a port of the wonderful ViewPagerIndicator library by JakeWharton page_type: sample languages: - csharp products: - xamarin urlFragment: viewpagerindicator --- # ViewPagerIndicator This is a port of the wonderful [ViewPagerIndicator library by JakeWharton][1] -# License +## License Copyright 2011 Patrik Åkerfeldt Copyright 2011 Francisco Figueiredo Jr. Copyright 2011 Jake Wharton Copyright 2012 Xamarin Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. [1]: https://github.com/JakeWharton/Android-ViewPagerIndicator \ No newline at end of file diff --git a/tv/TvLeanback/README.md b/tv/TvLeanback/README.md index e8baee1..e83e3cc 100644 --- a/tv/TvLeanback/README.md +++ b/tv/TvLeanback/README.md @@ -1,29 +1,31 @@ --- name: Xamarin.Android - TvLeanback -description: 'This sample shows a basic Android-TV application by showcasing various video provided by Google. Note: This sample may crash due to a bug in the...' +description: 'This sample shows a basic Android-TV application by showcasing various video provided by Google' page_type: sample languages: - csharp products: - xamarin urlFragment: tv-tvleanback --- # TvLeanback + This sample shows a basic Android-TV application by showcasing various video provided by Google. +## Note + +This sample may crash due to a [bug](https://code.google.com/p/android/issues/detail?id=73920) in the native Android System. -## Note: -This sample may crash due to a [bug](https://code.google.com/p/android/issues/detail?id=73920) in the native Android System. +## Build Requirements -## Build Requirements: This sample is designed for Android-TV but can run on the Android L developer preview. It also requires Xamarin.Android 4.17+. ![TvLeanback application screenshot](Screenshots/home.png "TvLeanback application screenshot") -## Author: +## License + This project relies on the Picasso Project by Jake Warton and is used under the Apache License Version 2. The C# bindings used by this app were created by Jack Sierkstra. The original project by Jake Warton is available from: https://github.com/square/picasso The bindings are available from: https://github.com/jacksierkstra/Picasso Copyright (c) 2013, The Android Open Source Project -Ported to Xamarin.Android by Ben O'Halloran diff --git a/tv/VisualGameController/README.md b/tv/VisualGameController/README.md index 18c8a6b..4b65e21 100644 --- a/tv/VisualGameController/README.md +++ b/tv/VisualGameController/README.md @@ -1,25 +1,28 @@ --- name: Xamarin.Android - Visual Game Controller -description: This AndroidTV sample demonstrates the use of input from a game controller by displaying input events on the screen on a virtual controller as they... +description: AndroidTV sample that demonstrates the use of input from a game controller by displaying input events on the screen on a virtual controller page_type: sample languages: - csharp products: - xamarin urlFragment: tv-visualgamecontroller --- # Visual Game Controller + This AndroidTV sample demonstrates the use of input from a game controller by displaying input events on the screen on a virtual controller as they happen. ## Instructions + * Press buttons and move axes on an attached game controller and the input that you give will be recreated on-screen. * Keep in mind that the button mapping is different for different types of game controllers. The sample has the differences between Xbox game controllers and Android game controllers in the comments as the item in question is drawn. ## Build Requirements + Using this sample requires an android tv or android l device and Xamarin.Android version 4.17 or later. ![Visual Game Controller application screenshot](Screenshots/Screenshot1.png "Visual Game Controller application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by John Pilczak
dotnet/android-samples
0d67d7b5e95f5cb7c787f243aa62e1e84213f09b
header yaml updates
diff --git a/RotationDemo/README.md b/RotationDemo/README.md index 91814d2..59769ca 100644 --- a/RotationDemo/README.md +++ b/RotationDemo/README.md @@ -1,15 +1,17 @@ --- name: Xamarin.Android - Rotation Demo description: This is the sample code for the article Handling Rotation. It shows various techniques for working with device orientation changes in Mono for... page_type: sample languages: - csharp products: - xamarin urlFragment: rotationdemo --- # Rotation Demo -This is the sample code for the article Handling Rotation. +This is the sample code for the article [Handling Rotation](https://docs.microsoft.com/xamarin/android/app-fundamentals/handling-rotation). -It shows various techniques for working with device orientation changes in Mono for Android. \ No newline at end of file +It shows various techniques for working with device orientation changes in Mono for Android. + +![Two Android screens with horizontal and vertical alignment](Screenshots/RotationDemo.png) \ No newline at end of file diff --git a/SanAngeles_NDK/README.md b/SanAngeles_NDK/README.md index b00a3e6..8953464 100644 --- a/SanAngeles_NDK/README.md +++ b/SanAngeles_NDK/README.md @@ -1,34 +1,31 @@ --- name: Xamarin.Android - Mono San Angeles sample port -description: This is a port of Android NDK sample (sanangeles). http://developer.android.com/tools/sdk/ndk/index.htmlSamples This library sample is easily... +description: "A port of Android NDK sample (sanangeles) to Xamarin.Android" page_type: sample languages: - csharp +- cpp products: - xamarin urlFragment: sanangeles-ndk --- # Mono San Angeles sample port This is a port of Android NDK sample (sanangeles). http://developer.android.com/tools/sdk/ndk/index.html#Samples - This library sample is easily ported because there is no dependency on any jobject instances or JNIEnv instance in C code. There are **TWO** versions available: - ## 1) C++ for Visual Studio 2015 (SanAngeles_NativeDebug) -Complete C++ source is built as part of the solution, which means you can debug the C++ code while running the Xamarin.Android project using **Visual Studio 2015**. - - +Complete C++ source is built as part of the solution, which means you can debug the C++ code while running the Xamarin.Android project using **Visual Studio 2015** (or newer). ## 2) Pre-compiled (SanAngeles_NDK) The project contains pre-compiled libsanangeles.so under libs directory (armeabi, armeabi-v7a and x86 are supported). You'll only debug the Xamarin.Android C# code with this example. - +![Android emulator showing graphics](Screenshots/SanAngeles_NDK.png) \ No newline at end of file diff --git a/wear/AgendaData/README.md b/wear/AgendaData/README.md index 8a8874a..369eb98 100644 --- a/wear/AgendaData/README.md +++ b/wear/AgendaData/README.md @@ -1,28 +1,31 @@ --- name: Xamarin.Android - AgendaData Sample -description: This sample demonstrates sending calendar events from an Android handheld device to an Android Wear device, as well as deleting those events.... +description: This sample demonstrates sending calendar events from an Android handheld device to an Android Wear device, as well as deleting those... page_type: sample languages: - csharp products: - xamarin urlFragment: wear-agendadata --- # AgendaData Sample + This sample demonstrates sending calendar events from an Android handheld device to an Android Wear device, as well as deleting those events. ## Instructions + * Launch the AgendaData project onto the phone or tablet and the Wearable project onto the wearable device * If you have no calendar events on the phone or tablet, make one * Press the "Sync calendar events to wearable" button to add your calendar events to the wearable * Press the "Delete calendar events from wearable" to delete the events from the wearable ## Build Requirements + Xamarin Studio 5.3+ Xamarin.Android 4.17+ ![AgendaData Sample application screenshot](Screenshots/Default view.png "AgendaData Sample application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Christopher Blackman diff --git a/wear/DataLayer/README.md b/wear/DataLayer/README.md index 3cc9cf3..59ad520 100644 --- a/wear/DataLayer/README.md +++ b/wear/DataLayer/README.md @@ -1,32 +1,35 @@ --- name: Xamarin.Android - DataLayer Sample -description: This sample demonstrates using the wearable APIs to send messages and stream data (an image in this sample) from an Android device to an Android... +description: This sample demonstrates using the wearable APIs to send messages and stream data (an image in this sample) from Android to Android... page_type: sample languages: - csharp products: - xamarin urlFragment: wear-datalayer --- # DataLayer Sample + This sample demonstrates using the wearable APIs to send messages and stream data (an image in this sample) from an Android device to an Android Wear device. ## Instructions + * Download Xamarin Studio 5.3 or higher and open the project solution. Right click the project DataLayer and set it as the startup project, then click build in the application menu. Then right click the project Wearable, set it as the startup project, then click build in the application menu. * You will need to deploy DataLayer to a physical Android device running at least Android 4.3 Jelly Bean. Wearable can be deployed to either an Android Wear device or the Android Wear emulator. ## Build requirements + Xamarin Studio 5.3+ Xamarin.Android 4.17+ The DataLayer project must be deployed to a physical android device of at least Android 4.3 Jelly bean and the Wearable project must be deployed to either an Android Wear device or emulator. Download Xamarin Studio 5.3 or higher and open the project solution. Right click the project DataLayer and set it as the startup project, then click build in the application menu. Then right click the project Wearable, set it as the startup project, then click build in the application menu. You will need to deploy DataLayer to a physical Android device running at least Android 4.3 Jelly Bean. Wearable can be deployed to either an Android Wear device or the Android Wear emulator. ![DataLayer Sample application screenshot](Screenshots/Log and Thumbnail.png "DataLayer Sample application screenshot") -## Author +## License + Copyright (c) 2005-2008, The Android Open Source Project -Ported to Xamarin.Android by Christopher Blackman diff --git a/wear/DelayedConfirmation/README.md b/wear/DelayedConfirmation/README.md index 84c8c0a..f4382b5 100644 --- a/wear/DelayedConfirmation/README.md +++ b/wear/DelayedConfirmation/README.md @@ -1,30 +1,32 @@ --- name: Xamarin.Android - Delayed Confirmation -description: A simple sample which demonstrates how to send and receive messages to a connected Wearable using the new Wear APIs. Ported from the Android Open... +description: A simple sample which demonstrates how to send and receive messages to a connected Wearable using the new Wear APIs page_type: sample languages: - csharp products: - xamarin urlFragment: wear-delayedconfirmation --- # Delayed Confirmation + A simple sample which demonstrates how to send and receive messages to a connected Wearable using the new Wear APIs. Ported from the Android Open Source Project sample ## Note + For running on an emulator for wearable, you must run ```shell adb -d forward tcp:5601 tcp:5601 ``` Full instructions for how to connect and prepare a Wearable for use please see [Android Developers](http://developer.android.com/training/wearables/apps/creating.html#SetupEmulator) ## Build Requirements + Xamarin.Android 4.17+ Xamarin Studio 5.3+ - ![Delayed Confirmation application screenshot](Screenshots/handheld.png "Delayed Confirmation application screenshot") -## Author +## License + Android Open Source Project (original Java) -Ported to Xamarin.Android by Ben O'Halloran diff --git a/wear/ElizaChat/README.md b/wear/ElizaChat/README.md index d042db0..cfac4b7 100644 --- a/wear/ElizaChat/README.md +++ b/wear/ElizaChat/README.md @@ -1,31 +1,35 @@ --- name: Xamarin.Android - ElizaChat -description: A wear sample demonstrating how a personal assistant may work on a wearable device. The user interacts with Eliza, the personal assistant, through... +description: A wear sample demonstrating how a personal assistant may work on a wearable device. The user interacts with Eliza, the personal assistant page_type: sample languages: - csharp products: - xamarin urlFragment: wear-elizachat --- # ElizaChat + A wear sample demonstrating how a personal assistant may work on a wearable device. The user interacts with Eliza, the personal assistant, through Wear's interactive notifications. The main application serves as a log of the different interactions. ## Note + For running on an emulator for wearable, please run + ```shell adb -d forward tcp:5601 tcp:5601 ``` + For full instructions for how to connect and prepare a Wearable for use please see [Android Developers](http://developer.android.com/training/wearables/apps/creating.html#SetupEmulator) ## Build Requirements + Xamarin.Android 4.17+ Xamarin Studio 5.3+ - ![ElizaChat application screenshot](Screenshots/notification-muted.png "ElizaChat application screenshot") -## Author +## License + Android Open Source Project (original Java) -Ported to Xamarin.Android by Ben O'Halloran
dotnet/android-samples
d87583b203a0dc31453690c0adefbc8003a1dff5
Fix links to docs
diff --git a/ApplicationFundamentals/ServiceSamples/BoundServiceDemo/README.md b/ApplicationFundamentals/ServiceSamples/BoundServiceDemo/README.md index 3b06ecf..71b7393 100644 --- a/ApplicationFundamentals/ServiceSamples/BoundServiceDemo/README.md +++ b/ApplicationFundamentals/ServiceSamples/BoundServiceDemo/README.md @@ -1,21 +1,15 @@ --- name: Xamarin.Android - Xamarin.Android Bound Service Sample description: This directory holds the sample project from the creating a bound service section of the Creating Services guide for Xamarin.Android.... page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-servicesamples-boundservicedemo --- # Xamarin.Android Bound Service Sample -This directory holds the sample project from the [creating a bound service section](https://developer.xamarin.com/guides/android/application_fundamentals/services/creating-a-service/bound-services/) of the [Creating Services](https://developer.xamarin.com/guides/android/application_fundamentals/services/) guide for Xamarin.Android. +This directory holds the sample project from the [creating a bound service section](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/creating-a-service/bound-services) of the [Creating Services](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/) guide for Xamarin.Android. -![](./Screenshots/bound-service.png) - -![Xamarin.Android Bound Service Sample application screenshot](Screenshots/bound-service.png "Xamarin.Android Bound Service Sample application screenshot") - -## Authors - -Tom Opgenorth ([email protected]) \ No newline at end of file +![Android app](Screenshots/bound-service.png) diff --git a/ApplicationFundamentals/ServiceSamples/ForegroundServiceDemo/README.md b/ApplicationFundamentals/ServiceSamples/ForegroundServiceDemo/README.md index bf24677..aa8b0bc 100644 --- a/ApplicationFundamentals/ServiceSamples/ForegroundServiceDemo/README.md +++ b/ApplicationFundamentals/ServiceSamples/ForegroundServiceDemo/README.md @@ -1,21 +1,15 @@ --- name: Xamarin.Android - Xamarin.Android Foreground Service Sample description: This directory holds the sample project from the creating a foreground service section of the Creating Services guide for Xamarin.Android.... page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-servicesamples-foregroundservicedemo --- # Xamarin.Android Foreground Service Sample -This directory holds the sample project from the [creating a foreground service](https://developer.xamarin.com/guides/android/application_fundamentals/services/creating-a-service/bound-services/) section of the [Creating Services](https://developer.xamarin.com/guides/android/application_fundamentals/services/) guide for Xamarin.Android. +Sample project for the [creating a foreground service](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/creating-a-service/bound-services) section of the [Creating Services](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/) guide for Xamarin.Android. -![](./Screenshots/foreground-service.png) - -![Xamarin.Android Foreground Service Sample application screenshot](Screenshots/foreground-service.png "Xamarin.Android Foreground Service Sample application screenshot") - -## Authors - -Tom Opgenorth ([email protected]) +![Android app screenshot](Screenshots/foreground-service.png) diff --git a/ApplicationFundamentals/ServiceSamples/StartedServicesDemo/README.md b/ApplicationFundamentals/ServiceSamples/StartedServicesDemo/README.md index 6ab9492..b7da979 100644 --- a/ApplicationFundamentals/ServiceSamples/StartedServicesDemo/README.md +++ b/ApplicationFundamentals/ServiceSamples/StartedServicesDemo/README.md @@ -1,21 +1,15 @@ --- name: Xamarin.Android - Xamarin.Android Started Service Sample description: This directory holds the sample project for the creating a started service section of the Creating Services guide for Xamarin.Android.... page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-servicesamples-startedservicesdemo --- # Xamarin.Android Started Service Sample -This directory holds the sample project for the [creating a started service section](https://developer.xamarin.com/guides/android/application_fundamentals/services/creating-a-service/started-services/) of the [Creating Services](https://developer.xamarin.com/guides/android/application_fundamentals/services/) guide for Xamarin.Android. +This directory holds the sample project for the [creating a started service section](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/creating-a-service/started-services) of the [Creating Services](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/) guide for Xamarin.Android. -![](./Screenshots/started-service.png) - -![Xamarin.Android Started Service Sample application screenshot](Screenshots/started-service.png "Xamarin.Android Started Service Sample application screenshot") - -## Authors - -Tom Opgenorth ([email protected]) +![Android app screenshot](Screenshots/started-service.png) diff --git a/ApplicationFundamentals/Touch_final/README.md b/ApplicationFundamentals/Touch_final/README.md index 75e550d..2d63644 100644 --- a/ApplicationFundamentals/Touch_final/README.md +++ b/ApplicationFundamentals/Touch_final/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Touch in Android (Completed Sample) -description: Complete sample for Using Touch in Android +description: Complete sample for using touch in Android page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-touch-final --- # Touch in Android (Completed Sample) -Complete sample for [Using Touch in Android](http://developer.xamarin.com/guides/cross-platform/application_fundamentals/touch/part_4_android_touch_walkthrough/) +Complete sample for [Using Touch in Android](https://docs.microsoft.com/xamarin/android/app-fundamentals/touch/android-touch-walkthrough) diff --git a/ApplicationFundamentals/Touch_start/README.md b/ApplicationFundamentals/Touch_start/README.md index 5e066db..39c8991 100644 --- a/ApplicationFundamentals/Touch_start/README.md +++ b/ApplicationFundamentals/Touch_start/README.md @@ -1,13 +1,13 @@ --- name: Xamarin.Android - Touch in Android (Walkthrough) description: Walkthrough starting point for Using Touch in Android Walkthrough page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-touch-start --- # Touch in Android (Walkthrough) -Walkthrough starting point for [Using Touch in Android Walkthrough](http://developer.xamarin.com/guides/cross-platform/application_fundamentals/touch/part_4_android_touch_walkthrough/) +Walkthrough starting point for [Using Touch in Android Walkthrough](https://docs.microsoft.com/xamarin/android/app-fundamentals/touch/android-touch-walkthrough) diff --git a/BuiltInViews/README.md b/BuiltInViews/README.md index 35432d7..86f8704 100644 --- a/BuiltInViews/README.md +++ b/BuiltInViews/README.md @@ -1,20 +1,19 @@ --- name: Xamarin.Android - Built In Views description: 'This sample is part of the Android ListViews and Adapters series; it includes two projects that illustrate built-in ListViews. Note: to use...' page_type: sample languages: - csharp products: - xamarin urlFragment: builtinviews --- # Built In Views This sample is part of the Android ListViews and Adapters series; it includes -two projects that illustrate built-in ListViews. Note: to use SimpleSelectableListItem, SimpleListItemActivated1, or SimpleListItemActivated2, you need API level 11 or higher. +two projects that illustrate built-in ListViews. -For more about built-in ListViews (and to view screenshots from this sample), see the accompanying article [ListViews and Adapters, Part 3 - Customizing a ListView's Appearance](http://developer.xamarin.com/guides/android/user_interface/working_with_listviews_and_adapters/part_3_-_customizing_a_listview's_appearance). +> [!NOTE] +> To use SimpleSelectableListItem, SimpleListItemActivated1, or SimpleListItemActivated2, you need API level 11 or higher. -## Authors - -Mark McLemore (BuiltInExpandableViews) +For more about built-in ListViews (and to view screenshots from this sample), see the accompanying article [ListViews and Adapters, Part 3 - Customizing a ListView's Appearance](https://docs.microsoft.com/xamarin/android/user-interface/layouts/list-view/customizing-appearance). diff --git a/FingerprintGuide/README.md b/FingerprintGuide/README.md index 6fcc814..9a3586c 100644 --- a/FingerprintGuide/README.md +++ b/FingerprintGuide/README.md @@ -1,15 +1,18 @@ --- name: Xamarin.Android - Fingerprint Sample -description: This app is the companion code for the Android 6.0 Fingerprint Authentication guide. This is a sample application that demonstrations how the use... +description: "Sample application that demonstrations how the use fingerprint authentication (Android Marshmallow)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidmarshmallow urlFragment: fingerprintguide --- # Fingerprint Sample -This app is the companion code for the [Android 6.0 Fingerprint Authentication guide](http://developer.xamarin.com/guides/android/platform_features/fingerprint-authentication). +This app is the companion code for the [Android 6.0 Fingerprint Authentication guide](https://docs.microsoft.com/xamarin/android/platform/fingerprint-authentication/). This is a sample application that demonstrations how the use the Fingerprint APIs. It requires a device with a fingerprint scanner running Android 6.0 or higher. diff --git a/Firebase/FCMNotifications/README.md b/Firebase/FCMNotifications/README.md index 7c1e61f..bbbd35b 100644 --- a/Firebase/FCMNotifications/README.md +++ b/Firebase/FCMNotifications/README.md @@ -1,34 +1,28 @@ --- name: Xamarin.Android - Android FCM Remote Notifications description: This sample app accompanies the article Remote Notifications with Firebase Cloud Messaging. Before you can use this sample, you must acquire the... page_type: sample languages: - csharp products: - xamarin urlFragment: firebase-fcmnotifications --- -# Android FCM Remote Notifications +# Android FCM Remote Notifications This sample app accompanies the article -[Remote Notifications with Firebase Cloud Messaging](http://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-fcm/). +[Remote Notifications with Firebase Cloud Messaging](https://docs.microsoft.com/xamarin/android/data-cloud/google-messaging/remote-notifications-with-fcm). Before you can use this sample, you must acquire the necessary credentials to use Google's servers; this process is explained in -[Firebase Cloud Messaging](http://developer.xamarin.com/guides/android/application_fundamentals/notifications/firebase-cloud-messaging). +[Firebase Cloud Messaging](https://docs.microsoft.com/xamarin/android/data-cloud/google-messaging/firebase-cloud-messaging). + In particular, you must download **google-services.json** from the [Firebase Console](https://console.firebase.google.com/) (this file contains your credentials) and add it to the app project, replacing the dummy **google-services.json** that comes with this sample. Most of the action takes place "behind the scenes", and is to be observed by watching the output window while the app runs from the IDE. - ![Android FCM Remote Notifications application screenshot](Screenshots/screenshot-1.png "Android FCM Remote Notifications application screenshot") - -## Author - -Copyright 2016 Xamarin - -Created by Mark Mclemore diff --git a/FrameAnimation/README.md b/FrameAnimation/README.md index 2035c8f..6ebcdbf 100644 --- a/FrameAnimation/README.md +++ b/FrameAnimation/README.md @@ -1,16 +1,15 @@ --- name: Xamarin.Android - FrameAnimation description: This solution is the source code for the FrameAnimation recipe. It demonstrates how to perform a simple frame animation in Android. page_type: sample languages: - csharp products: - xamarin urlFragment: frameanimation --- # FrameAnimation -This solution is the source code for the [FrameAnimation recipe](http://developer.xamarin.com/recipes/android/other_ux/animation/frame_animation/). - -It demonstrates how to perform a simple frame animation in Android. +This solution is the source code for the [FrameAnimation recipe](https://github.com/xamarin/docs-archive/tree/master/Recipes/android/other_ux/animation/frame_animation). +It demonstrates how to perform a simple frame animation in Android. diff --git a/JavaIntegration/AarBinding/README.md b/JavaIntegration/AarBinding/README.md index 3f8a24b..9e6d7c5 100644 --- a/JavaIntegration/AarBinding/README.md +++ b/JavaIntegration/AarBinding/README.md @@ -1,42 +1,34 @@ --- name: Xamarin.Android - Binding an .AAR Example description: This sample app accompanies the article, Binding an .AAR. This sample can help you understand how a Xamarin.Android application can reuse existing... page_type: sample languages: - csharp products: - xamarin urlFragment: javaintegration-aarbinding --- -# Binding an .AAR Example +# Binding an .AAR Example -This sample app accompanies the article, -[Binding an .AAR](http://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding-a-java-library/binding-an-aar/). +This sample app accompanies +[Binding an .AAR](https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-an-aar). -This sample can help you understand how a Xamarin.Android application -can reuse existing Java code that is packaged in an Android .AAR. This -sample also demonstrates how to access and use .AAR resources. +This sample can help you understand how a Xamarin.Android application +can reuse existing Java code that is packaged in an Android .AAR. This +sample also demonstrates how to access and use .AAR resources. -The `MainActivity` of the app prompts the user for a string and uses a -`TextCounter` class within the .AAR to count the number of vowels and -consonants in the string. (The Android Studio project and Java source -for the .AAR is included.) In addition, an image resource is retrieved -from the .AAR to assist in displaying the count results. +The `MainActivity` of the app prompts the user for a string and uses a +`TextCounter` class within the .AAR to count the number of vowels and +consonants in the string. (The Android Studio project and Java source +for the .AAR is included.) In addition, an image resource is retrieved +from the .AAR to assist in displaying the count results. -Most of the "heavy lifting" is done by the .AAR. The example app simply -accepts input from the user, sends it to the .AAR for text analysis, -then displays results. - -Two projects are contained in this solution. The `AarBinding` project -is the Binding Project that wraps the `textanalyzer.aar` file, and the -`BindingTest` project is the test app that references `AarBinding`. +Most of the "heavy lifting" is done by the .AAR. The example app simply +accepts input from the user, sends it to the .AAR for text analysis, +then displays results. +Two projects are contained in this solution. The `AarBinding` project +is the Binding Project that wraps the `textanalyzer.aar` file, and the +`BindingTest` project is the test app that references `AarBinding`. ![Binding an .AAR Example application screenshot](Screenshots/initial-screen.png "Binding an .AAR Example application screenshot") - -## Author - -Mark McLemore - - - diff --git a/LifecycleDemo/README.md b/LifecycleDemo/README.md index af04e3b..023fa36 100755 --- a/LifecycleDemo/README.md +++ b/LifecycleDemo/README.md @@ -1,17 +1,16 @@ --- name: Xamarin.Android - Android Lifecycle Demo -description: This sample app accompanies the article, Backgrounding. ![](Screenshots/example-screenshot.png) +description: Example of creating Android services page_type: sample languages: - csharp products: - xamarin urlFragment: lifecycledemo --- # Android Lifecycle Demo -This sample app accompanies the article, -[Backgrounding](http://developer.xamarin.com/guides/android/application_fundamentals/backgrounding/). +This sample app accompanies this article +[Creating Android Services](https://docs.microsoft.com/xamarin/android/app-fundamentals/services/). - -[ ![](Screenshots/example-screenshot-sml.png)](Screenshots/example-screenshot.png) +[![Android app screenshot](Screenshots/example-screenshot-sml.png)](Screenshots/example-screenshot.png) diff --git a/LoadingLargeBitmaps/README.md b/LoadingLargeBitmaps/README.md index 7a3a1a7..4f8dcb8 100644 --- a/LoadingLargeBitmaps/README.md +++ b/LoadingLargeBitmaps/README.md @@ -1,15 +1,15 @@ --- name: Xamarin.Android - Loading Large Images description: This is a sample project that shows how to efficiently resample large images before displaying them in an Android application. The images can be... page_type: sample languages: - csharp products: - xamarin urlFragment: loadinglargebitmaps --- # Loading Large Images This is a sample project that shows how to efficiently resample large images before displaying them in an Android application. The images can be reduced in size which will require less RAM one the device. -See the recipe [Loading Large Bitmaps Efficiently](http://http://developer.xamarin.com/recipes/android/resources/general/load_large_bitmaps_efficiently/). +![Android app showing an image of a dog](Screenshots/image01.png) diff --git a/LocalNotifications/README.md b/LocalNotifications/README.md index 4889284..f948ca3 100644 --- a/LocalNotifications/README.md +++ b/LocalNotifications/README.md @@ -1,21 +1,20 @@ --- name: Xamarin.Android - Android Local Notifications Sample -description: This sample app accompanies the article, Walkthrough - Using Local Notifications in Xamarin.Android. ![](Screenshots/screenshots.png) When you tap... +description: This sample app accompanies the article, Walkthrough - Using Local Notifications in Xamarin.Android. page_type: sample languages: - csharp products: - xamarin urlFragment: localnotifications --- # Android Local Notifications Sample -This sample app accompanies the article, -[Walkthrough - Using Local Notifications in Xamarin.Android](http://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/local_notifications_in_android_walkthrough/). +This sample app accompanies the article, +[Walkthrough - Using Local Notifications in Xamarin.Android](https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications-walkthrough). -![](Screenshots/screenshots.png) - -When you tap the button displayed in the MainActivity screen, a -notification is created. When you tap the notification, it -takes you to a SecondActivity screen. +![Android app screenshot](Screenshots/screenshots.png) +When you tap the button displayed in the MainActivity screen, a +notification is created. When you tap the notification, it +takes you to a SecondActivity screen. diff --git a/Location/README.md b/Location/README.md index 87ba0dc..576c501 100644 --- a/Location/README.md +++ b/Location/README.md @@ -1,14 +1,15 @@ --- name: Xamarin.Android - Android Location Services Sample description: This sample provides an example of gathering location data using the Android location system service, as explained in the Xamarin Location Services... page_type: sample languages: - csharp products: - xamarin urlFragment: location --- # Android Location Services Sample -This sample provides an example of gathering location data using the Android location system service, as explained in the [Xamarin Location Services](https://developer.xamarin.com/guides/android/platform_features/maps_and_location/location/) -guide. +This sample provides an example of gathering location data using the Android location system service, as explained in the [Xamarin Location Services](https://docs.microsoft.com/xamarin/android/platform/maps-and-location/location) guide. + +![Android app showing location](Screenshots/loc1.png) diff --git a/MapsAndLocationDemo_v3/README.md b/MapsAndLocationDemo_v3/README.md index 5ae803c..60d6730 100755 --- a/MapsAndLocationDemo_v3/README.md +++ b/MapsAndLocationDemo_v3/README.md @@ -1,27 +1,25 @@ --- name: Xamarin.Android - Google Maps v2 Demo description: This code provides an example of how to use Google Maps v2 in an Android application. The SimpleMapDemo project demonstrates the basic features of... page_type: sample languages: - csharp products: - xamarin urlFragment: mapsandlocationdemo-v3 --- # Google Maps v2 Demo This code provides an example of how to use Google Maps v2 in an Android application. The **SimpleMapDemo** project demonstrates the basic features of Google Maps for Android v2. It requires the Google Play Services client library, and it is designed to run on API 23 devices and later. -Please see the Xamarin.Android guide [Using the Google Maps API in your application](https://docs.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api) for details on how to run this sample. - +Please see the Xamarin.Android guide [Using the Google Maps API in your application](https://docs.microsoft.com/xamarin/android/platform/maps-and-location/maps/maps-api) for details on how to run this sample. The **LocationDemo** project that was previously part of **MapsAndLocationDemo\_v3** is obsolete and has been removed from the solution. For an example of gathering location data, see the [FusedLocationProvider](https://developer.xamarin.com/samples/monodroid/FusedLocationProvider/) code example. - diff --git a/PhonewordMultiscreen/README.md b/PhonewordMultiscreen/README.md index a8af86d..fc0859b 100644 --- a/PhonewordMultiscreen/README.md +++ b/PhonewordMultiscreen/README.md @@ -1,15 +1,21 @@ --- name: Xamarin.Android - Phoneword Multiscreen -description: This sample app accompanies the article, Hello, Android Multiscreen (Quickstart). This sample contains all of the sample code presented in this... +description: "This sample app accompanies the article, Hello, Android Multiscreen (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted urlFragment: phonewordmultiscreen --- -# Phoneword Multiscreen +# Phoneword Multiscreen for Xamarin.Android + +This sample app accompanies the article, +[Hello, Android Multiscreen (Quickstart)](https://docs.microsoft.com/xamarin/android/get-started/hello-android-multiscreen/hello-android-multiscreen-quickstart). -This sample app accompanies the article, -[Hello, Android Multiscreen (Quickstart)](http://developer.xamarin.com/guides/android/getting_started/hello,android_multiscreen/hello,android_multiscreen_quickstart/). This sample contains all of the sample code presented in this article. + +![Sample Android app](Screenshots/example-screenshot.png) diff --git a/PlatformFeatures/ContactsAdapterDemo/README.md b/PlatformFeatures/ContactsAdapterDemo/README.md index 67ae42e..0d57feb 100644 --- a/PlatformFeatures/ContactsAdapterDemo/README.md +++ b/PlatformFeatures/ContactsAdapterDemo/README.md @@ -1,13 +1,15 @@ --- name: Xamarin.Android - Contacts ContentProvider description: Sample for Using the Contacts ContentProvider page_type: sample languages: - csharp products: - xamarin urlFragment: platformfeatures-contactsadapterdemo --- # Contacts ContentProvider -Sample for [Using the Contacts ContentProvider](http://developer.xamarin.com/guides/android/platform_features/intro_to_content_providers/part_2_-_using_the_contacts_contentprovier/) +Sample for [Using the Contacts ContentProvider](https://docs.microsoft.com/xamarin/android/platform/content-providers/contacts-contentprovider) + +![Android app showing contacts](Screenshots/ContactsProvider.png) diff --git a/google-services/SigninQuickstart/README.md b/google-services/SigninQuickstart/README.md index d0ef0cb..7602467 100644 --- a/google-services/SigninQuickstart/README.md +++ b/google-services/SigninQuickstart/README.md @@ -1,43 +1,43 @@ --- name: Xamarin.Android - Google Sign-In Sample description: This sample demonstrates how to authenticate a user with the Google Api Client in Google Play Services. Setup You must follow the next guide to... page_type: sample languages: - csharp products: - xamarin urlFragment: google-services-signinquickstart --- # Google Sign-In Sample This sample demonstrates how to authenticate a user with the Google Api Client in Google Play Services. ## Setup * You must follow the next guide to configure the Sign-In feature: https://developers.google.com/identity/sign-in/android/start * On Step 2 (Configuration File), you can open [this URL](https://developers.google.com/mobile/add?platform=android&cntapi=signin&cntapp=SignInQuickstart&cntpkg=com.xamarin.signinquickstart&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue%20with%20Try%20Sign-In) for this specific sample. * Replace the google-services.json file by your generated file. ## Instructions * Tap the "Sign in with Google" button to sign in. * Tap the "Sign Out" button to sign out of the current session. * Tap "Disconnect" button to disconnect sign in with the app. ## Troubleshooting -* DEVELOPER_ERROR: Make sure you're using the generated android debug keystore by Xamarin for generate SHA-1. Check [this article](https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/MD5_SHA1/) to get it. + +* DEVELOPER_ERROR: Make sure you're using the generated android debug keystore by Xamarin for generate SHA-1. Check [this article](https://docs.microsoft.com/xamarin/android/deploy-test/signing/keystore-signature) to get it. Note: Make sure you've authorized the app in the [Google Developers Console](https://console.developers.google.com/project) before use. ## Build Requirements + Using this sample requires the Android SDK platform for Android 5.0+ (API level 21). ![Google Sign-In Sample application screenshot](Screenshots/promt.png "Google Sign-In Sample application screenshot") -## Authors +## License + Copyright (c) 2015 Google, Inc. Ported from [Google Sign-In Sample](https://developers.google.com/mobile/add) - -Ported to Xamarin.Android by Aaron Sky -Updated by Gonzalo Martin \ No newline at end of file
dotnet/android-samples
170a435512819d8166d38d5e14f06be6a749825a
remove hashtags, fix links
diff --git a/AdvancedImmersiveMode/README.md b/AdvancedImmersiveMode/README.md index 5534ce1..33950ad 100644 --- a/AdvancedImmersiveMode/README.md +++ b/AdvancedImmersiveMode/README.md @@ -1,22 +1,25 @@ --- name: Xamarin.Android - Advanced Immersive Mode -description: "Android 4.4 introduces a way for you to provide a more immersive screen experience in your app: show/hide the status bar #androidkitkat" +description: "Android 4.4 introduces a way for you to provide a more immersive screen experience in your app: show/hide the status bar (Android KitKat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidkitkat urlFragment: advancedimmersivemode --- # Xamarin.Android Advanced Immersive Mode Android 4.4 introduces a way for you to provide a more immersive screen experience in your app, by letting users show or hide the status bar and navigation bar with a swipe. This sample demonstrates how this feature interacts with some of the other UI flags related to full-screen apps. The sample also shows how to implement a "sticky" mode, which re-hides the bars a few seconds after the user swipes them back in. ![Android app without status bar](Screenshots/AdvancedImmersiveMode1.png) diff --git a/AndroidBeamDemo/README.md b/AndroidBeamDemo/README.md index cd66826..c673410 100644 --- a/AndroidBeamDemo/README.md +++ b/AndroidBeamDemo/README.md @@ -1,15 +1,18 @@ --- name: Xamarin.Android - Android Beam Demo -description: This is a port of Android SDK samples. It demonstrates new Android Beam (new NFC feature) in Ice Cream Sandwich. +description: "Demonstrates new Android Beam NFC feature (Android Ice Cream Sandwich)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidicecreamsandwich urlFragment: androidbeamdemo --- -# Android Beam Demo +# Android Beam Demo fpr Xamarin.Android This is a port of Android SDK samples. It demonstrates new Android Beam (new NFC feature) in Ice Cream Sandwich. diff --git a/AnimationDemo/README.md b/AnimationDemo/README.md index 5382543..5f546eb 100644 --- a/AnimationDemo/README.md +++ b/AnimationDemo/README.md @@ -1,17 +1,16 @@ --- name: Xamarin.Android - Android Animation Demo -description: This sample app accompanies the article, Graphics and Animations. ![](Screenshots/example-screens.png) +description: This sample app accompanies the Graphics and Animations docs page_type: sample languages: - csharp products: - xamarin urlFragment: animationdemo --- # Android Animation Demo -This sample app accompanies the article, -[Graphics and Animations](http://developer.xamarin.com/guides/android/application_fundamentals/graphics_and_animation). +This sample app accompanies the +[Graphics and Animations](https://docs.microsoft.com/xamarin/android/app-fundamentals/graphics-and-animation) page. - -[ ![](Screenshots/example-screens-sml.png)](Screenshots/example-screens.png) +[![Android screenshot](Screenshots/example-screens-sml.png)](Screenshots/example-screens.png) diff --git a/ApplicationFundamentals/RotationDemo/README.md b/ApplicationFundamentals/RotationDemo/README.md index cafd70b..798e2ed 100644 --- a/ApplicationFundamentals/RotationDemo/README.md +++ b/ApplicationFundamentals/RotationDemo/README.md @@ -1,15 +1,16 @@ --- name: Xamarin.Android - Rotation Demo description: This sample app accompanies the article, Handling Rotation. page_type: sample languages: - csharp products: - xamarin urlFragment: applicationfundamentals-rotationdemo --- -# Rotation Demo +# Xamarin.Android Rotation Demo -This sample app accompanies the article, -[Handling Rotation](http://developer.xamarin.com/guides/android/application_fundamentals/handling_rotation). +This sample app accompanies the article, +[Handling Rotation](https://docs.microsoft.com/xamarin/android/app-fundamentals/handling-rotation). +![Rotated Android app screenshot](Screenshots/landscape.png) diff --git a/HelloM4A/README.md b/HelloM4A/README.md index 49b8347..ae66e59 100644 --- a/HelloM4A/README.md +++ b/HelloM4A/README.md @@ -1,14 +1,19 @@ --- name: Xamarin.Android - Hello Mono for Android -description: "A simple hello world application that displays a message in a TextView when a Button is pressed #getstarted" +description: "A simple hello world application that displays a message in a TextView when a Button is pressed (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted urlFragment: hellom4a --- # Hello Mono for Android -This is a super simple hello world application. It displays a +This is a super simple hello world application for Xamarin.Android. It displays a message in a TextView when a Button is pressed. + +![Simple Android app screenshot](Screenshots/HelloM4A1.png) diff --git a/HelloMultiScreen/README.md b/HelloMultiScreen/README.md index 2b568d2..44ddf50 100644 --- a/HelloMultiScreen/README.md +++ b/HelloMultiScreen/README.md @@ -1,14 +1,18 @@ --- name: Xamarin.Android - Hello Multiscreen -description: "A simple example showing how to use activities to create multi-activity applications #getstarted" +description: "A simple example showing how to use activities to create multi-activity applications (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted urlFragment: hellomultiscreen --- -# Hello Multiscreen +# Hello Multiscreen for Xamarin.Android This is a simple example showing how to use activities to create multi-activity applications. +![Android app screenshot](Screenshots/Multiscreen1.png) diff --git a/HelloTabsICS/README.md b/HelloTabsICS/README.md index 175f791..cf0c6b1 100644 --- a/HelloTabsICS/README.md +++ b/HelloTabsICS/README.md @@ -1,13 +1,19 @@ --- name: Xamarin.Android - ICS Tabs Demo -description: "This example shows how to use tabs from the Action Bar in Ice Cream Sandwich #getstarted #androidicecreamsandwich" +description: "This example shows how to use tabs from the Action Bar in Ice Cream Sandwich (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted + - androidicecreamsandwich urlFragment: hellotabsics --- -# ICS Tabs Demo +# Xamarin.Android Ice Cream Sandwich Tabs Demo This example shows how to use tabs from the Action Bar in Ice Cream Sandwich. + +![Android app with tabs](Screenshots/ActionBarTabs.png) diff --git a/HelloWorld/README.md b/HelloWorld/README.md index 9ad8155..3bde63f 100644 --- a/HelloWorld/README.md +++ b/HelloWorld/README.md @@ -1,14 +1,19 @@ --- name: Xamarin.Android - Hello World -description: "A simple hello world application that uses a TextView to display a 'hello world' message via a string resource #getstarted" +description: "A simple hello world application that uses a TextView to display a 'hello world' message via a string resource (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted urlFragment: helloworld --- -# Hello World +# Hello World for Xamarin.Android This is a super simple hello world application. It uses a TextView to display a plain old hello world message via a string resource. + +![Simple Android app](Screenshot/HelloWorld.png) diff --git a/HelloWorldPublishing/README.md b/HelloWorldPublishing/README.md index 96f981a..0d1118d 100644 --- a/HelloWorldPublishing/README.md +++ b/HelloWorldPublishing/README.md @@ -1,22 +1,25 @@ --- name: Xamarin.Android - Hello World (Publishing) -description: "A simple hello world type application to that goes along with the Xamarin topic Publishing an Application #getstarted" +description: "A simple hello world type application to that goes along with the Xamarin topic Publishing an Application (get started)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - getstarted urlFragment: helloworldpublishing --- -# Hello World (Publishing) +# Hello World (Publishing for Xamarin.Android) -This is a simple hello world type application to that goes along with -the Xamarin topic -[Publishing an Application](http://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/). +This is a simple hello world type application to that goes along with +the Xamarin topic [Publishing an Application](https://docs.microsoft.com/xamarin/android/deploy-test/publishing/). -This project contains a sample keystore called `xample.keystore`. This -keystore is only for demonstration purposes. Do not use it for anything -other thank example purposes. The password is `password`, and the -keystore contains one key named `publishingdoc` with the password of -`password`. +This project contains a sample keystore called `xample.keystore`. This +keystore is only for demonstration purposes. Do not use it for anything +other than example purposes. The password is `password`, and the +keystore contains one key named `publishingdoc` with the password of +`password`. +![Android app screenshot](Screenshots/screenshot.png) diff --git a/KitKat/README.md b/KitKat/README.md index 5b02682..ac6a24e 100644 --- a/KitKat/README.md +++ b/KitKat/README.md @@ -1,20 +1,23 @@ --- name: Xamarin.Android - KitKat -description: 'This sample provides an overview of new features of Android 4.4 KitKat, including User Interface, Storage Access Framework... #androidkitkat' +description: 'This sample provides an overview of new features of Android 4.4 KitKat, including User Interface, Storage Access Framework... (Android KitKat)' page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidkitkat urlFragment: kitkat --- # KitKat This sample provides an overview of new features of Android 4.4 "KitKat". Features include: - *User Interface*: basic property animations and Scenes. - *Storage Access Framework*: Loading and saving content with the new SAF UI. - *Printers*: Printing HTML content. - *Sensors*: Working with the new step counter. - *Hardware*: Setup for NFC hose-based card emulation. This example requires Xamarin.Android 4.11.0 or higher. diff --git a/README.md b/README.md index 2bf0c06..9cea5db 100644 --- a/README.md +++ b/README.md @@ -1,129 +1,129 @@ MonoDroid Samples ================= This repository contains Mono for Android samples, showing usage of various Android API wrappers from C#. Visit the [Android Sample Gallery](https://developer.xamarin.com/samples/android/all/) to download individual samples. License ------- The Apache License 2.0 applies to all samples in this repository. Copyright 2011 Xamarin Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Contributing ------------ Before adding a sample to the repository, please run either install-hook.bat or install-hook.sh depending on whether you're on Windows or a POSIX system. This will install a Git hook that runs the Xamarin code sample validator before -a commit, to ensure that all samples are good to go. - +a commit, to ensure that all samples are good to go. + Samples Submission Guidelines ============================= ## Galleries We love samples! Application samples show off our platform and provide a great way for people to learn our stuff. And we even promote them as a first-class feature of the docs site. You can find the sample galleries here: * [Xamarin Forms Samples](http://developer.xamarin.com/samples/xamarin-forms/all/) * [iOS Samples](http://developer.xamarin.com/samples/ios/all/) * [Mac Samples](http://developer.xamarin.com/samples/mac/all/) * [Android Samples](http://developer.xamarin.com/samples/android/all/) ## Sample GitHub Repositories These sample galleries are populated by samples in these GitHub repos: * [https://github.com/xamarin/xamarin-forms-samples](https://github.com/xamarin/xamarin-forms-samples) * [https://github.com/xamarin/mobile-samples](https://github.com/xamarin/mobile-samples) * [https://github.com/xamarin/ios-samples](https://github.com/xamarin/ios-samples) * [https://github.com/xamarin/mac-samples](https://github.com/xamarin/mac-samples) * [https://github.com/xamarin/monodroid-samples](https://github.com/xamarin/monodroid-samples) * [https://github.com/xamarin/mac-ios-samples](https://github.com/xamarin/mac-ios-samples) The [mobile-samples](https://github.com/xamarin/mobile-samples) repository is for samples that are cross-platform. The [mac-ios-samples](https://github.com/xamarin/mac-ios-samples) repository is for samples that are Mac/iOS only. ## Sample Requirements We welcome sample submissions, please start by creating an issue with your proposal. Because the sample galleries are powered by the github sample repos, each sample needs to have the following things: * **Screenshots** - a folder called Screenshots that has at least one screen shot of the sample (preferably a screen shot for every page or every major functionality piece, people really key off these things). for the xplat samples, the folder should be split into platform folders, e.g. iOS, Android, Windows. see[ https://github.com/xamarin/mobile-samples/tree/master/Tasky/Screenshots](https://github.com/xamarin/mobile-samples/tree/master/Tasky/Screenshots) for an example of this. * **Readme** - a[ README.md](http://readme.md/) file that has the name of the sample, a description, and author attribution. sample here:[ https://github.com/xamarin/mobile-samples/blob/master/Tasky/README.md](https://github.com/xamarin/mobile-samples/blob/master/Tasky/README.md) * **Metadata** - Finally, it needs a Metadata.xml file ([https://github.com/xamarin/mobile-samples/blob/master/Tasky/Metadata.xml](https://github.com/xamarin/mobile-samples/blob/master/Tasky/Metadata.xml)) that has some information: * **ID** - A GUID for the sample. You can generate this in MD under Tools menu : Insert GUID. we need this to key between articles and their associated samples * **IsFullApplication** - Boolean flag (true or false): whether or not this is a full application such as the MWC App, Tasky, etc., or it's just a feature sample, such as, how to use 'x' feature. the basic test here is, if you would submit this to the app store because it's useful, then it's a full app, otherwise it's just a feature sample. * **Brief** - Short description or what your sample does. This allows us to display a nice and clean vignette on the sample page. * **Level** - Beginning, Intermediate, or Advanced: this is the intended audience level for the sample. only the getting started samples are Beginning, as they are intended for people who are _just_ starting with the platform. most samples are Intermediate, and a few, that dive deep into difficult APIs, should be Advanced. * **Minimum License Requirement** - Starter, Indie, Business, or Enterprise: denotes the license that a user has to have in order to build/run the sample. * **Tags**: a list of relevant tags for the app. These are: * **Data** * **Games** * **Graphics** (CoreDrawing, Animation, OpenGL...) * **Media** (Video, Sound, recording, photos) * **Platform Features** (Photo Library, Contacts, Calendars, etc.) * **Device Features** (NFC, Accelerometer, Compass, Magnemometer, Bluetooth, RFID) * **Cloud** (Web Services, Networking, etc.) * **Backgrounding** * **Maps + Location** * **Binding + Interop** (Projections) * **Notifications** * **Touch** * **Getting Started** * **Async** * **FSharp** * **SupportedPlatforms**: this is only for cross plat samples. It's a comma-separated list, and the valid values are iOS, Android, and Windows. * **Gallery**: This tag must contain a value of true if you want the sample to show up in the samples gallery on the developer portal. * **Buildable Sln and CSProj file** - the project _must_ build and have the appropriate project scaffolding (solution + proj). A good example of this stuff is here in the drawing sample:[ https://github.com/xamarin/monotouch-samples/tree/master/Drawing](https://github.com/xamarin/ios-samples/tree/master/Drawing) For a cross-platform sample, please see: https://github.com/xamarin/mobile-samples/tree/master/Tasky ## GitHub Integration We integrate tightly with Git to make sure we always provide working samples to our customers. This is achieved through a pre-commit hook that runs before your commit goes through, as well as a post-receive hook on GitHub's end that notifies our samples gallery server when changes go through. To you, as a sample committer, this means that before you push to the repos, you should run the "install-hook.bat" or "install-hook.sh" (depending on whether you're on Windows or OS X/Linux, respectively). These will install the Git pre-commit hook. Now, whenever you try to make a Git commit, all samples in the repo will be validated. If any sample fails to validate, the commit is aborted; otherwise, your commit goes through and you can go ahead and push. This strict approach is put in place to ensure that the samples we present to our customers are always in a good state, and to ensure that all samples integrate correctly with the sample gallery (README.md, Metadata.xml, etc). Note that the master branch of each sample repo is what we present to our customers for our stable releases, so they must *always* Just Work. Should you wish to invoke validation of samples manually, simply run "validate.windows" or "validate.posix" (again, Windows vs OS X/Linux, respectively). These must be run from a Bash shell (i.e. a terminal on OS X/Linux or the Git Bash terminal on Windows). If you have any questions, don't hesitate to ask! diff --git a/UpdateUsersProfile/README.md b/UpdateUsersProfile/README.md index e785d7a..5b0c08d 100644 --- a/UpdateUsersProfile/README.md +++ b/UpdateUsersProfile/README.md @@ -1,26 +1,22 @@ --- name: Xamarin.Android - Update the User's Profile description: This sample app accompanies the recipe, Update the User's Profile. This sample creates a display name for the owner of the device (John Doe) and... page_type: sample languages: - csharp products: - xamarin urlFragment: updateusersprofile --- -# Update the User's Profile +# Update the User's Profile in Xamarin.Android -This sample app accompanies the recipe, -[Update the User's Profile](http://developer.xamarin.com/recipes/android/data/contentproviders/update_the_users_profile/). +This sample app accompanies the recipe, +[Update the User's Profile](https://github.com/xamarin/docs-archive/tree/master/Recipes/android/data/contentproviders/update_the_users_profile). -This sample creates a display name for the owner of the device ("John -Doe") and adds this name to the user profile. The user profile data is -read back to confirm that the name was set, then launches the -**Contacts** app to view the user's profile. A single screen provides a -button that initiates the update and view sequence: +This sample creates a display name for the owner of the device ("John +Doe") and adds this name to the user profile. The user profile data is +read back to confirm that the name was set, then launches the +**Contacts** app to view the user's profile. A single screen provides a +button that initiates the update and view sequence: ![Update the User's Profile application screenshot](Screenshots/screenshot-1.png "Update the User's Profile application screenshot") - -## Author - -Mark McLemore diff --git a/WeatherREST/README.md b/WeatherREST/README.md index d507032..7a30d7b 100644 --- a/WeatherREST/README.md +++ b/WeatherREST/README.md @@ -1,42 +1,38 @@ --- name: Xamarin.Android - WeatherREST description: This sample app accompanies the article, Call a REST Web Service. You can use this sample to learn how to call a RESTful service via HTTP and... page_type: sample languages: - csharp products: - xamarin urlFragment: weatherrest --- # WeatherREST -This sample app accompanies the article, -[Call a REST Web Service](http://developer.xamarin.com/recipes/android/web_services/consuming_services/call_a_rest_web_service/). -You can use this sample to learn how to call a RESTful service via -HTTP and handle/parse the JSON results asynchronously. - -This example app sends latitude and longitude information in an HTTP -request (to *Geonames.org*) and gets back weather information for that -longitude and latitude. The user keys in the global latitude and -longitude parameters and then presses **Get Weather**. When the HTTP -response is received, the app parses the results and displays a subset -of the weather information in textbox fields in the lower half of the -display: - -This example uses `System.Json` to parse the results of the HTTP -request. The HTTP request, response, parsing, and display are handled -asynchronously via `async`/`await`. - -Note that this sample uses a geonames.org demo account, which supports -a limited number of accesses. If the display is not reporting weather -information, check your IDE output window to view the HTTP response and -see if it contains a "daily limit has been exceeded" message. - -You will need an Android device or emulator with a large screen (such as -a Nexus 5 or an AVD with the WXGA720 skin) to view the results. +This sample app accompanies +[Call a REST Web Service](https://github.com/xamarin/docs-archive/tree/master/Recipes/android/web_services/consuming_services/call_a_rest_web_service). +You can use this sample to learn how to call a RESTful service via +HTTP and handle/parse the JSON results asynchronously. + +This example app sends latitude and longitude information in an HTTP +request (to *Geonames.org*) and gets back weather information for that +longitude and latitude. The user keys in the global latitude and +longitude parameters and then presses **Get Weather**. When the HTTP +response is received, the app parses the results and displays a subset +of the weather information in textbox fields in the lower half of the +display: ![WeatherREST application screenshot](Screenshots/before.png "WeatherREST application screenshot") -## Author +This example uses `System.Json` to parse the results of the HTTP +request. The HTTP request, response, parsing, and display are handled +asynchronously via `async`/`await`. + +Note that this sample uses a geonames.org demo account, which supports +a limited number of accesses. If the display is not reporting weather +information, check your IDE output window to view the HTTP response and +see if it contains a "daily limit has been exceeded" message. -Mark McLemore +You will need an Android device or emulator with a large screen (such as +a Nexus 5 or an AVD with the WXGA720 skin) to view the results. diff --git a/android-m/AutoBackup/README.md b/android-m/AutoBackup/README.md index 123239e..a66e629 100644 --- a/android-m/AutoBackup/README.md +++ b/android-m/AutoBackup/README.md @@ -1,29 +1,31 @@ --- name: Xamarin.Android - AutoBackup Sample -description: "Demonstrates how to selectively disable Automatic Backups in #androidmarshmallow" +description: "Demonstrates how to selectively disable Automatic Backups in (Android Marshmallow)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidmarshmallow urlFragment: android-m-autobackup --- # AutoBackup Sample This sample demonstrates how to selectively disable Automatic Backups in Android M. ## Instructions -* Tap the Add File button to create a file with selected specifications. +- Tap the Add File button to create a file with selected specifications. ## Build Requirements Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ![AutoBackup Sample application screenshot](Screenshots/add-file.png "AutoBackup Sample application screenshot") -## Author +## License Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Automatic Backup Sample](https://github.com/googlesamples/android-AutoBackupForApps) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-m/ConfirmCredential/README.md b/android-m/ConfirmCredential/README.md index 9e2ab66..42b0be3 100644 --- a/android-m/ConfirmCredential/README.md +++ b/android-m/ConfirmCredential/README.md @@ -1,28 +1,32 @@ --- name: Xamarin.Android - Confirm Credential Sample -description: "Demonstrates how to use device credentials (PIN, Pattern, Password) in your app #androidmarshmallow" +description: "Demonstrates how to use device credentials (PIN, Pattern, Password) in your app (Android Marshmallow)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidmarshmallow urlFragment: android-m-confirmcredential --- # Confirm Credential Sample This sample demonstrates how to use device credentials (PIN, Pattern, Password) in your app. +![Confirm Credential Sample application screenshot](Screenshots/confirm-pattern.png "Confirm Credential Sample application screenshot") + ## Instructions -* Set up a secure lock screen in ‘Settings -> Security -> Screenlock’. -* Tap the Purchase button and confirm the secure lock screen credentials. +- Set up a secure lock screen in **Settings > Security > Screenlock**. +- Tap the Purchase button and confirm the secure lock screen credentials. ## Build Requirements + Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview -![Confirm Credential Sample application screenshot](Screenshots/confirm-pattern.png "Confirm Credential Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Confirm Credential Sample](https://github.com/googlesamples/android-ConfirmCredential) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-m/FingerprintDialog/README.md b/android-m/FingerprintDialog/README.md index b100ef4..29872e0 100644 --- a/android-m/FingerprintDialog/README.md +++ b/android-m/FingerprintDialog/README.md @@ -1,29 +1,34 @@ --- name: Xamarin.Android - Fingerprint Dialog Sample -description: "Demonstrates how to use registered fingerprints to authenticate the user in an app #androidmarshmallow" +description: "Demonstrates how to use registered fingerprints to authenticate the user in an app (Android Marshmallow)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidmarshmallow urlFragment: android-m-fingerprintdialog --- # Fingerprint Dialog Sample This sample demonstrates how to use registered fingerprints to authenticate the user in an app. +![Fingerprint Dialog Sample application screenshot](Screenshots/enable-fingerprint-lock.png "Fingerprint Dialog Sample application screenshot") + ## Instructions -* Touch the Purchase button to open a fingerprint authentication dialog. -* Either scan in your registered fingerprint to authenticate or enter your password. -* Requires a device with a built in fingerprint reader. -* This app does not store either your fingerprint nor your password. + +- Touch the Purchase button to open a fingerprint authentication dialog. +- Either scan in your registered fingerprint to authenticate or enter your password. +- Requires a device with a built in fingerprint reader. +- This app does not store either your fingerprint nor your password. ## Build Requirements + Building this sample requires a device that is Android M or later, the Xamarin.Android M Web Preview, and the Android M Developer Preview. -![Fingerprint Dialog Sample application screenshot](Screenshots/enable-fingerprint-lock.png "Fingerprint Dialog Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Fingerprint Dialog Sample](https://github.com/googlesamples/android-FingerprintDialog) -Ported to Xamarin.Android by Aaron Sky \ No newline at end of file diff --git a/android-m/RuntimePermissions/README.md b/android-m/RuntimePermissions/README.md index 1fd1906..0ae602c 100644 --- a/android-m/RuntimePermissions/README.md +++ b/android-m/RuntimePermissions/README.md @@ -1,29 +1,33 @@ --- name: Xamarin.Android - Runtime Permissions Sample -description: "Dhows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime... #androidmarshmallow" +description: "Dhows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime... (Android Marshmallow)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidmarshmallow urlFragment: android-m-runtimepermissions --- # Runtime Permissions Sample This sample shows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime, handle backwards compatibility using the support library and how to declare optional permissions for M-devices only. +![Runtime Permissions Sample application screenshot](Screenshots/camera-fragment.png "Runtime Permissions Sample application screenshot") + ## Instructions -* Tap on the Camera or Contacts buttons to display a permissions request dialog. -* Grant permission to view Camera or Contacts fragments. +- Tap on the Camera or Contacts buttons to display a permissions request dialog. +- Grant permission to view Camera or Contacts fragments. ## Build Requirements + Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview -![Runtime Permissions Sample application screenshot](Screenshots/camera-fragment.png "Runtime Permissions Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android RuntimePermissions Sample](https://github.com/googlesamples/android-RuntimePermissions) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-n/ActiveNotifications/README.md b/android-n/ActiveNotifications/README.md index 835459a..491d18e 100644 --- a/android-n/ActiveNotifications/README.md +++ b/android-n/ActiveNotifications/README.md @@ -1,32 +1,37 @@ --- name: Xamarin.Android - Active Notifications Sample -description: "Demonstrates how to use the NotficationManager API to tell you how many notifications your application is currently showing... #androidnougat" +description: "Demonstrates how to use the NotficationManager API to tell you how many notifications your application is showing... (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-activenotifications --- # Active Notifications Sample This sample demonstrates how to use the NotficationManager API to tell you how many notifications your application is currently showing. +![Android app with notifications](Screenshots/active-notifications.png) + ## Instructions * Touch the 'Add a Notification' button to display a notification. * Scroll the notification bar down to clear notifications. ## Build Requirements + Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ## Notes -This sample will crash when attempting to simultaniously clear larger sets of notifications. See + +This sample will crash when attempting to simultaneously clear larger sets of notifications. See https://github.com/googlesamples/android-ActiveNotifications/issues/1 for more info. -![Active Notifications Sample application screenshot](Screenshots/active-notifications.png "Active Notifications Sample application screenshot") +## License -## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android ActiveNotification Sample](https://github.com/googlesamples/android-ActiveNotifications) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-n/AppShortcuts/README.md b/android-n/AppShortcuts/README.md index 3689216..f576288 100644 --- a/android-n/AppShortcuts/README.md +++ b/android-n/AppShortcuts/README.md @@ -1,30 +1,31 @@ --- name: Xamarin.Android - AppShortcuts Sample -description: "Demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define... #androidnougat" +description: "Demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define... (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-appshortcuts --- # AppShortcuts Sample This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define a set of Intents which are displayed as when a user long-presses on the app's launcher icon. Examples are given for registering both links both statically in XML, as well as dynamically at runtime. +![AppShortcuts Sample application screenshot](Screenshots/Screenshot_1480604454.png) + ## Instructions You can use the shortcuts feature in Android 7.1 (API 25) to bring users from the launcher directly to key actions within your app. Users simply long-press your app's launcher icon to reveal the app's shortcuts, then tap on a shortcut to jump to the associated action. These shortcuts are a great way to engage users, and they let you surface the functionality of your app even before users launch your app. ## Build Requirements Using this sample requires the Android 7.1 (API 25) and the Xamarin.Android 7.1.99 or higher. - -![AppShortcuts Sample application screenshot](Screenshots/Screenshot_1480604454.png "AppShortcuts Sample application screenshot") - -## Author +## License Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android AppShortcuts Sample](https://github.com/googlesamples/android-AppShortcuts). -Ported to Xamarin.Android by Gonzalo Martin. diff --git a/android-n/CommitContentSample/README.md b/android-n/CommitContentSample/README.md index 85df720..717da75 100644 --- a/android-n/CommitContentSample/README.md +++ b/android-n/CommitContentSample/README.md @@ -1,39 +1,40 @@ --- name: Xamarin.Android - CommitContentSample -description: "Demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API... #androidnougat" +description: "Demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API... (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-commitcontentsample --- -# CommitContentSample +# CommitContentSample for Xamarin.Android This sample demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API. +![CommitContentSample application screenshot](Screenshots/Screenshot_1480948732.png) + ## Instructions You **must** run first the *SampleIME* project (following the instructions to enable the virtual keyboard) and then you can run the *SampleApp* project. - **SampleIME** This sample does not have a default Activity. After installing it, you will need to enable this app as a keyboard by navigating to Settings > Languages & Input > Virtual Keyboard > Manage Keyboards. This keyboard can then be accessed by pressing the virtual keyboard icon in the lower-right hand corner of the display while in a text field. **SampleApp** Users often want to communicate with emojis, stickers, and other kinds of rich content. In previous versions of Android, soft keyboards (input method editors or IMEs) could send only unicode emoji to apps. For rich content (such as images), apps had to either build app-specific APIs that couldn't be used in other apps or use workarounds like sending images through the Easy Share Action or the clipboard. - ## Build Requirements -Using this sample requires the Android 7.1 (API 25) and the Xamarin.Android 7.1.99 or higher. +Using this sample requires the Android 7.1 (API 25) and the Xamarin.Android 7.1.99 or higher. -![CommitContentSample application screenshot](Screenshots/Screenshot_1480948732.png "CommitContentSample application screenshot") +## License -## Authors Copyright (c) 2016 The Android Open Source Project, Inc. SampleIME ported from [CommitContentSampleIME](https://github.com/googlesamples/android-CommitContentSampleIME). SampleApp ported from [CommitContentSampleApp](https://github.com/googlesamples/android-CommitContentSampleApp). -Ported to Xamarin.Android by Gonzalo Martin. diff --git a/android-n/DirectBoot/README.md b/android-n/DirectBoot/README.md index 639f3b3..270752b 100644 --- a/android-n/DirectBoot/README.md +++ b/android-n/DirectBoot/README.md @@ -1,36 +1,37 @@ --- name: Xamarin.Android - Direct Boot Sample -description: "Demonstrates how to store data in a device-protected storage which is always available while the device is booted... #androidnougat" +description: "Demonstrates how to store data in a device-protected storage which is always available while the device is booted... (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-directboot --- -# Direct Boot Sample +# Direct Boot Sample for Xamarin.Android This sample demonstrates how to store data in a device-protected storage which is always available while the device is booted both before and after any user credentials(PIN/Pattern/Password) are entered. Sensitive data (such as user's emails, auth tokens) shouldn't be stored in a device-protected storage because the storage isn't protected by the user's credential (PIN/Pattern/Password). ## Instructions * Tap the alarm button in the bottom right to add an alarm. * When an alarm is triggered, a notification will be displayed. View the notification to end the alarm noise. ## Build Requirements Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview. ![Direct Boot Sample application screenshot](Screenshots/alarm_notification.png "Direct Boot Sample application screenshot") -## Author +## License Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android DirectBoot Sample](https://github.com/googlesamples/android-DirectBoot) - -Ported to Xamarin.Android by Peter Collins diff --git a/android-n/DirectReply/README.md b/android-n/DirectReply/README.md index c876765..3d14313 100644 --- a/android-n/DirectReply/README.md +++ b/android-n/DirectReply/README.md @@ -1,15 +1,18 @@ --- name: Xamarin.Android - Direct Replay Sample -description: "Demonstrates DirectReply feature for Android 7.0 #androidnougat" +description: "Demonstrates DirectReply feature for Android 7.0 (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-directreply --- # DirectReply in Xamarin.Android Demonstrates DirectReply feature for Android 7.0 ![Direct Reply Sample application screenshot](Screenshots/reply_message.png) \ No newline at end of file diff --git a/android-n/MessagingService/README.md b/android-n/MessagingService/README.md index 558cbd3..d506518 100644 --- a/android-n/MessagingService/README.md +++ b/android-n/MessagingService/README.md @@ -1,58 +1,61 @@ --- name: Xamarin.Android - Messaging Service Sample -description: "Shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input #androidnougat" +description: "Shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-messagingservice --- # Messaging Service Sample This sample shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input to allow Android N devices to reply via text directly from the notification without having to open an App. The same Remote Input object also allows Android Auto users to respond by voice when the notification is presented there. Note: Each unread conversation from a user is sent as a distinct notification. ## Introduction ## Flow MessagingFragment is shown to the user. Depending on the button clicked, the MessagingService is sent a message. MessagingService in turn creates notifications which can be viewed either on the device or in the messaging-simulator. When a message is read, the associated PendingIntent is triggered and MessageReadReceiver is called with the appropriate conversationId. Similarly, when a reply is received, the MessageReplyReceiver is called with the appropriate ConversationId. MessageLogger logs each event and shows them in a TextView in MessagingFragment for correlation. ## Instructions * Launch the application * Tap any button to send conversations * Read the message and observe the application registering the event * Clear the log and tap any button to send additional conversations ## Build Requirements Using this sample requires the Android SDK platform for Android 5.0 (API level 23). ## Screenshots <img src="Screenshots/1-one-convo-one-message.png" height="400" alt="Screenshot"/> <img src="Screenshots/2-two-convos-one-message.png" height="400" alt="Screenshot"/> <img src="Screenshots/3-one-convo-three-messages.png" height="400" alt="Screenshot"/> <img src="Screenshots/4-read-message.png" height="400" alt="Screenshot"/> ![Messaging Service Sample application screenshot](Screenshots/1-one-convo-one-message.png "Messaging Service Sample application screenshot") ## Authors Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android MessagingService Sample](https://github.com/googlesamples/android-messagingService) Ported to Xamarin.Android by Dylan Kelly diff --git a/android-n/MultiWindowPlayground/README.md b/android-n/MultiWindowPlayground/README.md index 5a90657..95f1515 100644 --- a/android-n/MultiWindowPlayground/README.md +++ b/android-n/MultiWindowPlayground/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - MultiWindow Playground Sample -description: "This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows #androidnougat" +description: "This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-multiwindowplayground --- # MultiWindow Playground Sample This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows. ## Instructions * Launch activities with different MultiWindow configurations by clicking the buttons. * Observe lifecycle events logged on screen. ## Build Requirements Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview. ![MultiWindow Playground Sample application screenshot](Screenshots/adjacent_activity.png "MultiWindow Playground Sample application screenshot") ## Author Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android MultiWindowPlayground Sample](https://github.com/googlesamples/android-MultiWindowPlayground). Ported to Xamarin.Android by Kyle White. \ No newline at end of file diff --git a/android-n/ScopedDirectoryAccess/README.md b/android-n/ScopedDirectoryAccess/README.md index a1d8992..c0a75ad 100644 --- a/android-n/ScopedDirectoryAccess/README.md +++ b/android-n/ScopedDirectoryAccess/README.md @@ -1,31 +1,33 @@ --- name: Xamarin.Android - Scoped Directory Access Sample -description: "Demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories #androidnougat" +description: "Demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories (Android Nougat)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidnougat urlFragment: android-n-scopeddirectoryaccess --- -# Scoped Directory Access Sample +# Scoped Directory Access Sample for Xamarin.Android This sample demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories. This serves as an alternative to having to define READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions in your manifest. ## Instructions * Select a directory location you'd like to access from the dropdown menu. * Tap 'Open' to request permission and then display the contents of the directory. ## Build Requirements Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview, as well as at least Android Build Tools v24.0.0 rc1. ![Scoped Directory Access Sample application screenshot](Screenshots/directory_content.png "Scoped Directory Access Sample application screenshot") -## Author +## License Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android ScopedDirectoryAccess Sample](https://github.com/googlesamples/android-ScopedDirectoryAccess) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-o/AndroidCipher/README.md b/android-o/AndroidCipher/README.md index 7ba94a6..976acf3 100644 --- a/android-o/AndroidCipher/README.md +++ b/android-o/AndroidCipher/README.md @@ -1,19 +1,20 @@ --- name: Xamarin.Android - AndroidCipher -description: "AndroidCipher is a simple project which encrypts and decrypts string with usage of android cipher #androidoreo" +description: "AndroidCipher is a simple project which encrypts and decrypts string with usage of android cipher (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-androidcipher --- # AndroidCipher -AndroidCipher is a simple project which encrypts and decrypts string with usage of android cipher. +AndroidCipher is a simple project which encrypts and decrypts string with usage of Android cipher. This sample demonstrates some of the new encryption algorithms available in Android 8.1 Namely, Cipher.getParameters().getParameterSpec(IvParameterSpec.class) no longer works for algorithms that use GCM. Instead, use getParameterSpec(GCMParameterSpec.class). -## Authors - -Malkin Dmytro \ No newline at end of file +![Android app with encrypt and decrypt inputs](Screenshots/android.png) diff --git a/android-o/AndroidPlayLocation/LocUpdFgService/README.md b/android-o/AndroidPlayLocation/LocUpdFgService/README.md index c8a758f..d4135e9 100644 --- a/android-o/AndroidPlayLocation/LocUpdFgService/README.md +++ b/android-o/AndroidPlayLocation/LocUpdFgService/README.md @@ -1,30 +1,32 @@ --- name: Xamarin.Android - LocationUpdatesForegroundService Sample -description: "Demonstrates how to use the Location API to get updates about a device's location using a bound and started foreground service.... #androidoreo" +description: "Demonstrates how to use the Location API to get updates about a device's location using a bound and started foreground service.... (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-androidplaylocation-locupdfgservice --- # LocationUpdatesForegroundService Sample This sample demonstrates how to use the Location API to get updates about a device's location using a bound and started foreground service. +![LocationUpdatesForegroundService Sample application screenshot](Screenshots/Main.png "LocationUpdatesForegroundService Sample application screenshot") + ## Instructions Press the “Request Location Updates” button to start the location updates service and listen any location changes. Press the “Remove Location Updates” if you do not want to listen any location updates. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. -![LocationUpdatesForegroundService Sample application screenshot](Screenshots/Main.png "LocationUpdatesForegroundService Sample application screenshot") +## License -## Authors Copyright (c) 2017 The Android Open Source Project, Inc. Ported from [Android LocationUpdatesForegroundService Sample](https://github.com/googlesamples/android-play-location/tree/master/LocationUpdatesForegroundService). -Ported to Xamarin.Android by Gonzalo Martin. diff --git a/android-o/AndroidPlayLocation/LocUpdPendIntent/README.md b/android-o/AndroidPlayLocation/LocUpdPendIntent/README.md index e56bfea..284aacc 100644 --- a/android-o/AndroidPlayLocation/LocUpdPendIntent/README.md +++ b/android-o/AndroidPlayLocation/LocUpdPendIntent/README.md @@ -1,32 +1,33 @@ --- name: Xamarin.Android - LocationUpdatesPendingIntent Sample -description: "Demonstrates how to use the Location API to get updates about a device's location using a PendingIntent #androidoreo" +description: "Demonstrates how to use the Location API to get updates about a device's location using a PendingIntent (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-androidplaylocation-locupdpendintent --- # LocationUpdatesPendingIntent Sample This sample demonstrates how to use the Location API to get updates about a device's location using a PendingIntent. +![LocationUpdatesPendingIntent Sample application screenshot](Screenshots/Main.png "LocationUpdatesPendingIntent Sample application screenshot") ## Instructions Sample shows implementation using an IntentService as well as a BroadcastReceiver. Press the “Request Updates” button to start the location updates service and listen any location changes. Press the “Remove Updates” if you do not want to listen any location updates. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. -![LocationUpdatesPendingIntent Sample application screenshot](Screenshots/Main.png "LocationUpdatesPendingIntent Sample application screenshot") +## License -## Authors Copyright (c) 2017 The Android Open Source Project, Inc. Ported from [Android LocationUpdatesPendingIntent Sample](https://github.com/googlesamples/android-play-location/tree/master/LocationUpdatesPendingIntent). -Ported to Xamarin.Android by Gonzalo Martin. \ No newline at end of file diff --git a/android-o/AutofillFramework/README.md b/android-o/AutofillFramework/README.md index 31e36aa..18aba29 100644 --- a/android-o/AutofillFramework/README.md +++ b/android-o/AutofillFramework/README.md @@ -1,29 +1,31 @@ --- name: Xamarin.Android - AutofillFramework Sample -description: "Demonstrates the use of the Autofill Framework, including implementations of client Activities with views that should be autofilled #androidoreo" +description: "Demonstrates the use of the Autofill Framework, including implementations of client Activities with views that should be autofilled (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-autofillframework --- # AutofillFramework Sample This sample demonstrates the use of the Autofill Framework. It includes implementations of client Activities with views that should be autofilled, and a Service that can provide autofill data to client Activities. +![AutofillFramework Sample application screenshot](Screenshots/ask_for_save.png "AutofillFramework Sample application screenshot") + ## Instructions To set the device's default Autofill service to the one in the sample, edit Settings > System > Languages & Input > Advanced > Auto-fill service and select the sample app. To edit the service's settings, tap the settings icon next to the Auto-fill service list item or open the Autofill Settings launcher icon.. Here, you can set whether you want to enable authentication on the entire autofill Response or just on individual autofill datasets. You should also set the master password to “unlock” authenticated autofill data with. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 8.0 or higher. +Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 8.0 or higher. -![AutofillFramework Sample application screenshot](Screenshots/ask_for_save.png "AutofillFramework Sample application screenshot") +## License -## Authors Copyright (c) 2017 The Android Open Source Project, Inc. Ported from [Android AutofillFramework Sample](https://github.com/googlesamples/android-AutofillFramework/). -Ported to Xamarin.Android by Malkin Dmytro. \ No newline at end of file diff --git a/android-o/DownloadableFonts/README.md b/android-o/DownloadableFonts/README.md index 928a96a..7d8c95a 100644 --- a/android-o/DownloadableFonts/README.md +++ b/android-o/DownloadableFonts/README.md @@ -1,30 +1,34 @@ --- name: Xamarin.Android - DownloadableFonts Sample -description: "Demonstrates how to use the Downloadable Fonts feature introduced in #androidoreo" +description: "Demonstrates how to use the Downloadable Fonts feature introduced in (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-downloadablefonts --- # DownloadableFonts Sample This sample demonstrates how to use the Downloadable Fonts feature introduced in Android O. Downloadable Fonts is a feature that allows apps to request a certain font from a provider instead of bundling it or downloading it themselves. This means, there is no need to bundle the font as an asset. +![DownloadableFonts Sample application screenshot](Screenshots/Crete Round font.png "DownloadableFonts Sample application screenshot") + ## Instructions There are two ways of requesting a font to download: + - Request a font to download from C# code - Declare a downloaded font in an XML file ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5.x or higher. -![DownloadableFonts Sample application screenshot](Screenshots/Crete Round font.png "DownloadableFonts Sample application screenshot") +## License -## Authors Copyright (c) 2017 The Android Open Source Project, Inc. Ported from [Android DownloadableFonts Sample](https://github.com/googlesamples/android-DownloadableFonts). -Ported to Xamarin.Android by Gonzalo Martin. \ No newline at end of file diff --git a/android-o/EmojiCompat/README.md b/android-o/EmojiCompat/README.md index 3899656..ce6701a 100644 --- a/android-o/EmojiCompat/README.md +++ b/android-o/EmojiCompat/README.md @@ -1,42 +1,42 @@ --- name: Xamarin.Android - EmojiCompat Sample -description: "Demonstrates usage of EmojiCompat support library. You can use this library to prevent your app from showing missing emoji #androidoreo" +description: "Demonstrates usage of EmojiCompat support library. You can use this library to prevent your app from showing missing emoji (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-emojicompat --- # EmojiCompat Sample This sample demonstrates usage of EmojiCompat support library. You can use this library to prevent your app from showing missing emoji characters in the form of tofu (□). You can use either bundled or downloadable emoji fonts. This sample shows both usages. -### Instructions +![EmojiCompat Sample application screenshot](Screenshots/Main.png "EmojiCompat Sample application screenshot") + +## Instructions The EmojiCompat support library aims to keep Android devices up to date with the latest emoji. It prevents your app from showing missing emoji characters in the form of ☐, which indicates that your device does not have a font to display the text. By using the EmojiCompat support library, your app users do not need to wait for Android OS updates to get the latest emoji. ### Configuration You need to first initialize EmojiCompat to load the metadata and the typeface. You can use either bundled or downloadable fonts. ## Build Requirements Using this sample requires the Android 8.0 (API 26) and the Xamarin.Android 7.5 or higher. - -![EmojiCompat Sample application screenshot](Screenshots/Main.png "EmojiCompat Sample application screenshot") - -## Authors +## License Copyright (c) 2017 The Android Open Source Project, Inc. Ported from [Android EmojiCompat Sample](https://github.com/googlesamples/android-EmojiCompat) - -Ported to Xamarin.Android by Gonzalo Martin diff --git a/android-o/NotificationChannels/README.md b/android-o/NotificationChannels/README.md index e813afd..28a7596 100644 --- a/android-o/NotificationChannels/README.md +++ b/android-o/NotificationChannels/README.md @@ -1,39 +1,38 @@ --- name: Xamarin.Android - NotificationChannels Sample -description: "Demonstrates how to use the new Notification Channels system introduced in #androidoreo" +description: "Demonstrates how to use the new Notification Channels system introduced in (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-notificationchannels --- -# NotificationChannels Sample +# NotificationChannels Sample for Xamarin.Android This sample demonstrates how to use the new Notification Channels system introduced in Android Oreo. This system allows for increased customization and control over how notifications are displayed. +![NotificationChannels Sample application screenshot](Screenshots/main_activity.png "NotificationChannels Sample application screenshot") ## Instructions Tap any of the Send buttons to create a notification. Both channels can be altered by tapping their respective settings buttons to demonstrate various notification options. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. -![NotificationChannels Sample application screenshot](Screenshots/main_activity.png "NotificationChannels Sample application screenshot") +## License -## Authors Ported from [Android NotificationChannels Sample](https://github.com/googlesamples/android-NotificationChannels). -Ported to Xamarin.Android by Peter Collins. - -## License Copyright (c) 2017 The Android Open Source Project, Inc. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \ No newline at end of file +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/android-o/PictureInPicture/README.md b/android-o/PictureInPicture/README.md index b11ac32..defaeff 100644 --- a/android-o/PictureInPicture/README.md +++ b/android-o/PictureInPicture/README.md @@ -1,39 +1,38 @@ --- name: Xamarin.Android - PictureInPicture Sample -description: "This sample demonstrates basic usage of the new Picture-in-Picture (PiP) mode for handheld devices introduced in #androidoreo" +description: "This sample demonstrates basic usage of the new Picture-in-Picture (PiP) mode for handheld devices introduced in (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-pictureinpicture --- -# PictureInPicture Sample +# PictureInPicture Sample for Xamarin.Android This sample demonstrates basic usage of the new Picture-in-Picture (PiP) mode for handheld devices introduced in Oreo. The sample plays a video which continues uninterrupted while switching back and forth between display modes or other activities. - ## Instructions Tap the button to drop in to Picture-in-Picture mode. Tapping on the PiP view will present controls which can be used to pause, show info, return to full screen, or exit the application. - ## Build Requirements -Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. +Using this sample requires the Android 8.0 (API 26) and Xamarin.Android 7.5.x or higher. -![PictureInPicture Sample application screenshot](Screenshots/main_activity.png "PictureInPicture Sample application screenshot") +![PictureInPicture Sample application screenshot](Screenshots/main_activity.png) -## Authors -Ported from [Android PictureInPicture Sample](https://github.com/googlesamples/android-PictureInPicture/). -Ported to Xamarin.Android by Peter Collins. +## License +Ported from [Android PictureInPicture Sample](https://github.com/googlesamples/android-PictureInPicture/). -## License -Copyright (c) 2017 The Android Open Source Project, Inc. +Original copyright (c) 2017 The Android Open Source Project, Inc. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \ No newline at end of file +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/android-o/SafeBrowsing/README.md b/android-o/SafeBrowsing/README.md index c745843..d696f65 100644 --- a/android-o/SafeBrowsing/README.md +++ b/android-o/SafeBrowsing/README.md @@ -1,25 +1,25 @@ --- name: Xamarin.Android - SafeBrowsing -description: "SafeBrowsing is a simple project which demonstrates the safe browsing functionality of an Android Web View. This is a new feature in #androidoreo" +description: "SafeBrowsing is a simple project which demonstrates the safe browsing functionality of an Android Web View. This is a new feature in (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-o-safebrowsing --- # SafeBrowsing SafeBrowsing is a simple project which demonstrates the safe browsing functionality of an Android Web View. This is a new feature added in Android 8.1 (API 27). The recommended way to enable this feature is to add the following tag to your AndroidManifest file: + ```xml <meta-data android:name="android.webkit.WebView.EnableSafeBrowsing" android:value="true" /> ``` The StartSafeBrowsing method initializes safe browsing if the meta-data tag mentioned above is set. Safe browsing is not fully supported on all devices. - -## Authors - -Malkin Dmytro \ No newline at end of file diff --git a/android-p/AndroidPMiniDemo/README.md b/android-p/AndroidPMiniDemo/README.md index 774b23d..dd0cdd8 100644 --- a/android-p/AndroidPMiniDemo/README.md +++ b/android-p/AndroidPMiniDemo/README.md @@ -1,81 +1,84 @@ --- name: Xamarin.Android - Android P Mini Demo -description: "Sample app that accompanies the article, Android P Preview. This sample demonstrates the new display cutout and image... #androidpie" +description: "Demonstrates new display cutout and image notification features (Android Pie)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidpie urlFragment: android-p-androidpminidemo --- # Android P Mini Demo **AndroidPMiniDemo** is a sample app that accompanies the article, [Android P Preview](https://docs.microsoft.com/en-us/xamarin/android/platform/android-p). -This sample demonstrates the new display cutout and image notification features -in Android P. +This sample demonstrates the new display cutout and image notification features +in Android P. ## Display Cutout Demo The display cutout demo provides three buttons to select a display cutout mode: - **Short Edges** &ndash; Clicking this button causes the app to go full screen and set the [LayoutInDisplayCutoutModeShortEdges](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES) window attribute. This causes the app's white background to extend into the display cutout area. - **Never** &ndash; Clicking this button causes the app to go full screen and set the [LayoutInDisplayCutoutModeNever](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER) window attribute. This prevents the app's white background from extending into the display cutout area. - **Reset** &ndash; Changes the app back to non-fullscreen mode. If you are using the Android emulator, you must first enable cutout mode from within the emulator while it is running an Android P virtual device image: 1. Go to **System Settings > System > Advanced > Developer Options** 2. Under **Developer Options**, scroll down to **Drawing** and click **Simulate a display with a cutout**. 3. Select **Tall display cutout** to simulate a typical phone. ## Notification Demo The notification demo generates a notification by using the new [Person](https://developer.android.com/reference/android/app/Person.html) class, and it includes an image in the notification by using the new [Notification.MessagingStyle.Message.SetData](https://developer.android.com/reference/android/app/Notification.MessagingStyle.Message.html#setData%28java.lang.String,%20android.net.Uri) method. Clicking the **Send Image Notification** button causes the app to send an example text notification followed (several seconds later) by a notification that contains an image. ## Requirements - **Visual Studio** &ndash; If you are using Windows, version 15.8 Preview 5 or later of Visual Studio is required. If you are using a Mac, the current Beta version of Visual Studio for Mac or later is required. - **Xamarin.Android** &ndash; Xamarin.Android 9.0.0.17 or later must be installed with Visual Studio. - **Android SDK** &ndash; Android SDK API 28 or later must be installed via the Android SDK Manager. ![Android P Mini Demo application screenshot](Screenshots/1-image-notification.png "Android P Mini Demo application screenshot") ## Author Copyright 2018 Microsoft Created by Mark Mclemore diff --git a/android-support/ViewModel/README.md b/android-support/ViewModel/README.md index d325f83..3f8adb2 100644 --- a/android-support/ViewModel/README.md +++ b/android-support/ViewModel/README.md @@ -1,23 +1,26 @@ --- name: Xamarin.Android - ViewModel Sample -description: "This sample demonstrates usage of ViewModel and LifeCycle Architecture Components library by Android #androidoreo" +description: "This sample demonstrates usage of ViewModel and LifeCycle Architecture Components library by Android (Android Oreo)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidoreo urlFragment: android-support-viewmodel --- # Xamarin.Android ViewModel Sample This sample demonstrates usage of ViewModel and LifeCycle [Architecture Components](https://developer.android.com/topic/libraries/architecture/index.html) library by Android. ![ViewModel Sample application screenshot](Screenshots/Home.png "ViewModel Sample application screenshot") ## Build Requirements Using this sample requires the Android 8.1 (API 27) and the Xamarin.Android 8.2 or higher. ## License Original copyright (c) 2018 The Android Open Source Project, Inc. diff --git a/android5.0/ActivitySceneTransitionBasic/README.md b/android5.0/ActivitySceneTransitionBasic/README.md index e851a1b..c30e58c 100644 --- a/android5.0/ActivitySceneTransitionBasic/README.md +++ b/android5.0/ActivitySceneTransitionBasic/README.md @@ -1,28 +1,31 @@ --- name: Xamarin.Android - ActivitySceneTransitionBasic -description: "Demonstrates how to the use Activity scene transitions when transitioning from one activity to another #androidlollipop" +description: "Demonstrates how to the use Activity scene transitions when transitioning from one activity to another (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-activityscenetransitionbasic --- # Xamarin.Android ActivitySceneTransitionBasic This sample demonstrates how to the use Activity scene transitions when transitioning from one activity to another. Uses a combination of moveImage and changeBounds to nicely transition from a grid of images to an activity with a large image and detail text. +![ActivitySceneTransitionBasic application screenshot](Screenshots/Detailed View.png) + ## Instructions * Touch each photo to activate a transition to a details page for each one. * Hitting the back button will activate a transition back to the grid of photos. ## Build Requirements This sample requires Xamarin.Android 4.17 or later and an Android L or later device. -![ActivitySceneTransitionBasic application screenshot](Screenshots/Detailed View.png "ActivitySceneTransitionBasic application screenshot") - -## Author +## License Original copyright (c) 2005-2008, The Android Open Source Project diff --git a/android5.0/AppRestrictionSchema/README.md b/android5.0/AppRestrictionSchema/README.md index 6c13db4..37356f1 100644 --- a/android5.0/AppRestrictionSchema/README.md +++ b/android5.0/AppRestrictionSchema/README.md @@ -1,30 +1,33 @@ --- name: Xamarin.Android - App Restriction Schema -description: "This sample shows a basic demonstration of using a profile owner to set app restrictions in Android #androidlollipop" +description: "This sample shows a basic demonstration of using a profile owner to set app restrictions in Android (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-apprestrictionschema --- # App Restriction Schema This sample shows a basic demonstration of using a profile owner to set app restrictions in Android. This is to used alongside AppRestrictionEnforcer, which serves as a profile owner for this. ![App Restriction Schema application screenshot](Screenshots/Not Restricted.png "App Restriction Schema application screenshot") ## Instructions - Run the project - Pressing the button on this fragment pops up a simple Toast message. The button is enabled or disabled according to the restrictions set by device/profile owner. You can use the AppRestrictionEnforcer sample as a profile owner for this. ## Build Requirements - Xamarin Studio 5.3+ - Xamarin Android 4.20+ - Android SDK (Lollipop) ## License Original copyright 2014 The Android Open Source Project diff --git a/android5.0/AppUsageStatistics/README.md b/android5.0/AppUsageStatistics/README.md index 9ae3c5d..09ddace 100644 --- a/android5.0/AppUsageStatistics/README.md +++ b/android5.0/AppUsageStatistics/README.md @@ -1,41 +1,44 @@ --- name: Xamarin.Android - App Usage Statistics Sample -description: "Shows how to use the App usage statistics API to let users collect statistics related to usage of the applications #androidlollipop" +description: "Shows how to use the App usage statistics API to let users collect statistics related to usage of the applications (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-appusagestatistics --- # App Usage Statistics Sample This sample shows how to use the App usage statistics API to let users collect statistics related to usage of the applications. ![App Usage Statistics Sample application screenshot](Screenshots/1-view-daily.png) ![Weekly view](Screenshots/2-view-weekly.png) ## Introduction The App usage statistics API allows app developers to collect statistics related to usage of the applications. This API provides more detailed usage information than the deprecated getRecentTasks() method. This example illustrates how to use the App usage statistics API by showing the applications sorted by the timestamp of the last time each app was used. ## Instructions * If it exists, tap on the "Open Apps with usage access settings" button and grant permission to access app usage statistics * Tap on the drop down list and select an interval * View basic usage statistics for apps on the device ## Build Requirements Using this sample requires the Android SDK platform for Android 5.0 (API level 21). ## License Original copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android AppUsageStatistics Sample](https://github.com/googlesamples/android-AppUsageStatistics) diff --git a/android5.0/Camera2Basic/Readme.md b/android5.0/Camera2Basic/Readme.md index dcddde0..9d1d7dd 100644 --- a/android5.0/Camera2Basic/Readme.md +++ b/android5.0/Camera2Basic/Readme.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Camera2 Basic Sample -description: "Demonstrates how to use the new Camera2 APIs to render a preview of a camera's viewport, capture an image and save it #androidlollipop" +description: "Demonstrates how to use the new Camera2 APIs to render a preview of a camera's viewport, capture an image and save it (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-camera2basic --- # Xamarin.Android Camera2 Basic Sample This sample demonstrates how to use the new Camera2 APIs to render a preview of a camera's viewport, capture an image and save it to the device's storage. ![Camera2 Basic Sample application screenshot](Screenshots/Viewfinder.png "Camera2 Basic Sample application screenshot") ## Instructions - Touch the Picture button to take a photo that will automatically be saved on your device. - Touch the info button to find out a little bit more about the app. - Requires a device with a rear facing camera ## Build Requirements Using this sample requires a device that is Android L or later and Xamarin.Android 4.17 or later. ## License Original copyright (c) 2005-2008, The Android Open Source Project diff --git a/android5.0/Camera2Raw/README.md b/android5.0/Camera2Raw/README.md index 199d8db..1c2d848 100644 --- a/android5.0/Camera2Raw/README.md +++ b/android5.0/Camera2Raw/README.md @@ -1,31 +1,34 @@ --- name: Xamarin.Android - Camera2Raw Sample -description: "Demonstrates how to use the Camera2 APIs to capture RAW camera buffers and save them to the devices storage as a dng file #androidlollipop" +description: "Demonstrates how to use the Camera2 APIs to capture RAW camera buffers and save them to the devices storage as a dng file (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-camera2raw --- # Xamarin.Android Camera2Raw Sample This sample demonstrates how to use the Camera2 APIs to capture RAW camera buffers and save them to the devices storage as a dng file. ![Camera2Raw Sample application screenshot](Screenshots/Camera2Raw0.png "Camera2Raw Sample application screenshot") ## Instructions - Touch the Picture button to take two photos that will automatically be saved on your device. - Touch the Info button to find out a little bit more about the app. - Requires a device with a rear facing camera ## Build Requirements Using this sample requires a device that is Android 5.0 or later and Xamarin.Android 5.0 or later. ## License Original copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Camera2Raw Sample](https://github.com/googlesamples/android-Camera2Raw) diff --git a/android5.0/Camera2VideoSample/README.md b/android5.0/Camera2VideoSample/README.md index eb40107..a284e94 100644 --- a/android5.0/Camera2VideoSample/README.md +++ b/android5.0/Camera2VideoSample/README.md @@ -1,34 +1,37 @@ --- name: Xamarin.Android - Camera2Video -description: "Demonstrates how record video on Android L through the use of the Android.Hardware.Camera2 namespace #androidlollipop" +description: "Demonstrates how record video on Android L through the use of the Android.Hardware.Camera2 namespace (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-camera2videosample --- # Xamarin.Android Camera2Video This sample demonstrates how record video on Android L through the use of the Android.Hardware.Camera2 namespace. ![Camera2Video application screenshot](Screenshots/info.png "Camera2Video application screenshot") ## Instructions * Touch the Record button to begin recording video. * Touch the Stop button to stop recording video and save the video. * Touch the Info button to display some more information on the app. * Requires a device with a rear facing camera ## Build Requirements Using this sample requires a device that is Android L or later and Xamarin.Android 4.17 or later. ## Notes This sample is known to crash on various device and Lollipop version combinations. See https://github.com/googlesamples/android-Camera2Video/issues/2 for more info. ## License Original copyright (c) 2005-2008, The Android Open Source Project diff --git a/android5.0/CardViewSample/README.md b/android5.0/CardViewSample/README.md index 595cf37..2938682 100644 --- a/android5.0/CardViewSample/README.md +++ b/android5.0/CardViewSample/README.md @@ -1,30 +1,33 @@ --- name: Xamarin.Android - CardView -description: "Demonstration of the CardView API introduced in Android L. Run the project Adjust the sliders to adjust the elevation and corner... #androidlollipop" +description: "Demonstration of the CardView API introduced in Android L. Run the project Adjust the sliders to adjust the elevation... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-cardviewsample --- # Xamarin.Android CardView Demonstration of the CardView API introduced in Android L. ![CardView application screenshot](Screenshots/Adjusted.png "CardView application screenshot") ## Instructions - Run the project - Adjust the sliders to adjust the elevation and corner radius of the CardView ## Build Requirements - Xamarin Studio 5.3+ - Xamarin Android 4.17+ - Android SDK (L Preview) ## License Original copyright 2014 The Android Open Source Project diff --git a/android5.0/Cheesesquare/README.md b/android5.0/Cheesesquare/README.md index 06358c0..695f5a3 100644 --- a/android5.0/Cheesesquare/README.md +++ b/android5.0/Cheesesquare/README.md @@ -1,50 +1,53 @@ --- name: Xamarin.Android - Cheesesquare Sample -description: 'Demos the new Android Design library. This is not an exhaustive sample, but shows some of the important features #androidlollipop' +description: 'Demos the new Android Design library. This is not an exhaustive sample, but shows some of the important features (Android Lollipop)' page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-cheesesquare --- # Cheesesquare sample for Xamarin.Android > [!NOTE] > This is a port of the original Cheesesquare Sample by Chris Banes, available on GitHub: https://github.com/chrisbanes/cheesesquare ![Screenshot](Screenshots/screenshot.png) Demos the new Android Design library. This is not an exhaustive sample, but shows some of the important features in the Design library: - Collapsing Toolbar - FloatingActionButton - View anchoring - NavigationView - Snackbar ## Pre-requisites - Android SDK v22 - Android Build Tools v22.0.1 - Android Support Repository v22.2 ## License Copyright 2014 The Android Open Source Project, Inc. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/android5.0/ClippingBasic/README.md b/android5.0/ClippingBasic/README.md index 9965f3c..238b4f4 100644 --- a/android5.0/ClippingBasic/README.md +++ b/android5.0/ClippingBasic/README.md @@ -1,29 +1,32 @@ --- name: Xamarin.Android - ClippingBasic -description: "Demonstrates simple clipping in Android L. Touch the Show Log/Hide Log button to toggle the log. Touch the text to cycle... #androidlollipop" +description: "Demonstrates simple clipping in Android L. Touch the Show Log/Hide Log button to toggle the log (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-clippingbasic --- # ClippingBasic in Xamarin.Android This sample demonstrates simple clipping in Android L. ![ClippingBasic application screenshot](Screenshots/Clipped.png "ClippingBasic application screenshot") ## Instructions - Touch the Show Log/Hide Log button to toggle the log. - Touch the text to cycle through three different strings. - Touch the Clip/Remove Clipping button to toggle the clipping of the text. ## Build Requirements Using this sample requires a device that is Android L or later and Xamarin.Android 4.17 or later. ## Author Original copyright (c) 2005-2008, The Android Open Source Project diff --git a/android5.0/NotificationsLab/README.md b/android5.0/NotificationsLab/README.md index 4b5773c..ff78b21 100644 --- a/android5.0/NotificationsLab/README.md +++ b/android5.0/NotificationsLab/README.md @@ -1,52 +1,52 @@ --- name: Xamarin.Android - Android 5.0 Notifications Lab -description: This sample app accompanies the article, Local Notifications in Xamarin.Android. You can use this sample to try out the different notification... +description: "Demonstrates Local Notifications in Xamarin.Android (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-notificationslab --- # Android 5.0 Notifications Lab -This sample app accompanies the article, -[Local Notifications in Xamarin.Android](http://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/local_notifications_in_android/). +This sample app accompanies the article, +[Local Notifications in Xamarin.Android](https://docs.microsoft.com/xamarin/android/app-fundamentals/notifications/local-notifications). You can use this sample to try out the different notification styles and options in Android 5.0. +![Android 5.0 Notifications Lab application screenshot](Screenshots/1-start-screen.png "Android 5.0 Notifications Lab application screenshot") + A single screen provides the following options for selecting -the "ingredients" of a notification: +the "ingredients" of a notification: -- A textbox to enter the notification text. +- A textbox to enter the notification text. -- A selector for the notification style (normal, big text, image, inbox). +- A selector for the notification style (normal, big text, image, inbox). -- A selector for the visibility level of the notification on the +- A selector for the visibility level of the notification on the lockscreen (public, private, secret). - -- A selector for the priority of the notification (low, mimimum, default, - high, maximum). - -- A selector for the category of the notification. -- Switches for enabling/disabling large icon, sound, and vibrate +- A selector for the priority of the notification (low, mimimum, default, + high, maximum). + +- A selector for the category of the notification. + +- Switches for enabling/disabling large icon, sound, and vibrate options. -A launch button is located at the bottom of the screen to post a -notification with the above-selected options. +A launch button is located at the bottom of the screen to post a +notification with the above-selected options. + When you tap on a notification, it takes you to a "SecondActivity" screen to demonstrate how PendingIntents work. -To build and run this sample, you must first enable Android 5.0 support as -described in -[Setting Up an Android 5.0 Project](http://developer.xamarin.com/guides/android/platform_features/introduction_to_lollipop#settingup). -You will need an Android device or emulator with a large screen (such as -a Nexus 5 or an AVD with the WXGA720 skin) to view and select from all +To build and run this sample, you must first enable Android 5.0 support as +described in +[Setting Up an Android 5.0 Project](https://docs.microsoft.com/en-us/xamarin/android/platform/lollipop#settingup). +You will need an Android device or emulator with a large screen (such as +a Nexus 5 or an AVD with the WXGA720 skin) to view and select from all of the options. - -![Android 5.0 Notifications Lab application screenshot](Screenshots/1-start-screen.png "Android 5.0 Notifications Lab application screenshot") - -## Author - -Mark McLemore diff --git a/android5.0/RecyclerViewer/README.md b/android5.0/RecyclerViewer/README.md index 25d0860..8371909 100755 --- a/android5.0/RecyclerViewer/README.md +++ b/android5.0/RecyclerViewer/README.md @@ -1,41 +1,36 @@ --- name: Xamarin.Android - RecyclerViewer description: This sample app accompanies the articles CardView and RecyclerView. You can use this sample to learn how to use the new CardView and RecyclerView... page_type: sample languages: - csharp products: - xamarin urlFragment: android50-recyclerviewer --- # RecyclerViewer This sample app accompanies the articles -[CardView](http://developer.xamarin.com/guides/android/user_interface/cardview) and -[RecyclerView](http://developer.xamarin.com/guides/android/user_interface/recyclerview). +[CardView](https://docs.microsoft.com/xamarin/android/user-interface/controls/card-view) and +[RecyclerView](https://docs.microsoft.com/xamarin/android/user-interface/layouts/recycler-view/). You can use this sample to learn how to use the new `CardView` and `RecyclerView` widgets introduced with Android 5.0 Lollipop. -This app is a simple "Photo Album Viewer" that lets the user scroll up -and down to view a collection of photos. Each photo, which consists of -an image with caption text, is displayed as a row item in the -`RecyclerView`. The <span class="uiitem">Random Pick</span> button -randomly swaps a photo in the collection with the first photo to -demonstrate how `RecyclerView` is updated when the data set changes. -When the user taps a photo, a toast appears to display the number of -the photo within the collection &ndash; this demonstrates how item view -click handlers work. - -Each image/caption (photo) row item is displayed in a `CardView` -layout, and the app uses a single `RecyclerView` layout to hold and -display over thirty unique row items. An *adapter* is used to connect -the `RecyclerView` with a simple "Photo Album" database, a -*view-holder* is used to cache view references, and a linear *layout -manager* positions the `CardView` row items within the `RecyclerView`. +This app is a simple "Photo Album Viewer" that lets the user scroll up +and down to view a collection of photos. Each photo, which consists of +an image with caption text, is displayed as a row item in the +`RecyclerView`. The **Random Pick** button +randomly swaps a photo in the collection with the first photo to +demonstrate how `RecyclerView` is updated when the data set changes. +When the user taps a photo, a toast appears to display the number of +the photo within the collection &ndash; this demonstrates how item view +click handlers work. +Each image/caption (photo) row item is displayed in a `CardView` +layout, and the app uses a single `RecyclerView` layout to hold and +display over thirty unique row items. An *adapter* is used to connect +the `RecyclerView` with a simple "Photo Album" database, a +*view-holder* is used to cache view references, and a linear *layout +manager* positions the `CardView` row items within the `RecyclerView`. ![RecyclerViewer application screenshot](Screenshots/screen-1.png "RecyclerViewer application screenshot") - -## Author - -Mark McLemore diff --git a/android5.0/ThemeSwitcher/README.md b/android5.0/ThemeSwitcher/README.md index 0ed197a..43c4de9 100755 --- a/android5.0/ThemeSwitcher/README.md +++ b/android5.0/ThemeSwitcher/README.md @@ -1,29 +1,28 @@ --- name: Xamarin.Android - Android 5.0 Theme Switcher -description: This examples shows how to use different Android 5.0 Lollipop Material Theme styles in different activities, how to create a customized Material... +description: "Shows how to use different Android 5.0 Material Theme styles in different activities, how to create a customized... (Android Lollipop)" page_type: sample languages: - csharp products: - xamarin +extensions: + tags: + - androidlollipop urlFragment: android50-themeswitcher --- # Android 5.0 Theme Switcher -This examples shows how to use different Android 5.0 Lollipop Material Theme +This examples shows how to use different Android 5.0 Lollipop Material Theme styles in different activities, how to create a customized Material Theme style, and how to theme an individual view. A companion article is available at -[Material Theme](http://developer.xamarin.com/guides/android/user_interface/material_theme). +[Material Theme](https://docs.microsoft.com/xamarin/android/user-interface/material-theme). ## Requirements -To build and run this sample, you must first enable Android 5.0 support as -described in -[Setting Up an Android 5.0 Project](http://developer.xamarin.com/guides/android/platform_features/introduction_to_lollipop#settingup). +To build and run this sample, you must first enable Android 5.0 support as +described in +[Setting Up an Android 5.0 Project](https://docs.microsoft.com/xamarin/android/platform/lollipop#settingup). ![Android 5.0 Theme Switcher application screenshot](Screenshots/material-custom-theme.png "Android 5.0 Theme Switcher application screenshot") - -## Authors -Mark McLemore - diff --git a/wear/WearTest/README.md b/wear/WearTest/README.md index a698f70..b9cf934 100644 --- a/wear/WearTest/README.md +++ b/wear/WearTest/README.md @@ -1,16 +1,16 @@ --- name: Xamarin.Android - Android Wear Getting Started description: This sample app accompanies the Android Wear article, Getting Started. page_type: sample languages: - csharp products: - xamarin urlFragment: wear-weartest --- -# Android Wear Getting Started - -This sample app accompanies the Android Wear article, -[Getting Started](https://developer.xamarin.com/guides/android/wear/getting-started/). +# Android Wear getting started +This sample app accompanies the Android Wear article, +[Getting Started](https://docs.microsoft.com/xamarin/android/wear/get-started/). +![Android Wear on a watch](Screenshots/screenshot.png)
dotnet/android-samples
61ae448ff8915beb85d80919961b233f0b4d69e2
android M & N tags
diff --git a/android-m/AutoBackup/README.md b/android-m/AutoBackup/README.md index 13b05a3..123239e 100644 --- a/android-m/AutoBackup/README.md +++ b/android-m/AutoBackup/README.md @@ -1,27 +1,29 @@ --- name: Xamarin.Android - AutoBackup Sample -description: This sample demonstrates how to selectively disable Automatic Backups in Android M. Instructions Tap the Add File button to create a file with... +description: "Demonstrates how to selectively disable Automatic Backups in #androidmarshmallow" page_type: sample languages: - csharp products: - xamarin urlFragment: android-m-autobackup --- # AutoBackup Sample This sample demonstrates how to selectively disable Automatic Backups in Android M. ## Instructions * Tap the Add File button to create a file with selected specifications. ## Build Requirements + Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ![AutoBackup Sample application screenshot](Screenshots/add-file.png "AutoBackup Sample application screenshot") -## Authors +## Author + Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Automatic Backup Sample](https://github.com/googlesamples/android-AutoBackupForApps) Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-m/ConfirmCredential/README.md b/android-m/ConfirmCredential/README.md index ec8b070..9e2ab66 100644 --- a/android-m/ConfirmCredential/README.md +++ b/android-m/ConfirmCredential/README.md @@ -1,28 +1,28 @@ --- name: Xamarin.Android - Confirm Credential Sample -description: This sample demonstrates how to use device credentials (PIN, Pattern, Password) in your app. Instructions Set up a secure lock screen in ‘Settings... +description: "Demonstrates how to use device credentials (PIN, Pattern, Password) in your app #androidmarshmallow" page_type: sample languages: - csharp products: - xamarin urlFragment: android-m-confirmcredential --- # Confirm Credential Sample This sample demonstrates how to use device credentials (PIN, Pattern, Password) in your app. ## Instructions * Set up a secure lock screen in ‘Settings -> Security -> Screenlock’. * Tap the Purchase button and confirm the secure lock screen credentials. ## Build Requirements Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ![Confirm Credential Sample application screenshot](Screenshots/confirm-pattern.png "Confirm Credential Sample application screenshot") ## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Confirm Credential Sample](https://github.com/googlesamples/android-ConfirmCredential) Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-m/FingerprintDialog/README.md b/android-m/FingerprintDialog/README.md index 6eb295d..b100ef4 100644 --- a/android-m/FingerprintDialog/README.md +++ b/android-m/FingerprintDialog/README.md @@ -1,29 +1,29 @@ --- name: Xamarin.Android - Fingerprint Dialog Sample -description: This sample demonstrates how to use registered fingerprints to authenticate the user in an app. Instructions Touch the Purchase button to open a... +description: "Demonstrates how to use registered fingerprints to authenticate the user in an app #androidmarshmallow" page_type: sample languages: - csharp products: - xamarin urlFragment: android-m-fingerprintdialog --- # Fingerprint Dialog Sample This sample demonstrates how to use registered fingerprints to authenticate the user in an app. ## Instructions * Touch the Purchase button to open a fingerprint authentication dialog. * Either scan in your registered fingerprint to authenticate or enter your password. * Requires a device with a built in fingerprint reader. * This app does not store either your fingerprint nor your password. ## Build Requirements Building this sample requires a device that is Android M or later, the Xamarin.Android M Web Preview, and the Android M Developer Preview. ![Fingerprint Dialog Sample application screenshot](Screenshots/enable-fingerprint-lock.png "Fingerprint Dialog Sample application screenshot") ## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android Fingerprint Dialog Sample](https://github.com/googlesamples/android-FingerprintDialog) Ported to Xamarin.Android by Aaron Sky \ No newline at end of file diff --git a/android-m/RuntimePermissions/README.md b/android-m/RuntimePermissions/README.md index f755ab7..1fd1906 100644 --- a/android-m/RuntimePermissions/README.md +++ b/android-m/RuntimePermissions/README.md @@ -1,29 +1,29 @@ --- name: Xamarin.Android - Runtime Permissions Sample -description: This sample shows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime, handle backwards... +description: "Dhows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime... #androidmarshmallow" page_type: sample languages: - csharp products: - xamarin urlFragment: android-m-runtimepermissions --- # Runtime Permissions Sample This sample shows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime, handle backwards compatibility using the support library and how to declare optional permissions for M-devices only. ## Instructions * Tap on the Camera or Contacts buttons to display a permissions request dialog. * Grant permission to view Camera or Contacts fragments. ## Build Requirements Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ![Runtime Permissions Sample application screenshot](Screenshots/camera-fragment.png "Runtime Permissions Sample application screenshot") ## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android RuntimePermissions Sample](https://github.com/googlesamples/android-RuntimePermissions) Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-n/ActiveNotifications/README.md b/android-n/ActiveNotifications/README.md index 6ec6bc5..835459a 100644 --- a/android-n/ActiveNotifications/README.md +++ b/android-n/ActiveNotifications/README.md @@ -1,32 +1,32 @@ --- name: Xamarin.Android - Active Notifications Sample -description: This sample demonstrates how to use the NotficationManager API to tell you how many notifications your application is currently showing.... +description: "Demonstrates how to use the NotficationManager API to tell you how many notifications your application is currently showing... #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-activenotifications --- # Active Notifications Sample This sample demonstrates how to use the NotficationManager API to tell you how many notifications your application is currently showing. ## Instructions * Touch the 'Add a Notification' button to display a notification. * Scroll the notification bar down to clear notifications. ## Build Requirements Using this sample requires the Android M Developer Preview and the Xamarin.Android M Web Preview ## Notes This sample will crash when attempting to simultaniously clear larger sets of notifications. See https://github.com/googlesamples/android-ActiveNotifications/issues/1 for more info. ![Active Notifications Sample application screenshot](Screenshots/active-notifications.png "Active Notifications Sample application screenshot") ## Authors Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android ActiveNotification Sample](https://github.com/googlesamples/android-ActiveNotifications) Ported to Xamarin.Android by Peter Collins \ No newline at end of file diff --git a/android-n/AppShortcuts/README.md b/android-n/AppShortcuts/README.md index faf0566..3689216 100644 --- a/android-n/AppShortcuts/README.md +++ b/android-n/AppShortcuts/README.md @@ -1,29 +1,30 @@ --- name: Xamarin.Android - AppShortcuts Sample -description: This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define a set... +description: "Demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define... #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-appshortcuts --- # AppShortcuts Sample This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define a set of Intents which are displayed as when a user long-presses on the app's launcher icon. Examples are given for registering both links both statically in XML, as well as dynamically at runtime. ## Instructions You can use the shortcuts feature in Android 7.1 (API 25) to bring users from the launcher directly to key actions within your app. Users simply long-press your app's launcher icon to reveal the app's shortcuts, then tap on a shortcut to jump to the associated action. These shortcuts are a great way to engage users, and they let you surface the functionality of your app even before users launch your app. - ## Build Requirements + Using this sample requires the Android 7.1 (API 25) and the Xamarin.Android 7.1.99 or higher. ![AppShortcuts Sample application screenshot](Screenshots/Screenshot_1480604454.png "AppShortcuts Sample application screenshot") -## Authors +## Author + Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android AppShortcuts Sample](https://github.com/googlesamples/android-AppShortcuts). -Ported to Xamarin.Android by Gonzalo Martin. \ No newline at end of file +Ported to Xamarin.Android by Gonzalo Martin. diff --git a/android-n/CommitContentSample/README.md b/android-n/CommitContentSample/README.md index 542a654..85df720 100644 --- a/android-n/CommitContentSample/README.md +++ b/android-n/CommitContentSample/README.md @@ -1,39 +1,39 @@ --- name: Xamarin.Android - CommitContentSample -description: This sample demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API.... +description: "Demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API... #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-commitcontentsample --- # CommitContentSample This sample demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API. ## Instructions You **must** run first the *SampleIME* project (following the instructions to enable the virtual keyboard) and then you can run the *SampleApp* project. **SampleIME** This sample does not have a default Activity. After installing it, you will need to enable this app as a keyboard by navigating to Settings > Languages & Input > Virtual Keyboard > Manage Keyboards. This keyboard can then be accessed by pressing the virtual keyboard icon in the lower-right hand corner of the display while in a text field. **SampleApp** Users often want to communicate with emojis, stickers, and other kinds of rich content. In previous versions of Android, soft keyboards (input method editors or IMEs) could send only unicode emoji to apps. For rich content (such as images), apps had to either build app-specific APIs that couldn't be used in other apps or use workarounds like sending images through the Easy Share Action or the clipboard. ## Build Requirements Using this sample requires the Android 7.1 (API 25) and the Xamarin.Android 7.1.99 or higher. ![CommitContentSample application screenshot](Screenshots/Screenshot_1480948732.png "CommitContentSample application screenshot") ## Authors Copyright (c) 2016 The Android Open Source Project, Inc. SampleIME ported from [CommitContentSampleIME](https://github.com/googlesamples/android-CommitContentSampleIME). SampleApp ported from [CommitContentSampleApp](https://github.com/googlesamples/android-CommitContentSampleApp). Ported to Xamarin.Android by Gonzalo Martin. diff --git a/android-n/DirectBoot/README.md b/android-n/DirectBoot/README.md index ed25550..639f3b3 100644 --- a/android-n/DirectBoot/README.md +++ b/android-n/DirectBoot/README.md @@ -1,36 +1,36 @@ --- name: Xamarin.Android - Direct Boot Sample -description: This sample demonstrates how to store data in a device-protected storage which is always available while the device is booted both before and after... +description: "Demonstrates how to store data in a device-protected storage which is always available while the device is booted... #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-directboot --- # Direct Boot Sample This sample demonstrates how to store data in a device-protected storage which is always available while the device is booted both before and after any user credentials(PIN/Pattern/Password) are entered. Sensitive data (such as user's emails, auth tokens) shouldn't be stored in a device-protected storage because the storage isn't protected by the user's credential (PIN/Pattern/Password). ## Instructions * Tap the alarm button in the bottom right to add an alarm. * When an alarm is triggered, a notification will be displayed. View the notification to end the alarm noise. - ## Build Requirements -Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview. +Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview. ![Direct Boot Sample application screenshot](Screenshots/alarm_notification.png "Direct Boot Sample application screenshot") -## Authors +## Author + Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android DirectBoot Sample](https://github.com/googlesamples/android-DirectBoot) -Ported to Xamarin.Android by Peter Collins \ No newline at end of file +Ported to Xamarin.Android by Peter Collins diff --git a/android-n/DirectReply/README.md b/android-n/DirectReply/README.md index e69de29..c876765 100644 --- a/android-n/DirectReply/README.md +++ b/android-n/DirectReply/README.md @@ -0,0 +1,15 @@ +--- +name: Xamarin.Android - Direct Replay Sample +description: "Demonstrates DirectReply feature for Android 7.0 #androidnougat" +page_type: sample +languages: +- csharp +products: +- xamarin +urlFragment: android-n-directreply +--- +# DirectReply in Xamarin.Android + +Demonstrates DirectReply feature for Android 7.0 + +![Direct Reply Sample application screenshot](Screenshots/reply_message.png) \ No newline at end of file diff --git a/android-n/MessagingService/README.md b/android-n/MessagingService/README.md index c9e12a7..558cbd3 100644 --- a/android-n/MessagingService/README.md +++ b/android-n/MessagingService/README.md @@ -1,55 +1,58 @@ --- name: Xamarin.Android - Messaging Service Sample -description: This sample shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input to allow... +description: "Shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-messagingservice --- # Messaging Service Sample This sample shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input to allow Android N devices to reply via text directly from the notification without having to open an App. The same Remote Input object also allows Android Auto users to respond by voice when the notification is presented there. Note: Each unread conversation from a user is sent as a distinct notification. ## Introduction -#### Flow +## Flow + MessagingFragment is shown to the user. Depending on the button clicked, the MessagingService is sent a message. MessagingService in turn creates notifications which can be viewed either on the device or in the messaging-simulator. When a message is read, the associated PendingIntent is triggered and MessageReadReceiver is called with the appropriate conversationId. Similarly, when a reply is received, the MessageReplyReceiver is called with the appropriate ConversationId. MessageLogger logs each event and shows them in a TextView in MessagingFragment for correlation. ## Instructions * Launch the application * Tap any button to send conversations * Read the message and observe the application registering the event * Clear the log and tap any button to send additional conversations ## Build Requirements + Using this sample requires the Android SDK platform for Android 5.0 (API level 23). ## Screenshots <img src="Screenshots/1-one-convo-one-message.png" height="400" alt="Screenshot"/> <img src="Screenshots/2-two-convos-one-message.png" height="400" alt="Screenshot"/> <img src="Screenshots/3-one-convo-three-messages.png" height="400" alt="Screenshot"/> <img src="Screenshots/4-read-message.png" height="400" alt="Screenshot"/> ![Messaging Service Sample application screenshot](Screenshots/1-one-convo-one-message.png "Messaging Service Sample application screenshot") ## Authors + Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android MessagingService Sample](https://github.com/googlesamples/android-messagingService) Ported to Xamarin.Android by Dylan Kelly diff --git a/android-n/MultiWindowPlayground/README.md b/android-n/MultiWindowPlayground/README.md index 1d5492f..5a90657 100644 --- a/android-n/MultiWindowPlayground/README.md +++ b/android-n/MultiWindowPlayground/README.md @@ -1,30 +1,31 @@ --- name: Xamarin.Android - MultiWindow Playground Sample -description: This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows. Instructions Launch... +description: "This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-multiwindowplayground --- # MultiWindow Playground Sample This sample demonstrates how to use the MultiWindow API introduced in Android N allowing adjacent and floating app windows. ## Instructions * Launch activities with different MultiWindow configurations by clicking the buttons. * Observe lifecycle events logged on screen. - ## Build Requirements + Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview. ![MultiWindow Playground Sample application screenshot](Screenshots/adjacent_activity.png "MultiWindow Playground Sample application screenshot") -## Authors +## Author + Copyright (c) 2016 The Android Open Source Project, Inc. Ported from [Android MultiWindowPlayground Sample](https://github.com/googlesamples/android-MultiWindowPlayground). Ported to Xamarin.Android by Kyle White. \ No newline at end of file diff --git a/android-n/ScopedDirectoryAccess/README.md b/android-n/ScopedDirectoryAccess/README.md index b3c775b..a1d8992 100644 --- a/android-n/ScopedDirectoryAccess/README.md +++ b/android-n/ScopedDirectoryAccess/README.md @@ -1,31 +1,31 @@ --- name: Xamarin.Android - Scoped Directory Access Sample -description: This sample demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories. This serves as an... +description: "Demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories #androidnougat" page_type: sample languages: - csharp products: - xamarin urlFragment: android-n-scopeddirectoryaccess --- # Scoped Directory Access Sample This sample demonstrates how to use the Scoped Directory Access API introduced Android N to easily access specific directories. This serves as an alternative to having to define READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions in your manifest. ## Instructions * Select a directory location you'd like to access from the dropdown menu. * Tap 'Open' to request permission and then display the contents of the directory. - ## Build Requirements -Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview, as well as at least Android Build Tools v24.0.0 rc1. +Using this sample requires the Android N Developer Preview and the Xamarin.Android N Web Preview, as well as at least Android Build Tools v24.0.0 rc1. ![Scoped Directory Access Sample application screenshot](Screenshots/directory_content.png "Scoped Directory Access Sample application screenshot") -## Authors +## Author + Copyright (c) 2014 The Android Open Source Project, Inc. Ported from [Android ScopedDirectoryAccess Sample](https://github.com/googlesamples/android-ScopedDirectoryAccess) Ported to Xamarin.Android by Peter Collins \ No newline at end of file
jeresig/jeresig.github.com
c6326cd41c0f39ba7df13b26d565faf56dd64b69
Adding an index page.
diff --git a/index.html b/index.html new file mode 100644 index 0000000..a15219d --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +jeresig.github.com
farra/radiant-members-extension
dbfc995c86006cd43b9a7bc66ef80d3f1083f8d0
updating readme
diff --git a/README b/README index b906643..6d6f8ff 100644 --- a/README +++ b/README @@ -1,6 +1,40 @@ = Members Enhances the Radiant users model for use as a site-wide members -feature. To install: +feature. It makes the following changes: + +The User model now has a: + +- photo (file_column) +- url + +A new `Profile` tab is added. This becomes the default tab on login. +A new Snippet named `profile_sidebar` is created which can be used to +modify the profile page. + +All tabs except for Profile now default to require :developer or +:admin role access. This includes the Page and Snippets tabs. + +A new registration form will be created at: + + /admin/members/register + +To install: + +- rake db:migrate:extensions +- merge the contents of members/public/images into your public/images directory + + +The extension includes a copy of the file_column plugin. + + +There's *lots* still to be done, including: + +- Using email confirmation for registration +- Allowing for user registration approval +- Linking to the registration page on the login page +- RSpec tests + +For questions and suggestions contact Aaron Farr at + farra [at] apache [dot] org -- rake db:migrate:extensions \ No newline at end of file
farra/radiant-members-extension
73f811a3e73f74d6fe65f929939dd310ba5e0aeb
initial version
diff --git a/app/controllers/admin/members/profile_controller.rb b/app/controllers/admin/members/profile_controller.rb index c15cbfd..5b44684 100644 --- a/app/controllers/admin/members/profile_controller.rb +++ b/app/controllers/admin/members/profile_controller.rb @@ -1,30 +1,31 @@ -class Admin::Members::ProfileController < ApplicationController +class Admin::Members::ProfileController < Admin::AbstractModelController + model_class User + + login_required + def index - @current_user = current_user + @sidebar_text = '' + @user = current_user snippet = Snippet.find_by_name 'profile_sidebar' if snippet #TODO a bit a hack here to render the snippet in the context # of the first page. Is there a better way to render a snippet like this? p = Page.find(:all).first - @sidebar_text = p.render_snippet snippet + @sidebar_text = p.render_snippet snippet if p end end def edit - if params[:user][:password] != nil && params[:user][:password].size > 0 - current_user.update_attributes(params[:user]) - end - if params[:person][:id].size > 0 - person = Person.find(params[:person][:id]) - person.update_attributes(params[:person]) - else - person = Person.new(params[:person]) - person.user = current_user - current_user.person = person - end - person.save! - redirect_to :action => 'index' + # let's only allow editing the current user... + # self.model = model_class.find_by_id(params[:user][:id]) + self.model = current_user + handle_new_or_edit_post end + def continue_url(options) + return { :controller => 'admin/members/profile', :action => 'index' } + end + + end diff --git a/app/controllers/admin/members/register_controller.rb b/app/controllers/admin/members/register_controller.rb new file mode 100644 index 0000000..e217900 --- /dev/null +++ b/app/controllers/admin/members/register_controller.rb @@ -0,0 +1,23 @@ +class Admin::Members::RegisterController < Admin::AbstractModelController + model_class User + + no_login_required + skip_before_filter :verify_authenticity_token + + + def index + self.model = model_class.new + render :action => 'index', :layout => nil + end + + def new + self.model = model_class.new + handle_new_or_edit_post + end + + def continue_url(options) + return { :controller => 'admin/members/profile', :action => 'index' } + end + + +end diff --git a/app/helpers/admin/members/register_helper.rb b/app/helpers/admin/members/register_helper.rb new file mode 100644 index 0000000..2ac7e73 --- /dev/null +++ b/app/helpers/admin/members/register_helper.rb @@ -0,0 +1,2 @@ +module Admin::Members::RegisterHelper +end diff --git a/app/views/admin/members/.DS_Store b/app/views/admin/members/.DS_Store new file mode 100644 index 0000000..cfae582 Binary files /dev/null and b/app/views/admin/members/.DS_Store differ diff --git a/app/views/admin/members/profile/edit.html.erb b/app/views/admin/members/profile/edit.html.erb new file mode 100644 index 0000000..548c15f --- /dev/null +++ b/app/views/admin/members/profile/edit.html.erb @@ -0,0 +1,10 @@ +<% unless @user.errors.empty? %> + <ul> + <% @user.errors.each_full do |message| %> + <li><%= message %></li> + <% end %> + </ul> +<% end %> + + +<a href="javascript:window.back();">Go Back</a> diff --git a/app/views/admin/members/profile/index.html.erb b/app/views/admin/members/profile/index.html.erb new file mode 100644 index 0000000..531f980 --- /dev/null +++ b/app/views/admin/members/profile/index.html.erb @@ -0,0 +1,69 @@ + +<h2>Hello, <%= @user.name %></h2> + +<table width='100%'> + +<tr> +<td style="padding-left: 10px; vertical-align: top; width:300px;"> + <% if @user.photo %> + <%= image_tag url_for_file_column("user", "photo") %> + <% else %> + <img src="/images/admin/profile.png" alt="<%= @user.name%>" height="80" width="80"/> + <% end %> + <br/> + <%= @sidebar_text %> + +</td> + +<td> +<% form_tag '/admin/members/edit', :multipart => true do %> + <table class='fieldset'> + + <tr><th class='label'><label for="user_name">Name<label></th> + <td class='field'><%= text_field :user, :name %></td> + <td class='help'>Full name as you prefer it to appear on the website.</td> + </tr> + + <tr><th class='label'><label for="user_email">Email</label></th> + <td class='field'><%= text_field :user, :email %></td> + <td class='help'>Current email address.</td> + </tr> + + <tr><th class='label'><label class="optional" for="user_password">Password</label></th> + <td class='field'><%= password_field :user, :password, :value => ''%></td> + <td class='help'>You may optionally update your password.</td> + </tr> + + <tr><th class='label'><label class="optional" for="user_password_confirmation">Confirm Password</label></th> + <td class='field'><%= password_field :user, :password_confirmation %></td> + <td class='help'>Repeat your password.</td> + </tr> + + <tr><th class='label'><label class="optional" for="user_url">Website</label></th> + <td class='field' class='optional'><%= text_field :user, :url %></td> + <td class='help'>Your personal or company website. Requires <code>http://</code> prefix</td> + </tr> + + <tr><th class='label'><label class="optional" for="user_photo">Photo</label></th> + <td class='field'><%= file_column_field "user", "photo" %></td> + <td class='help'>A current photo.</td> + </tr> + + <tr><th class='label'><label class='optional' for="user_notes">Notes</a></th> + <td class='field'><%= text_area :user, :notes %></td> + <td class='help'><em>Text only</em> background and profile information.</td> + </tr> + + <tr><td colspan='3'> + <%= hidden_field :user, :id %> + <%= submit_tag 'Update' %> + </td></tr> + </table> +<% end %> + +</td> + + +</tr> + +</table> diff --git a/app/views/admin/members/register/index.html.haml b/app/views/admin/members/register/index.html.haml new file mode 100644 index 0000000..fcf92bd --- /dev/null +++ b/app/views/admin/members/register/index.html.haml @@ -0,0 +1,78 @@ + + +- content_for 'page_css' do + :sass + #content + text-align: center + #login + background-color: #f5f1e2 + border: 5px solid #efead3 + text-align: left + margin: 2em + margin-left: auto + margin-right: auto + padding: 5px 20px + padding-right: 22px + position: relative + width: 23.5em + h1 + font-size: 140% + margin: 0 + margin-top: 13px + table + width: 100% + margin: 15px 0 10px 0 + td + text-align: left + padding: 6px 0 + &.label + width: 6em + &.field + input.textbox + font-size: 100% + width: 98% + &.checkbox + font-size: 85% + &.buttons + text-align: right + input + font-size: 140% + +#login + %h1 Register + + - form_tag '/admin/members/register/new' do + %table + %tr + %td.label + %label{:for=>"user_name"} Full Name + %td.field{:colspan=>2} + = text_field "user", "name", :class => 'textbox activate', :value => '', :maxlength => 40, :size => 40 + %tr + %td.label + %label{:for=>"user_login"} Username + %td.field{:colspan=>2} + = text_field "user", "login", :class => 'textbox activate', :value => '', :maxlength => 40, :size => 40 + %tr + %td.label + %label{:for=>"user_email"} Email + %td.field{:colspan=>2} + = text_field "user", "email", :class => 'textbox activate', :value => '', :maxlength => 40, :size => 40 + %tr + %td.label + %label{:for=>"user_password"} Password + %td.field{:colspan=>2} + = password_field "user", "password", :class => 'textbox', :value => '', :maxlength => 40, :size => 40 + %tr + %td.label + %label{:for=>"user_password_confirmation"} Confirm Password + %td.field{:colspan=>2} + = password_field "user", "password_confirmation", :class => 'textbox', :value => '', :maxlength => 40, :size => 40 + %tr + %td + %td + All fields required. + %td.buttons + %input.button{:type=>"submit", :value=>"Register"}/ + += javascript_tag "$('user_login').activate();" \ No newline at end of file diff --git a/app/views/admin/members/register/new.html.erb b/app/views/admin/members/register/new.html.erb new file mode 100644 index 0000000..548c15f --- /dev/null +++ b/app/views/admin/members/register/new.html.erb @@ -0,0 +1,10 @@ +<% unless @user.errors.empty? %> + <ul> + <% @user.errors.each_full do |message| %> + <li><%= message %></li> + <% end %> + </ul> +<% end %> + + +<a href="javascript:window.back();">Go Back</a> diff --git a/members_extension.rb b/members_extension.rb index ba90a9f..69a488a 100644 --- a/members_extension.rb +++ b/members_extension.rb @@ -1,26 +1,67 @@ # Uncomment this if you reference any of your controllers in activate -# require_dependency 'application' +require_dependency 'application' class MembersExtension < Radiant::Extension version "1.0" description "Extends Radiant user model for site members" url "http://cubiclemuses.com/cm" define_routes do |map| - map.connect 'admin/members/profile/:action', :controller => 'admin/members/profile' + map.connect 'admin/members/register/:action', :controller => 'admin/members/register' + map.connect 'admin/members/:action', :controller => 'admin/members/profile' end def activate - admin.tabs.add "Profile", "/admin/members/profile", :after => "Layouts", :visibility => [:all] + admin.tabs.add "Profile", "/admin/members/", :after => "Layouts", :visibility => [:all] - User.class_eval { + User.class_eval do file_column :photo, :magick => { :geometry => "80x80>" } - } + validates_presence_of :email, :message => 'required' + end + Radiant::AdminUI::Tab.class_eval do + + alias_method :initialize_less_securely, :initialize unless method_defined?(:initialize_more_securely) + + def initialize_more_securely(name, url, options = {}) + @name, @url = name, url + @visibility = [options[:for], options[:visibility]].flatten.compact + @visibility = [:developer,:admin] if @visibility.empty? + end + + alias_method :initialize, :initialize_more_securely + + end + + Admin::PageController.class_eval do + only_allow_access_to :index, :new, :edit, :remove, + :when => [:developer, :admin], + :denied_url => { :controller => 'welcome', :action => 'index' }, + :denied_message => 'You must have developer privileges to perform this action.' + end + + Admin::SnippetController.class_eval do + only_allow_access_to :index, :new, :edit, :remove, + :when => [:developer, :admin], + :denied_url => { :controller => 'welcome', :action => 'index' }, + :denied_message => 'You must have developer privileges to perform this action.' + end + + Admin::WelcomeController.class_eval do + alias_method :index_to_page, :index unless method_defined?(:index_to_profile) + + def index_to_profile + redirect_to :controller => 'admin/members/profile', :action => 'index' + end + + alias_method :index, :index_to_profile + end + + end def deactivate admin.tabs.remove "Profile" end end diff --git a/public/images/profile.png b/public/images/profile.png new file mode 100644 index 0000000..9f4ef2b Binary files /dev/null and b/public/images/profile.png differ diff --git a/spec/controllers/admin/members/register_controller_spec.rb b/spec/controllers/admin/members/register_controller_spec.rb new file mode 100644 index 0000000..3a29b48 --- /dev/null +++ b/spec/controllers/admin/members/register_controller_spec.rb @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Admin::Members::RegisterController do + + #Delete this example and add some real ones + it "should use Admin::Members::RegisterController" do + controller.should be_an_instance_of(Admin::Members::RegisterController) + end + +end diff --git a/spec/helpers/admin/members/register_helper_spec.rb b/spec/helpers/admin/members/register_helper_spec.rb new file mode 100644 index 0000000..69bc9c1 --- /dev/null +++ b/spec/helpers/admin/members/register_helper_spec.rb @@ -0,0 +1,11 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Admin::Members::RegisterHelper do + + #Delete this example and add some real ones or delete this file + it "should include the Admin::Members::RegisterHelper" do + included_modules = self.metaclass.send :included_modules + included_modules.should include(Admin::Members::RegisterHelper) + end + +end diff --git a/vendor/plugins/file_column b/vendor/plugins/file_column new file mode 160000 index 0000000..fbac0a6 --- /dev/null +++ b/vendor/plugins/file_column @@ -0,0 +1 @@ +Subproject commit fbac0a6d979161eb2597801a6fc8e213bb4e039a
farra/radiant-members-extension
65f96455a7ea21b3a378a6fdb641056d9c67a687
initial import
diff --git a/README b/README new file mode 100644 index 0000000..b906643 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ += Members + +Enhances the Radiant users model for use as a site-wide members +feature. To install: + +- rake db:migrate:extensions \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..0a9b3dd --- /dev/null +++ b/Rakefile @@ -0,0 +1,120 @@ +# I think this is the one that should be moved to the extension Rakefile template + +# In rails 1.2, plugins aren't available in the path until they're loaded. +# Check to see if the rspec plugin is installed first and require +# it if it is. If not, use the gem version. + +# Determine where the RSpec plugin is by loading the boot +unless defined? RADIANT_ROOT + ENV["RAILS_ENV"] = "test" + case + when ENV["RADIANT_ENV_FILE"] + require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot" + when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} + require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot" + else + require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot" + end +end + +require 'rake' +require 'rake/rdoctask' +require 'rake/testtask' + +rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib') +$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) +require 'spec/rake/spectask' +# require 'spec/translator' + +# Cleanup the RADIANT_ROOT constant so specs will load the environment +Object.send(:remove_const, :RADIANT_ROOT) + +extension_root = File.expand_path(File.dirname(__FILE__)) + +task :default => :spec +task :stats => "spec:statsetup" + +desc "Run all specs in spec directory" +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] + t.spec_files = FileList['spec/**/*_spec.rb'] +end + +namespace :spec do + desc "Run all specs in spec directory with RCov" + Spec::Rake::SpecTask.new(:rcov) do |t| + t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] + t.spec_files = FileList['spec/**/*_spec.rb'] + t.rcov = true + t.rcov_opts = ['--exclude', 'spec', '--rails'] + end + + desc "Print Specdoc for all specs" + Spec::Rake::SpecTask.new(:doc) do |t| + t.spec_opts = ["--format", "specdoc", "--dry-run"] + t.spec_files = FileList['spec/**/*_spec.rb'] + end + + [:models, :controllers, :views, :helpers].each do |sub| + desc "Run the specs under spec/#{sub}" + Spec::Rake::SpecTask.new(sub) do |t| + t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] + t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] + end + end + + # Hopefully no one has written their extensions in pre-0.9 style + # desc "Translate specs from pre-0.9 to 0.9 style" + # task :translate do + # translator = ::Spec::Translator.new + # dir = RAILS_ROOT + '/spec' + # translator.translate(dir, dir) + # end + + # Setup specs for stats + task :statsetup do + require 'code_statistics' + ::STATS_DIRECTORIES << %w(Model\ specs spec/models) + ::STATS_DIRECTORIES << %w(View\ specs spec/views) + ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) + ::STATS_DIRECTORIES << %w(Helper\ specs spec/views) + ::CodeStatistics::TEST_TYPES << "Model specs" + ::CodeStatistics::TEST_TYPES << "View specs" + ::CodeStatistics::TEST_TYPES << "Controller specs" + ::CodeStatistics::TEST_TYPES << "Helper specs" + ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/} + end + + namespace :db do + namespace :fixtures do + desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y" + task :load => :environment do + require 'active_record/fixtures' + ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| + Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*')) + end + end + end + end +end + +desc 'Generate documentation for the members extension.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'MembersExtension' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +# For extensions that are in transition +desc 'Test the members extension.' +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +# Load any custom rakefiles for extension +Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f } \ No newline at end of file diff --git a/app/controllers/admin/members/profile_controller.rb b/app/controllers/admin/members/profile_controller.rb new file mode 100644 index 0000000..c15cbfd --- /dev/null +++ b/app/controllers/admin/members/profile_controller.rb @@ -0,0 +1,30 @@ +class Admin::Members::ProfileController < ApplicationController + + def index + @current_user = current_user + snippet = Snippet.find_by_name 'profile_sidebar' + if snippet + #TODO a bit a hack here to render the snippet in the context + # of the first page. Is there a better way to render a snippet like this? + p = Page.find(:all).first + @sidebar_text = p.render_snippet snippet + end + end + + def edit + if params[:user][:password] != nil && params[:user][:password].size > 0 + current_user.update_attributes(params[:user]) + end + if params[:person][:id].size > 0 + person = Person.find(params[:person][:id]) + person.update_attributes(params[:person]) + else + person = Person.new(params[:person]) + person.user = current_user + current_user.person = person + end + person.save! + redirect_to :action => 'index' + end + +end diff --git a/app/helpers/admin/members/profile_helper.rb b/app/helpers/admin/members/profile_helper.rb new file mode 100644 index 0000000..c2cd92a --- /dev/null +++ b/app/helpers/admin/members/profile_helper.rb @@ -0,0 +1,2 @@ +module Admin::Members::ProfileHelper +end diff --git a/db/migrate/001_modify_users.rb b/db/migrate/001_modify_users.rb new file mode 100644 index 0000000..fead4f2 --- /dev/null +++ b/db/migrate/001_modify_users.rb @@ -0,0 +1,13 @@ +class ModifyUsers < ActiveRecord::Migration + + def self.up + add_column :users, :photo, :string + add_column :users, :url, :string + end + + def self.down + remove_column :users, :photo + remove_column :users, :url + end + +end diff --git a/db/migrate/002_create_profile_snippet.rb b/db/migrate/002_create_profile_snippet.rb new file mode 100644 index 0000000..54edccc --- /dev/null +++ b/db/migrate/002_create_profile_snippet.rb @@ -0,0 +1,15 @@ +class CreateProfileSnippet < ActiveRecord::Migration + + def self.up + snippet = Snippet.new + snippet.name = "profile_sidebar" + snippet.content = " " + snippet.save! + end + + def self.down + snippet = Snippet.find_by_name 'profile_sidebar' + snippet.delete + end + +end diff --git a/lib/tasks/members_extension_tasks.rake b/lib/tasks/members_extension_tasks.rake new file mode 100644 index 0000000..ed284a2 --- /dev/null +++ b/lib/tasks/members_extension_tasks.rake @@ -0,0 +1,28 @@ +namespace :radiant do + namespace :extensions do + namespace :members do + + desc "Runs the migration of the Members extension" + task :migrate => :environment do + require 'radiant/extension_migrator' + if ENV["VERSION"] + MembersExtension.migrator.migrate(ENV["VERSION"].to_i) + else + MembersExtension.migrator.migrate + end + end + + desc "Copies public assets of the Members to the instance public/ directory." + task :update => :environment do + is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) } + Dir[MembersExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file| + path = file.sub(MembersExtension.root, '') + directory = File.dirname(path) + puts "Copying #{path}..." + mkdir_p RAILS_ROOT + directory + cp file, RAILS_ROOT + path + end + end + end + end +end diff --git a/members_extension.rb b/members_extension.rb new file mode 100644 index 0000000..ba90a9f --- /dev/null +++ b/members_extension.rb @@ -0,0 +1,26 @@ +# Uncomment this if you reference any of your controllers in activate +# require_dependency 'application' + +class MembersExtension < Radiant::Extension + version "1.0" + description "Extends Radiant user model for site members" + url "http://cubiclemuses.com/cm" + + define_routes do |map| + map.connect 'admin/members/profile/:action', :controller => 'admin/members/profile' + end + + def activate + admin.tabs.add "Profile", "/admin/members/profile", :after => "Layouts", :visibility => [:all] + + User.class_eval { + file_column :photo, :magick => { :geometry => "80x80>" } + } + + end + + def deactivate + admin.tabs.remove "Profile" + end + +end diff --git a/spec/controllers/admin/members/profile_controller_spec.rb b/spec/controllers/admin/members/profile_controller_spec.rb new file mode 100644 index 0000000..fd01752 --- /dev/null +++ b/spec/controllers/admin/members/profile_controller_spec.rb @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Admin::Members::ProfileController do + + #Delete this example and add some real ones + it "should use Admin::Members::ProfileController" do + controller.should be_an_instance_of(Admin::Members::ProfileController) + end + +end diff --git a/spec/helpers/admin/members/profile_helper_spec.rb b/spec/helpers/admin/members/profile_helper_spec.rb new file mode 100644 index 0000000..6541a8f --- /dev/null +++ b/spec/helpers/admin/members/profile_helper_spec.rb @@ -0,0 +1,11 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Admin::Members::ProfileHelper do + + #Delete this example and add some real ones or delete this file + it "should include the Admin::Members::ProfileHelper" do + included_modules = self.metaclass.send :included_modules + included_modules.should include(Admin::Members::ProfileHelper) + end + +end diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..d8c8db5 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1,6 @@ +--colour +--format +progress +--loadby +mtime +--reverse diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..67b3694 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,37 @@ +unless defined? RADIANT_ROOT + ENV["RAILS_ENV"] = "test" + case + when ENV["RADIANT_ENV_FILE"] + require ENV["RADIANT_ENV_FILE"] + when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} + require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment" + else + require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment" + end +end +require "#{RADIANT_ROOT}/spec/spec_helper" + +if File.directory?(File.dirname(__FILE__) + "/scenarios") + Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios" +end +if File.directory?(File.dirname(__FILE__) + "/matchers") + Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file } +end + +Spec::Runner.configure do |config| + # config.use_transactional_fixtures = true + # config.use_instantiated_fixtures = false + # config.fixture_path = RAILS_ROOT + '/spec/fixtures' + + # You can declare fixtures for each behaviour like this: + # describe "...." do + # fixtures :table_a, :table_b + # + # Alternatively, if you prefer to declare them only once, you can + # do so here, like so ... + # + # config.global_fixtures = :table_a, :table_b + # + # If you declare global fixtures, be aware that they will be declared + # for all of your examples, even those that don't use them. +end \ No newline at end of file
bdainton/140box
b9cad5aa901c5fd7d8611291360c60b647778f50
fixing IE and windows layout issues.
diff --git a/index.html b/index.html index f126bab..055a7f9 100644 --- a/index.html +++ b/index.html @@ -1,88 +1,89 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>140box | for drafting a tweet</title> <style type="text/css" media="screen"> html,body { margin: 0; padding: 0; } body { background-color: #eee; font-family:'Georgia','Serif'; font-size: 1.2em; color: #333; } #page { width: 400px; margin: 0 auto; } h1 { text-align: left; margin: 0; padding: 0; opacity: 0.7;} a { color: #2277BB;} #count { color: #2277BB; margin: 0; padding: 0; font-size: 6em; line-height: .8em; float: left;} #count.negative { color: #800;} textarea { width: 100%; font-family:'Georgia','Serif'; font-size: 1.2em;;} .right { float: right;} .clear { clear: both;} .left { float: left;} .tagline { font-size: 0.5em; color: #778899; font-weight: normal; font-style: italic; display: block;} #box { padding: 20px 0px 0px 8px;} #footer { margin-top: 80px; text-align: center; font-size: 0.7em;} #save { float: right; margin: 8px; text-align: center; width: 60px;} #drafts ul { clear: both; margin: 40px 0px 0px 0px; padding: 0; text-align: left; list-style: none;} #drafts li { font-size: 0.8em; padding: 10px; border-bottom: 1px dashed #778899;} #drafts li a { color: #333; text-decoration: none;} #drafts li a:hover { text-decoration: underline;} + .draft_text { display: block; width: 350px;} </style> <link type="text/css" href="css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" /> </head> <body> <div id="page"> <div id="header"> <h1 id='count'>140</h1> <h1 id='box'> box<span class='tagline'>for drafting a tweet<span> </h1> <form action="" method=post> <textarea id="tweetbox" name="tweet" cols=60 rows=6></textarea> <input type='submit' id='save' value='ok'> </form> </div> <div id='drafts'> <ul id='sorted_drafts'> </ul> </div> <div id="footer"> <p> a mini-app from<br><a href='http://twitter.com/bdainton'>@bdainton</a> and <a href='http://twitter.com/djohnsonjr'>@djohnsonjr</a> </p> <p><a href='http://www.140box.com/?txt=V2hlbiBjcmVhdGluZyBhbiBpbXBvcnRhbnQgdHdlZXQsIEkgYWx3YXlzIGZlYXIgYW4gYWNjaWRlbnRhbCBzZW5kLiBZb3UgY2FuJ3Qgc2VuZCBhIHR3ZWV0IHcvMTQwYm94LiBKdXN0IGNyZWF0ZSBhbmQgc2hhcmUgeW91ciBkcmFmdHMu'>What does this app do?</a></p> </div> </div> <script src="http://www.google.com/jsapi"></script> <script> // Load jQuery google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2"); </script> <script src="/javascripts/jQuery.url.js" type="text/javascript"></script> <script src="/javascripts/jquery.base64.js" type="text/javascript"></script> <script type="text/javascript" src="javascripts/counter.js"></script> </body> </html> diff --git a/javascripts/counter.js b/javascripts/counter.js index d6467e0..4efbaff 100644 --- a/javascripts/counter.js +++ b/javascripts/counter.js @@ -1,55 +1,55 @@ $(document).ready( function() { $('#tweetbox').keyup(function(){ update_character_count($(this)); }); var value = $.url.param("txt"); if ((value) && (value != "")) { $('#tweetbox:input').val($.base64Decode(value)); } update_character_count($('#tweetbox')); $('#save').click(function() { var count = $('#count').text(); var tweet = $('#tweetbox').val(); - $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a><span id=\"remove_tweet\" class=\"right ui-icon ui-icon-close\" title=\"Remove Tweet\"></span><a href=\""+ gen_url($('#tweetbox:input').val()) +"\" target=\"_blank\"><span id=\"perma_link\" class=\"right ui-icon ui-icon-extlink\" title=\"Permalink to this Tweet\"></span></a></li>"); + $('#drafts ul').prepend("<li><span id=\"remove_tweet\" class=\"right ui-icon ui-icon-close\" title=\"Remove Tweet\"></span><a href=\""+ gen_url($('#tweetbox:input').val()) +"\" target=\"_blank\"><span id=\"perma_link\" class=\"right ui-icon ui-icon-extlink\" title=\"Permalink to this Tweet\"></span></a><a class=\"draft_text\" href='#'>" + tweet + "</a></li>"); return false; }); $('li a').live('click', function() { $('#tweetbox').val($(this).text()); update_character_count($('#tweetbox')); return false; }); $('#perma_link').live('click', function() { window.open($(this).parent().attr('href')); return false; }); $('#remove_tweet').live('click', function() { drop_tweet($(this)); return false; }); $("#sorted_drafts").sortable(); }); function gen_url(input) { var text = $.base64Encode(input); var link = "/?txt="+text return link; } function update_character_count(clicked) { var length = clicked.val().length; var count = 140 - length; if (count < 0) { $('#count').addClass('negative'); } else { $('#count').removeClass('negative'); } $('#count').html(count); } function drop_tweet(clicked) { var dad = clicked.parent(); dad.remove(); }
bdainton/140box
cd8b9fffeee02852ae0fa9825342bf380ffd23e2
Fixing IE functionality issues.
diff --git a/javascripts/counter.js b/javascripts/counter.js index b766935..d6467e0 100644 --- a/javascripts/counter.js +++ b/javascripts/counter.js @@ -1,55 +1,55 @@ $(document).ready( function() { $('#tweetbox').keyup(function(){ update_character_count($(this)); }); var value = $.url.param("txt"); if ((value) && (value != "")) { $('#tweetbox:input').val($.base64Decode(value)); } update_character_count($('#tweetbox')); $('#save').click(function() { - count = $('#count').text(); - tweet = $('#tweetbox').val(); + var count = $('#count').text(); + var tweet = $('#tweetbox').val(); $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a><span id=\"remove_tweet\" class=\"right ui-icon ui-icon-close\" title=\"Remove Tweet\"></span><a href=\""+ gen_url($('#tweetbox:input').val()) +"\" target=\"_blank\"><span id=\"perma_link\" class=\"right ui-icon ui-icon-extlink\" title=\"Permalink to this Tweet\"></span></a></li>"); return false; }); $('li a').live('click', function() { $('#tweetbox').val($(this).text()); update_character_count($('#tweetbox')); return false; }); $('#perma_link').live('click', function() { - window.open(this.parent().href); + window.open($(this).parent().attr('href')); return false; }); $('#remove_tweet').live('click', function() { drop_tweet($(this)); return false; }); $("#sorted_drafts").sortable(); }); function gen_url(input) { var text = $.base64Encode(input); var link = "/?txt="+text return link; } function update_character_count(clicked) { var length = clicked.val().length; var count = 140 - length; if (count < 0) { $('#count').addClass('negative'); } else { $('#count').removeClass('negative'); } $('#count').html(count); } function drop_tweet(clicked) { var dad = clicked.parent(); dad.remove(); }
bdainton/140box
685363711259672ccade823cf5fcf66a1ba1cab7
Included a 'what does this app do?' link at the bottom.
diff --git a/index.html b/index.html index c9c1929..f126bab 100644 --- a/index.html +++ b/index.html @@ -1,87 +1,88 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>140box | for drafting a tweet</title> <style type="text/css" media="screen"> html,body { margin: 0; padding: 0; } body { background-color: #eee; font-family:'Georgia','Serif'; font-size: 1.2em; color: #333; } #page { width: 400px; margin: 0 auto; } h1 { text-align: left; margin: 0; padding: 0; opacity: 0.7;} a { color: #2277BB;} #count { color: #2277BB; margin: 0; padding: 0; font-size: 6em; line-height: .8em; float: left;} #count.negative { color: #800;} textarea { width: 100%; font-family:'Georgia','Serif'; font-size: 1.2em;;} .right { float: right;} .clear { clear: both;} .left { float: left;} .tagline { font-size: 0.5em; color: #778899; font-weight: normal; font-style: italic; display: block;} #box { padding: 20px 0px 0px 8px;} #footer { margin-top: 80px; text-align: center; font-size: 0.7em;} #save { float: right; margin: 8px; text-align: center; width: 60px;} #drafts ul { clear: both; margin: 40px 0px 0px 0px; padding: 0; text-align: left; list-style: none;} #drafts li { font-size: 0.8em; padding: 10px; border-bottom: 1px dashed #778899;} #drafts li a { color: #333; text-decoration: none;} #drafts li a:hover { text-decoration: underline;} </style> <link type="text/css" href="css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" /> </head> <body> <div id="page"> <div id="header"> <h1 id='count'>140</h1> <h1 id='box'> box<span class='tagline'>for drafting a tweet<span> </h1> <form action="" method=post> <textarea id="tweetbox" name="tweet" cols=60 rows=6></textarea> <input type='submit' id='save' value='ok'> </form> </div> <div id='drafts'> <ul id='sorted_drafts'> </ul> </div> <div id="footer"> <p> a mini-app from<br><a href='http://twitter.com/bdainton'>@bdainton</a> and <a href='http://twitter.com/djohnsonjr'>@djohnsonjr</a> </p> + <p><a href='http://www.140box.com/?txt=V2hlbiBjcmVhdGluZyBhbiBpbXBvcnRhbnQgdHdlZXQsIEkgYWx3YXlzIGZlYXIgYW4gYWNjaWRlbnRhbCBzZW5kLiBZb3UgY2FuJ3Qgc2VuZCBhIHR3ZWV0IHcvMTQwYm94LiBKdXN0IGNyZWF0ZSBhbmQgc2hhcmUgeW91ciBkcmFmdHMu'>What does this app do?</a></p> </div> </div> <script src="http://www.google.com/jsapi"></script> <script> // Load jQuery google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2"); </script> <script src="/javascripts/jQuery.url.js" type="text/javascript"></script> <script src="/javascripts/jquery.base64.js" type="text/javascript"></script> <script type="text/javascript" src="javascripts/counter.js"></script> </body> </html>
bdainton/140box
821b2c0bf4de8720c1e1f00e3a2e144831a8a28c
Fixing IE countdown issue.
diff --git a/javascripts/counter.js b/javascripts/counter.js index e5d451d..b766935 100644 --- a/javascripts/counter.js +++ b/javascripts/counter.js @@ -1,55 +1,55 @@ $(document).ready( function() { $('#tweetbox').keyup(function(){ update_character_count($(this)); }); var value = $.url.param("txt"); if ((value) && (value != "")) { $('#tweetbox:input').val($.base64Decode(value)); } update_character_count($('#tweetbox')); $('#save').click(function() { count = $('#count').text(); tweet = $('#tweetbox').val(); $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a><span id=\"remove_tweet\" class=\"right ui-icon ui-icon-close\" title=\"Remove Tweet\"></span><a href=\""+ gen_url($('#tweetbox:input').val()) +"\" target=\"_blank\"><span id=\"perma_link\" class=\"right ui-icon ui-icon-extlink\" title=\"Permalink to this Tweet\"></span></a></li>"); return false; }); $('li a').live('click', function() { $('#tweetbox').val($(this).text()); update_character_count($('#tweetbox')); return false; }); $('#perma_link').live('click', function() { window.open(this.parent().href); return false; }); $('#remove_tweet').live('click', function() { drop_tweet($(this)); return false; }); $("#sorted_drafts").sortable(); }); function gen_url(input) { var text = $.base64Encode(input); var link = "/?txt="+text return link; } function update_character_count(clicked) { var length = clicked.val().length; - count = 140 - length; + var count = 140 - length; if (count < 0) { $('#count').addClass('negative'); } else { $('#count').removeClass('negative'); } $('#count').html(count); } function drop_tweet(clicked) { var dad = clicked.parent(); dad.remove(); }
bdainton/140box
a311d989da6d2406f774e1ce83fe077971a694c0
My First Checkin, awwwwwe....
diff --git a/app.yaml b/app.yaml index 25bac0c..87d4560 100644 --- a/app.yaml +++ b/app.yaml @@ -1,12 +1,14 @@ application: 140box version: 1 runtime: python api_version: 1 handlers: - url: /javascripts static_dir: javascripts +- url: /css + static_dir: css - url: / static_files: index.html upload: index.html \ No newline at end of file diff --git a/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png b/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100755 index 0000000..5b5dab2 Binary files /dev/null and b/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png b/css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100755 index 0000000..ac8b229 Binary files /dev/null and b/css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png b/css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100755 index 0000000..ad3d634 Binary files /dev/null and b/css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png b/css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100755 index 0000000..42ccba2 Binary files /dev/null and b/css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png b/css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png new file mode 100755 index 0000000..5a46b47 Binary files /dev/null and b/css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png b/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100755 index 0000000..86c2baa Binary files /dev/null and b/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100755 index 0000000..7c9fa6c Binary files /dev/null and b/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png b/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png new file mode 100755 index 0000000..0e05810 Binary files /dev/null and b/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png differ diff --git a/css/custom-theme/images/ui-icons_2277BB_256x240.png b/css/custom-theme/images/ui-icons_2277BB_256x240.png new file mode 100755 index 0000000..9b8a8ff Binary files /dev/null and b/css/custom-theme/images/ui-icons_2277BB_256x240.png differ diff --git a/css/custom-theme/images/ui-icons_7a7a7a_256x240.png b/css/custom-theme/images/ui-icons_7a7a7a_256x240.png new file mode 100755 index 0000000..dde8a3b Binary files /dev/null and b/css/custom-theme/images/ui-icons_7a7a7a_256x240.png differ diff --git a/css/custom-theme/images/ui-icons_cd0a0a_256x240.png b/css/custom-theme/images/ui-icons_cd0a0a_256x240.png new file mode 100755 index 0000000..7930a55 Binary files /dev/null and b/css/custom-theme/images/ui-icons_cd0a0a_256x240.png differ diff --git a/css/custom-theme/jquery-ui-1.7.2.custom.css b/css/custom-theme/jquery-ui-1.7.2.custom.css new file mode 100755 index 0000000..ab71a70 --- /dev/null +++ b/css/custom-theme/jquery-ui-1.7.2.custom.css @@ -0,0 +1,406 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + + +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=2277BB&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=7a7a7a&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=7a7a7a&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=2277BB&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=2277BB&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2277BB&bgColorError=fef1ec&bgTextureError=05_inset_soft.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; outline: none; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; outline: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_7a7a7a_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_7a7a7a_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_2277BB_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_7a7a7a_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_2277BB_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_2277BB_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2277BB_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; } +.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; } +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* Dialog +----------------------------------*/ +.ui-dialog { position: relative; padding: .2em; width: 300px; } +.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs +----------------------------------*/ +.ui-tabs { padding: .2em; zoom: 1; } +.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; } +.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } diff --git a/index.html b/index.html index 27c9fe8..c9c1929 100644 --- a/index.html +++ b/index.html @@ -1,81 +1,87 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>140box | for drafting a tweet</title> <style type="text/css" media="screen"> html,body { margin: 0; padding: 0; } body { background-color: #eee; font-family:'Georgia','Serif'; font-size: 1.2em; color: #333; } #page { width: 400px; margin: 0 auto; } h1 { text-align: left; margin: 0; padding: 0; opacity: 0.7;} a { color: #2277BB;} #count { color: #2277BB; margin: 0; padding: 0; font-size: 6em; line-height: .8em; float: left;} #count.negative { color: #800;} textarea { width: 100%; font-family:'Georgia','Serif'; font-size: 1.2em;;} + .right { float: right;} + .clear { clear: both;} + .left { float: left;} .tagline { font-size: 0.5em; color: #778899; font-weight: normal; font-style: italic; display: block;} #box { padding: 20px 0px 0px 8px;} #footer { margin-top: 80px; text-align: center; font-size: 0.7em;} #save { float: right; margin: 8px; text-align: center; width: 60px;} #drafts ul { clear: both; margin: 40px 0px 0px 0px; padding: 0; text-align: left; list-style: none;} #drafts li { font-size: 0.8em; padding: 10px; border-bottom: 1px dashed #778899;} #drafts li a { color: #333; text-decoration: none;} #drafts li a:hover { text-decoration: underline;} </style> + <link type="text/css" href="css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" /> </head> <body> <div id="page"> <div id="header"> <h1 id='count'>140</h1> <h1 id='box'> box<span class='tagline'>for drafting a tweet<span> </h1> <form action="" method=post> <textarea id="tweetbox" name="tweet" cols=60 rows=6></textarea> <input type='submit' id='save' value='ok'> </form> </div> <div id='drafts'> - <ul> + <ul id='sorted_drafts'> </ul> </div> <div id="footer"> <p> a mini-app from<br><a href='http://twitter.com/bdainton'>@bdainton</a> and <a href='http://twitter.com/djohnsonjr'>@djohnsonjr</a> </p> </div> </div> <script src="http://www.google.com/jsapi"></script> <script> // Load jQuery google.load("jquery", "1.3.2"); google.load("jqueryui", "1.7.2"); </script> + <script src="/javascripts/jQuery.url.js" type="text/javascript"></script> + <script src="/javascripts/jquery.base64.js" type="text/javascript"></script> <script type="text/javascript" src="javascripts/counter.js"></script> </body> </html> diff --git a/javascripts/counter.js b/javascripts/counter.js index ccf1a9b..e5d451d 100644 --- a/javascripts/counter.js +++ b/javascripts/counter.js @@ -1,29 +1,55 @@ - $(document).ready( function() { $('#tweetbox').keyup(function(){ update_character_count($(this)); }); + var value = $.url.param("txt"); + if ((value) && (value != "")) { + $('#tweetbox:input').val($.base64Decode(value)); + } update_character_count($('#tweetbox')); $('#save').click(function() { count = $('#count').text(); tweet = $('#tweetbox').val(); - $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a></li>"); + $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a><span id=\"remove_tweet\" class=\"right ui-icon ui-icon-close\" title=\"Remove Tweet\"></span><a href=\""+ gen_url($('#tweetbox:input').val()) +"\" target=\"_blank\"><span id=\"perma_link\" class=\"right ui-icon ui-icon-extlink\" title=\"Permalink to this Tweet\"></span></a></li>"); return false; }); $('li a').live('click', function() { $('#tweetbox').val($(this).text()); update_character_count($('#tweetbox')); return false; }); + + $('#perma_link').live('click', function() { + window.open(this.parent().href); + return false; + }); + + $('#remove_tweet').live('click', function() { + drop_tweet($(this)); + return false; + }); + + $("#sorted_drafts").sortable(); }); +function gen_url(input) { + var text = $.base64Encode(input); + var link = "/?txt="+text + return link; +} + function update_character_count(clicked) { var length = clicked.val().length; count = 140 - length; if (count < 0) { $('#count').addClass('negative'); } else { $('#count').removeClass('negative'); } $('#count').html(count); -} \ No newline at end of file +} + +function drop_tweet(clicked) { + var dad = clicked.parent(); + dad.remove(); +} diff --git a/javascripts/jQuery.url.js b/javascripts/jQuery.url.js new file mode 100644 index 0000000..beb7cbe --- /dev/null +++ b/javascripts/jQuery.url.js @@ -0,0 +1,215 @@ +/* =========================================================================== + * + * JQuery URL Parser + * Version 1.0 + * Parses URLs and provides easy access to information within them. + * + * Author: Mark Perkins + * Author email: [email protected] + * + * For full documentation and more go to http://projects.allmarkedup.com/jquery_url_parser/ + * + * --------------------------------------------------------------------------- + * + * CREDITS: + * + * Parser based on the Regex-based URI parser by Steven Levithan. + * For more information (including a detailed explaination of the differences + * between the 'loose' and 'strict' pasing modes) visit http://blog.stevenlevithan.com/archives/parseuri + * + * --------------------------------------------------------------------------- + * + * LICENCE: + * + * Released under a MIT Licence. See licence.txt that should have been supplied with this file, + * or visit http://projects.allmarkedup.com/jquery_url_parser/licence.txt + * + * --------------------------------------------------------------------------- + * + * EXAMPLES OF USE: + * + * Get the domain name (host) from the current page URL + * jQuery.url.attr("host") + * + * Get the query string value for 'item' for the current page + * jQuery.url.param("item") // null if it doesn't exist + * + * Get the second segment of the URI of the current page + * jQuery.url.segment(2) // null if it doesn't exist + * + * Get the protocol of a manually passed in URL + * jQuery.url.setUrl("http://allmarkedup.com/").attr("protocol") // returns 'http' + * + */ + +jQuery.url = function() +{ + var segments = {}; + + var parsed = {}; + + /** + * Options object. Only the URI and strictMode values can be changed via the setters below. + */ + var options = { + + url : window.location, // default URI is the page in which the script is running + + strictMode: false, // 'loose' parsing by default + + key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query + + q: { + name: "queryKey", + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + } + + }; + + /** + * Deals with the parsing of the URI according to the regex above. + * Written by Steven Levithan - see credits at top. + */ + var parseUri = function() + { + str = decodeURI( options.url ); + + var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); + var uri = {}; + var i = 14; + + while ( i-- ) { + uri[ options.key[i] ] = m[i] || ""; + } + + uri[ options.q.name ] = {}; + uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { + if ($1) { + uri[options.q.name][$1] = $2; + } + }); + + return uri; + }; + + /** + * Returns the value of the passed in key from the parsed URI. + * + * @param string key The key whose value is required + */ + var key = function( key ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( key == "base" ) + { + if ( parsed.port !== null && parsed.port !== "" ) + { + return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; + } + else + { + return parsed.protocol+"://"+parsed.host+"/"; + } + } + + return ( parsed[key] === "" ) ? null : parsed[key]; + }; + + /** + * Returns the value of the required query string parameter. + * + * @param string item The parameter whose value is required + */ + var param = function( item ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; + }; + + /** + * 'Constructor' (not really!) function. + * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. + */ + var setUp = function() + { + parsed = parseUri(); + + getSegments(); + }; + + /** + * Splits up the body of the URI into segments (i.e. sections delimited by '/') + */ + var getSegments = function() + { + var p = parsed.path; + segments = []; // clear out segments array + segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); + }; + + return { + + /** + * Sets the parsing mode - either strict or loose. Set to loose by default. + * + * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! + */ + setMode : function( mode ) + { + strictMode = mode == "strict" ? true : false; + return this; + }, + + /** + * Sets URI to parse if you don't want to to parse the current page's URI. + * Calling the function with no value for newUri resets it to the current page's URI. + * + * @param string newUri The URI to parse. + */ + setUrl : function( newUri ) + { + options.url = newUri === undefined ? window.location : newUri; + setUp(); + return this; + }, + + /** + * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. + * For example the URI http://test.com/about/company/ segment(1) would return 'about'. + * + * If no integer is passed into the function it returns the number of segments in the URI. + * + * @param int pos The position of the segment to return. Can be empty. + */ + segment : function( pos ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( pos === undefined ) + { + return segments.length; + } + return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; + }, + + attr : key, // provides public access to private 'key' function - see above + + param : param // provides public access to private 'param' function - see above + + }; + +}(); + diff --git a/javascripts/jquery.base64.js b/javascripts/jquery.base64.js new file mode 100644 index 0000000..3fd7856 --- /dev/null +++ b/javascripts/jquery.base64.js @@ -0,0 +1,143 @@ + + /** + * jQuery BASE64 functions + * + * <code> + * Encodes the given data with base64. + * String $.base64Encode ( String str ) + * <br /> + * Decodes a base64 encoded data. + * String $.base64Decode ( String str ) + * </code> + * + * Encodes and Decodes the given data in base64. + * This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies. + * Base64-encoded data takes about 33% more space than the original data. + * This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism. + * If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag). + * This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin. + * + * Example + * Code + * <code> + * $.base64Encode("I'm Persian."); + * </code> + * Result + * <code> + * "SSdtIFBlcnNpYW4u" + * </code> + * Code + * <code> + * $.base64Decode("SSdtIFBlcnNpYW4u"); + * </code> + * Result + * <code> + * "I'm Persian." + * </code> + * + * @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com > + * @link http://www.semnanweb.com/jquery-plugin/base64.html + * @see http://www.webtoolkit.info/ + * @license http://www.gnu.org/licenses/gpl.html [GNU General Public License] + * @param {jQuery} {base64Encode:function(inputz)) + * @param {jQuery} {base64Decode:function(inputz)) + * @return string + */ + + (function($){ + + var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + var uTF8Encode = function(string) { + string = string.replace(/\x0d\x0a/g, "\x0a"); + var output = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + if (c < 128) { + output += String.fromCharCode(c); + } else if ((c > 127) && (c < 2048)) { + output += String.fromCharCode((c >> 6) | 192); + output += String.fromCharCode((c & 63) | 128); + } else { + output += String.fromCharCode((c >> 12) | 224); + output += String.fromCharCode(((c >> 6) & 63) | 128); + output += String.fromCharCode((c & 63) | 128); + } + } + return output; + }; + + var uTF8Decode = function(inputz) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + while ( i < inputz.length ) { + c = inputz.charCodeAt(i); + if (c < 128) { + string += String.fromCharCode(c); + i++; + } else if ((c > 191) && (c < 224)) { + c2 = inputz.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } else { + c2 = inputz.charCodeAt(i+1); + c3 = inputz.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + } + return string; + } + + $.extend({ + base64Encode: function(inputz) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + inputz = uTF8Encode(inputz); + while (i < inputz.length) { + chr1 = inputz.charCodeAt(i++); + chr2 = inputz.charCodeAt(i++); + chr3 = inputz.charCodeAt(i++); + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4); + } + return output; + }, + base64Decode: function(inputz) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + inputz = inputz.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + while (i < inputz.length) { + enc1 = keyString.indexOf(inputz.charAt(i++)); + enc2 = keyString.indexOf(inputz.charAt(i++)); + enc3 = keyString.indexOf(inputz.charAt(i++)); + enc4 = keyString.indexOf(inputz.charAt(i++)); + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + } + output = uTF8Decode(output); + return output; + } + }); + })(jQuery); +
scriptbots/cooliris
04996d1e3c266159f6cbd1149b52392f48a82efd
cooliris 1.9.1 import
diff --git a/META-INF/manifest.mf b/META-INF/manifest.mf new file mode 100644 index 0000000..54d650d --- /dev/null +++ b/META-INF/manifest.mf @@ -0,0 +1,179 @@ +Manifest-Version: 1.0 +Created-by: XPISigner +XPI-Signer-Version: 1.4 (free) http://o-regan.org +Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT. + +Name: chrome/content/ab.cooliris.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: Jsaxgpqd72H/bwVU3to/Hg== +SHA1-Digest: v9yXIsbPAGFuhXqNu3NA5mh/aC0= + +Name: chrome/content/cooliris-32.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 8z5767g3WIcQ+a/fKPb3FA== +SHA1-Digest: xeHkSQGEILvQceKK2cWvOmvRrlM= + +Name: chrome/content/cooliris.css +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 8JwF1PhsavbaoFfIzgSsaA== +SHA1-Digest: qVsnyspHOhjlk3DSxOo+KwIPj0M= + +Name: chrome/content/cooliris.ico +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 4SpazxBZJSJeK0c6RQ/oTA== +SHA1-Digest: 3aVWiW/TXHyG5ezn+/ydJLaQXNo= + +Name: chrome/content/cooliris.js +Digest-Algorithms: MD5 SHA1 +MD5-Digest: UBvpmo7BhVVlab4Uf76iMg== +SHA1-Digest: /PS7oKLpPg/XYRH2eV7vQbxg4Ys= + +Name: chrome/content/cooliris.xul +Digest-Algorithms: MD5 SHA1 +MD5-Digest: CpL8kFV4C6mzhJx54FhDUw== +SHA1-Digest: ZsxZMP1rO/QXizX516SIDyYlt8A= + +Name: chrome/content/launch.down.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: LnbRyA+gjOVHY3FaJqKE+g== +SHA1-Digest: 0iutD3ykY7DWC/XouSc9ABgFJWw= + +Name: chrome/content/launch.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: ez5rCkWGkWObrDF5F9drRA== +SHA1-Digest: cECkrzi2nFLlqetXzlfPVRRc1Wc= + +Name: chrome/content/return-hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 3JrH0FCgE/eHRoCdKdoj4w== +SHA1-Digest: HyBtsNLHXgTRpZNlpOd9Z2Gp+zE= + +Name: chrome/content/return-normal.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: tBfHCWDO2b0Sbu6tKLT1fg== +SHA1-Digest: dNtwqW8kfdCWhkPfwA7+kQo5ThY= + +Name: chrome/content/toolbar.launch.active.click.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 88q8TyRDJvM+IhxoriJyKA== +SHA1-Digest: ezLyx1IxZX6uZZIKzsFUa6ZHq90= + +Name: chrome/content/toolbar.launch.active.hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: F7twBRtvj9RbFy0PpFzIsA== +SHA1-Digest: b//brTbkHwI02VObLudcZEnMGmw= + +Name: chrome/content/toolbar.launch.active.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: +Ar0oy0bRDcZTdPfjU07Ow== +SHA1-Digest: pJsb3BTSdEDs6zPyDiYsPVJ11r8= + +Name: chrome/content/toolbar.launch.normal.click.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: YfGed0ONBC6B8OnJ5l/xuA== +SHA1-Digest: +FORuZFzSISsoP+T66aKG06OJzU= + +Name: chrome/content/toolbar.launch.normal.hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: UD69lDUlbzc2F7v7JsQE8Q== +SHA1-Digest: 0xzx8zArqhVrCEok94AcgqBoi+M= + +Name: chrome/content/toolbar.launch.normal.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: XbJWqXnE0QkRrW2z2wlJtw== +SHA1-Digest: aP/oyxpDmet9AfD/M+qIpx/pSfo= + +Name: chrome/content/tutorial.filter.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: igfL3MVjqzuoXr8G/rtffg== +SHA1-Digest: UkhaRPh6ifvZyMbUNboPTsPPZdA= + +Name: chrome/content/tutorial.scroll.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 3ra/3Kwjn2cM2pklx3y90A== +SHA1-Digest: Zve3Rw7SBiYXE1XY16AB7mml98k= + +Name: chrome/content/tutorial.search.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: xFFFOyr5xF9nC0SP48nDrQ== +SHA1-Digest: 4YmQwcXsnfmvdPHAkjTGqSwO+wg= + +Name: chrome/content/tutorial.searchshop.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: BzYZjYRtHvMs55wVGnjeSw== +SHA1-Digest: kg4al4zgqHGSRbIXythdZIz2MQM= + +Name: chrome/content/tutorial.shopping.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: waxg+mnn1lgaDXmr/4IiKw== +SHA1-Digest: jGs0ThLd+FhVW++wEXB0Vo1rgJE= + +Name: chrome/content/uiparts.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: yyalOoD+0M3kL7Z6kN1tEg== +SHA1-Digest: jWIMcCTD3X66/6yFOupnCOOaISU= + +Name: chrome.manifest +Digest-Algorithms: MD5 SHA1 +MD5-Digest: p5uzD3I96blVYXe7ay12eQ== +SHA1-Digest: ib/7cg7xTfb4UPgKqFvX4mNEVj4= + +Name: components/cooliris.xpt +Digest-Algorithms: MD5 SHA1 +MD5-Digest: IaOHEK3TlQxxuZ/iFipGrw== +SHA1-Digest: B182tJcznXM+1AIfYULCxQnkJZc= + +Name: components/coolirisstub.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: fH/See0NUK4T7z3ZX9oqvA== +SHA1-Digest: z5D0m8hz/68pvFDb86jeHV2PLaI= + +Name: components/piclensjshelper.js +Digest-Algorithms: MD5 SHA1 +MD5-Digest: BVaEGJu5DYN2SKrCar39Tg== +SHA1-Digest: tNLXZNpaoOTKgbU98ezSrYx5q94= + +Name: install.rdf +Digest-Algorithms: MD5 SHA1 +MD5-Digest: iDMG7PHBA2kRlTPClAgKAw== +SHA1-Digest: 88jb8EdECr3b/kPBqGU0OMgbwd4= + +Name: libs/avcodec-51.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: xM+ZUgmlX9xkMsKpwFTeSQ== +SHA1-Digest: noQK3CapzdeB8Q/6sqI72PlqbaI= + +Name: libs/avformat-52.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 6kVBQIad0Y1ozvAXDDeHFQ== +SHA1-Digest: lZZ6QdHsbfHzSWMGM2FEPDhFCqQ= + +Name: libs/avutil-49.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: KBx4Du6nygYExwjdaJO6Bw== +SHA1-Digest: fLqUcbN48d5EULviaj1+c0IZsFA= + +Name: libs/cooliris19.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: iV6zlPIIURbKedLYgleQbw== +SHA1-Digest: adJNNLslhmxfS5p10c0W7tQXq80= + +Name: libs/freetype.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: NuvMbAP710hxArmeBezP4g== +SHA1-Digest: r7jf3c7NdUyf9uDcZRXM5QttXPE= + +Name: libs/LaunchCooliris.exe +Digest-Algorithms: MD5 SHA1 +MD5-Digest: x/Hu9tDs4xht1l772q4HzQ== +SHA1-Digest: edIx8CbWuBqFsijICj/xby3v7S8= + +Name: libs/PicLensHelper.exe +Digest-Algorithms: MD5 SHA1 +MD5-Digest: opTMJABkAtsxS96W0kiWlg== +SHA1-Digest: lv/euYZwmQsE517MOUBaQ4H7j6k= + +Name: libs/pixomatic.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: uMfk7J4T/b3zwswm43vZug== +SHA1-Digest: mIQqTZKvN/x2+jHMNm+JZzFCB+0= diff --git a/META-INF/zigbert.rsa b/META-INF/zigbert.rsa new file mode 100644 index 0000000..b800212 Binary files /dev/null and b/META-INF/zigbert.rsa differ diff --git a/META-INF/zigbert.sf b/META-INF/zigbert.sf new file mode 100644 index 0000000..ca9ca08 --- /dev/null +++ b/META-INF/zigbert.sf @@ -0,0 +1,182 @@ +Signature-Version: 1.0 +Created-by: XPISigner +XPI-Signer-Version: 1.4 (free) http://o-regan.org +Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT. +Digest-Algorithms: MD5 SHA1 +MD5-Digest: XRyG5I+7yK7gUBcu+ruhUw== +SHA1-Digest: jCy5+JoYHOK2bTDMyVwpC3zlf00= + +Name: chrome/content/ab.cooliris.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: vkQdTwADIpMcl5s3ytHaDA== +SHA1-Digest: gz3aIQRvtQsIPClrmwiJpWYg7kI= + +Name: chrome/content/cooliris-32.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: R+UIKvPu4j+YZLlS9dtgCg== +SHA1-Digest: GIEDdw2zfCoWNkXsZqt4GcCKawE= + +Name: chrome/content/cooliris.css +Digest-Algorithms: MD5 SHA1 +MD5-Digest: FHtvqK17jEb/SnGNe9NkXw== +SHA1-Digest: E2WBs6rMz7rFLuW1pGnUbHJRrhk= + +Name: chrome/content/cooliris.ico +Digest-Algorithms: MD5 SHA1 +MD5-Digest: i5wrWOOsSCiWu0LwYj8FAQ== +SHA1-Digest: rnYz4znPvIbxiVAdEIiY2zEYpNg= + +Name: chrome/content/cooliris.js +Digest-Algorithms: MD5 SHA1 +MD5-Digest: q8FRqV/gdQjkdV3JEZTt0g== +SHA1-Digest: 0hk+25dyWH7qr6/6JYVnQx+7dd0= + +Name: chrome/content/cooliris.xul +Digest-Algorithms: MD5 SHA1 +MD5-Digest: UWZu0xnB1eMIipET5a6zQw== +SHA1-Digest: SaWHE+IeD9TafJEHC659lcr/OVE= + +Name: chrome/content/launch.down.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: qLz9xG6KHm53SUUw0yee8A== +SHA1-Digest: 9bdNHWTQQS1INlb++OugryIYJxA= + +Name: chrome/content/launch.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: WWNzNlQ7Gy8N93tQJPvnEw== +SHA1-Digest: kGufDdLytTiRMfLnEuuHX8hfJoA= + +Name: chrome/content/return-hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: NMtihbv7IiQ+xScytpBdRw== +SHA1-Digest: tfyg/PmYJiltB17EKdO+BmgvK0M= + +Name: chrome/content/return-normal.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: sawGRdcnWsIBiTGXqrn1iA== +SHA1-Digest: 7NH0uw51KzomvOJGBjU/z8mDaMI= + +Name: chrome/content/toolbar.launch.active.click.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: XZBrMlZ/ghDCXtpsD/74Vw== +SHA1-Digest: geJ0EZ883Kb6BnhLeXJ4pZmybbI= + +Name: chrome/content/toolbar.launch.active.hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 8rBwADtZggf63CWdQFb6pA== +SHA1-Digest: 1N4hU2pJnQyXnkszFkQ8+pwBoi8= + +Name: chrome/content/toolbar.launch.active.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: zC6276xTr/szP21Dm8V/Ww== +SHA1-Digest: t7Gx6x3etPmdwDiGEAlV1/pbZnE= + +Name: chrome/content/toolbar.launch.normal.click.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: Nrj+d8OtkqJKMv0DM0KY4w== +SHA1-Digest: 6lNAWVD02VjyIkDNNhJgO1/9m1s= + +Name: chrome/content/toolbar.launch.normal.hover.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: vZZ1MdgeVqBCfSpIVHXvYQ== +SHA1-Digest: xKqYNR+yAaSvUu+bPjWZ5QBHLKw= + +Name: chrome/content/toolbar.launch.normal.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: tG4ZuPH4UO+ACax8b/zBog== +SHA1-Digest: hP93AtqRCA81rMph9KhaumZpTJk= + +Name: chrome/content/tutorial.filter.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 9ImohMj9JRX3UBwXkQn45g== +SHA1-Digest: DPob4cgc7OoMXh+kHav0+/05H78= + +Name: chrome/content/tutorial.scroll.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 4IqFhCqxnwSBtONgmbEVAQ== +SHA1-Digest: Cj3eS0oj75MUiRVtwQJvM4Tk8g4= + +Name: chrome/content/tutorial.search.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 5ioEqQBs2W+oBcqxnfXZQA== +SHA1-Digest: mbcfjz+rmthXWqn5gbt2QTrWsaU= + +Name: chrome/content/tutorial.searchshop.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: w+Xh2706vlioamDpeUZHdA== +SHA1-Digest: erBkIPj9N9ICqpPZXpYK3uqRMWc= + +Name: chrome/content/tutorial.shopping.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: L6f/265WJEGEqP/8sK0FdQ== +SHA1-Digest: jkcp5QVztMrN5uBmGbzmpRbkR58= + +Name: chrome/content/uiparts.png +Digest-Algorithms: MD5 SHA1 +MD5-Digest: wRsLrSpfbvsIDOUT+XoC0A== +SHA1-Digest: Xj/q22wsczeaJXOHrjdAl9CP3tw= + +Name: chrome.manifest +Digest-Algorithms: MD5 SHA1 +MD5-Digest: l9AI0Xiy/YdWbtsbKCZzEA== +SHA1-Digest: K8BYof8CLZSz0ZHvVITJ82k3U64= + +Name: components/cooliris.xpt +Digest-Algorithms: MD5 SHA1 +MD5-Digest: UDzNlbmHkdCaqffVuMnfMQ== +SHA1-Digest: XiHJY2aDo8cMOGFhSUNV7i9VH4I= + +Name: components/coolirisstub.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: YFDs5L3ObEqFCWbzHNVbSQ== +SHA1-Digest: uNafxIPfUeOwVUB9fEIB6m9K8RQ= + +Name: components/piclensjshelper.js +Digest-Algorithms: MD5 SHA1 +MD5-Digest: WpTdS/TCu1kCct0U6K1d5g== +SHA1-Digest: qz4w7q4Aajpmc7x8dh+tsP8lm+s= + +Name: install.rdf +Digest-Algorithms: MD5 SHA1 +MD5-Digest: BfREG7l9OuEY5L41iRwg/A== +SHA1-Digest: Qb1f4BBvM68VjxYUYjYeicakz+Q= + +Name: libs/avcodec-51.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: pxgLSf3diN1ZkZKkOjMwtg== +SHA1-Digest: AslAMxPRWjf0OGMVhgFy2vQKbE8= + +Name: libs/avformat-52.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: G5qz5q7uWI44p1mDeJGpaA== +SHA1-Digest: BirvzbhqNhrHVpltZ0/TawNcrfc= + +Name: libs/avutil-49.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: zY1TmZTFinS43f5L/6ja6A== +SHA1-Digest: X4axc/7m+u6DkL+2Ql+75PPK6/I= + +Name: libs/cooliris19.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: V+ywlzeEHW2gbePfFFymbw== +SHA1-Digest: wth4bk9WdcR6KZPkdHQJ4sBB0hs= + +Name: libs/freetype.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: C4eusczI+CyrsD2V4FvyJg== +SHA1-Digest: Mz2kUGo2xYruLdKynb0VjjPfcI8= + +Name: libs/LaunchCooliris.exe +Digest-Algorithms: MD5 SHA1 +MD5-Digest: 5+PjLpljxR4fMjIel9lpsA== +SHA1-Digest: rrXx70FTUAnqEIdAYjy5EFGpFnY= + +Name: libs/PicLensHelper.exe +Digest-Algorithms: MD5 SHA1 +MD5-Digest: w+l23njV1swaXWKRmY4v/A== +SHA1-Digest: oRmOi9mpNqh9W8PIcJTsigDk2E4= + +Name: libs/pixomatic.dll +Digest-Algorithms: MD5 SHA1 +MD5-Digest: q2jgON0VhQS88GzGOXUnIA== +SHA1-Digest: iYBXzCozlRk583OeZZeROlnNBRA= diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/chrome.manifest b/chrome.manifest new file mode 100644 index 0000000..7fd8dfe --- /dev/null +++ b/chrome.manifest @@ -0,0 +1,2 @@ +content piclens chrome/content/ +overlay chrome://browser/content/browser.xul chrome://piclens/content/cooliris.xul diff --git a/chrome/content/ab.cooliris.png b/chrome/content/ab.cooliris.png new file mode 100644 index 0000000..3fce794 Binary files /dev/null and b/chrome/content/ab.cooliris.png differ diff --git a/chrome/content/cooliris-32.png b/chrome/content/cooliris-32.png new file mode 100644 index 0000000..956761a Binary files /dev/null and b/chrome/content/cooliris-32.png differ diff --git a/chrome/content/cooliris.css b/chrome/content/cooliris.css new file mode 100644 index 0000000..3e4dc59 --- /dev/null +++ b/chrome/content/cooliris.css @@ -0,0 +1,14 @@ +#piclens-toolbarbutton2 { + width: 36px; + height: 24px; +} + +/* default state */ +.cooliris-toolbarbutton-default { list-style-image: url('chrome://piclens/content/toolbar.launch.normal.png') !important; } +.cooliris-toolbarbutton-default:hover { list-style-image: url('chrome://piclens/content/toolbar.launch.normal.hover.png') !important; } +.cooliris-toolbarbutton-default:active:hover { list-style-image: url('chrome://piclens/content/toolbar.launch.normal.click.png') !important; } + +/* launchable state */ +.cooliris-toolbarbutton-launchable { list-style-image: url('chrome://piclens/content/toolbar.launch.active.png') !important; } +.cooliris-toolbarbutton-launchable:hover { list-style-image: url('chrome://piclens/content/toolbar.launch.active.hover.png') !important; } +.cooliris-toolbarbutton-launchable:active:hover { list-style-image: url('chrome://piclens/content/toolbar.launch.active.click.png') !important; } diff --git a/chrome/content/cooliris.ico b/chrome/content/cooliris.ico new file mode 100644 index 0000000..55f3da6 Binary files /dev/null and b/chrome/content/cooliris.ico differ diff --git a/chrome/content/cooliris.js b/chrome/content/cooliris.js new file mode 100644 index 0000000..f386284 --- /dev/null +++ b/chrome/content/cooliris.js @@ -0,0 +1,105 @@ +// (c) 2008 Cooliris Inc. All rights reserved. + +var Cc = Components.classes; +var Ci = Components.interfaces; + +function PicLensWindow() +{ + this.doc = window.document; + this.manager = Cc["@cooliris.com/piclens/manager;1"].getService(Ci.IPicLensManager); + this.isMac = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS == "Darwin"; + this.initToolbars(); +} + +PicLensWindow.prototype = { + initToolbars: function() { + var toolbar = this.doc.getElementById("nav-bar");//this.isMac ? "PersonalToolbar" : "toolbar-menubar"); + var alreadyInitialized = "piclens-initialized2"; + if (toolbar.hasAttribute(alreadyInitialized)) { + return; + } + toolbar.collapsed = false; + var plButtonId = "piclens-toolbarbutton2"; + this.insertToolbarItem(plButtonId); + this.insertIntoDefaultSet(plButtonId); + toolbar.setAttribute(alreadyInitialized, "1"); + this.doc.persist(toolbar.id, alreadyInitialized); + }, + insertToolbarItem: function(plButtonId) { + var navBar = this.doc.getElementById("nav-bar"); + + // attempt to insert after the search box + try { + var afterThisId = "search-container"; + var afterThisElem = this.doc.getElementById(afterThisId); + // if we didn't find the search somehow, we just put our button at the end + if(!afterThisElem) { + var buttons = navBar.getAttribute("currentset").split(","); + afterThisId = buttons[buttons.length - 1]; + afterThisElem = this.doc.getElementById(afterThisId); + } + + // if we found it, figure out the index of the entry + if(afterThisElem && this.doc.getElementById(plButtonId) == null) { + var ret = navBar.insertItem(plButtonId, afterThisElem.nextSibling); + navBar.setAttribute("currentset", navBar.currentSet); + this.doc.persist("nav-bar", "currentset"); + } + } + catch(e) { } + }, + insertIntoDefaultSet: function(plButtonId) { + var navBar = this.doc.getElementById("nav-bar"); + var set = navBar.getAttribute("defaultset"); + var prev = set.split(","); + var insertAt; + for (var i = 0; i != prev.length; ++i) { + if (prev[i] == "search-container") { + insertAt = i; + break; + } + } + + // otherwise insert at end + if (!insertAt) { + insertAt = prev.length; + } + + prev.splice(insertAt, 0, plButtonId); + var newSet = prev.join(","); + navBar.setAttribute("defaultset", newSet); + this.doc.persist("nav-bar", "defaultset"); + } +} + +var gPicLensWindow = null; + +window.addEventListener("load", function() { + // initialization + gPicLensWindow = new PicLensWindow(); + + // register event listeners + gBrowser.addEventListener("DOMContentLoaded", function(event) { + var doc = event.originalTarget; + if (doc instanceof HTMLDocument) { + gPicLensWindow.manager.pageDomLoaded(window, doc); + doc.defaultView.addEventListener("unload", function() { + gPicLensWindow.manager.pageUnloaded(doc); + }, true); + } + }, true); + gBrowser.addEventListener("load", function(event) { + var doc = event.originalTarget; + if (doc instanceof HTMLDocument) { + gPicLensWindow.manager.pageLoaded(doc); + } + }, true); + gBrowser.tabContainer.addEventListener("TabSelect", function(event) { + var tab = event.originalTarget; + gPicLensWindow.manager.tabSelectionChanged(window, tab.linkedBrowser.contentDocument); + }, false); +}, false); + +function launchCooliris() { + Cc['@cooliris.com/piclens/manager;1'].getService(Ci.IPicLensManager).launchFromToolbar(); +} diff --git a/chrome/content/cooliris.xul b/chrome/content/cooliris.xul new file mode 100644 index 0000000..c84204f --- /dev/null +++ b/chrome/content/cooliris.xul @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="cooliris.css" type="text/css" ?> +<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <toolbarpalette id="BrowserToolbarPalette"> + <toolbarbutton id="piclens-toolbarbutton2" class="cooliris-toolbarbutton-default" type="button" + tooltiptext="Launch Cooliris" label="Cooliris" style="list-style-image:url('chrome://piclens/content/toolbar.launch.active.png')" oncommand="launchCooliris()"> + </toolbarbutton> + </toolbarpalette> + <script type="application/x-javascript" src="chrome://piclens/content/cooliris.js" /> +</overlay> diff --git a/chrome/content/launch.down.png b/chrome/content/launch.down.png new file mode 100644 index 0000000..f2a9473 Binary files /dev/null and b/chrome/content/launch.down.png differ diff --git a/chrome/content/launch.png b/chrome/content/launch.png new file mode 100644 index 0000000..8f010bf Binary files /dev/null and b/chrome/content/launch.png differ diff --git a/chrome/content/return-hover.png b/chrome/content/return-hover.png new file mode 100644 index 0000000..b32f948 Binary files /dev/null and b/chrome/content/return-hover.png differ diff --git a/chrome/content/return-normal.png b/chrome/content/return-normal.png new file mode 100644 index 0000000..cbfccba Binary files /dev/null and b/chrome/content/return-normal.png differ diff --git a/chrome/content/toolbar.launch.active.click.png b/chrome/content/toolbar.launch.active.click.png new file mode 100644 index 0000000..a52eb8d Binary files /dev/null and b/chrome/content/toolbar.launch.active.click.png differ diff --git a/chrome/content/toolbar.launch.active.hover.png b/chrome/content/toolbar.launch.active.hover.png new file mode 100644 index 0000000..41643a4 Binary files /dev/null and b/chrome/content/toolbar.launch.active.hover.png differ diff --git a/chrome/content/toolbar.launch.active.png b/chrome/content/toolbar.launch.active.png new file mode 100644 index 0000000..6236eea Binary files /dev/null and b/chrome/content/toolbar.launch.active.png differ diff --git a/chrome/content/toolbar.launch.normal.click.png b/chrome/content/toolbar.launch.normal.click.png new file mode 100644 index 0000000..04c652a Binary files /dev/null and b/chrome/content/toolbar.launch.normal.click.png differ diff --git a/chrome/content/toolbar.launch.normal.hover.png b/chrome/content/toolbar.launch.normal.hover.png new file mode 100644 index 0000000..0fc1b79 Binary files /dev/null and b/chrome/content/toolbar.launch.normal.hover.png differ diff --git a/chrome/content/toolbar.launch.normal.png b/chrome/content/toolbar.launch.normal.png new file mode 100644 index 0000000..842f7bb Binary files /dev/null and b/chrome/content/toolbar.launch.normal.png differ diff --git a/chrome/content/tutorial.filter.png b/chrome/content/tutorial.filter.png new file mode 100644 index 0000000..41a7db4 Binary files /dev/null and b/chrome/content/tutorial.filter.png differ diff --git a/chrome/content/tutorial.scroll.png b/chrome/content/tutorial.scroll.png new file mode 100644 index 0000000..bc70665 Binary files /dev/null and b/chrome/content/tutorial.scroll.png differ diff --git a/chrome/content/tutorial.search.png b/chrome/content/tutorial.search.png new file mode 100644 index 0000000..5f504e5 Binary files /dev/null and b/chrome/content/tutorial.search.png differ diff --git a/chrome/content/tutorial.searchshop.png b/chrome/content/tutorial.searchshop.png new file mode 100644 index 0000000..65926f2 Binary files /dev/null and b/chrome/content/tutorial.searchshop.png differ diff --git a/chrome/content/tutorial.shopping.png b/chrome/content/tutorial.shopping.png new file mode 100644 index 0000000..87018da Binary files /dev/null and b/chrome/content/tutorial.shopping.png differ diff --git a/chrome/content/uiparts.png b/chrome/content/uiparts.png new file mode 100644 index 0000000..0017014 Binary files /dev/null and b/chrome/content/uiparts.png differ diff --git a/components/cooliris.xpt b/components/cooliris.xpt new file mode 100644 index 0000000..64259ea Binary files /dev/null and b/components/cooliris.xpt differ diff --git a/components/coolirisstub.dll b/components/coolirisstub.dll new file mode 100644 index 0000000..70e5128 Binary files /dev/null and b/components/coolirisstub.dll differ diff --git a/components/piclensjshelper.js b/components/piclensjshelper.js new file mode 100644 index 0000000..9388d33 --- /dev/null +++ b/components/piclensjshelper.js @@ -0,0 +1,89 @@ +// Copyright 2008, Cooliris Inc. + +function PicLensJSHelper() {} + +PicLensJSHelper.prototype = { + xpiPath getter: function() { + return __LOCATION__.parent.parent.path; + }, + frontDocument getter: function() { + var tabBrowser = this._frontTabBrowser(); + if (tabBrowser) { + var tab = tabBrowser.selectedBrowser; + return tab.contentDocument; + } else { + return null; + } + }, + openUrl: function(url, newTab, selectTab) { + var tabBrowser = this._frontTabBrowser(); + if (!tabBrowser) { + return; + } + if (newTab) { + var tab = tabBrowser.addTab(url); + if (selectTab) tabBrowser.selectedTab = tab; + } else { + tabBrowser.selectedBrowser.contentDocument.location = url; + } + }, + + setToolbarLaunchIcon: function(win, doc, name) { + var button = win.document.getElementById('piclens-toolbarbutton2'); + var selectedDoc = win.getBrowser().selectedBrowser.contentDocument; + if (button && doc === selectedDoc) { + button.className = "cooliris-toolbarbutton-" + name; + } + }, + + getUserAgentString: function(win) { + return win.navigator.userAgent; + }, + + _frontTabBrowser: function() { + var mediator = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var win = mediator.getMostRecentWindow("navigator:browser"); + return win ? win.getBrowser() : null; + }, + + QueryInterface: function(iid) { + if (!iid.equals(Components.interfaces.IPicLensJSHelper) && + !iid.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } +}; + +var PicLensJSHelperModule = { + registerSelf: function(compMgr, fileSpec, location, type) { + compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); + compMgr.registerFactoryLocation(this.classId, this.className, this.contractId, + fileSpec, location, type); + }, + getClassObject: function(compMgr, cid, iid) { + if (!cid.equals(this.classId)) + throw Components.results.NS_ERROR_NO_INTERFACE; + if (!iid.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + return this.factory; + }, + canUnload: function(compMgr) { + return true; + }, + + classId: Components.ID("a0ff7c31-77e1-4d6a-a6c6-c312ec2fbed4"), + className: "PicLensJSHelper", + contractId: "@cooliris.com/piclens/jshelper;1", + factory: { + createInstance: function(outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return (new PicLensJSHelper()).QueryInterface(iid); + } + } +}; + +function NSGetModule(compMgr, fileSpec) { + return PicLensJSHelperModule; +} diff --git a/install.rdf b/install.rdf new file mode 100644 index 0000000..9b0c9b1 --- /dev/null +++ b/install.rdf @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + <Description about="urn:mozilla:install-manifest"> + <em:id>[email protected]</em:id> + <em:name>Cooliris</em:name> + <em:version>1.9.1</em:version> + <em:description>Cooliris (formerly PicLens) transforms your browser into a full-screen 3D Wall for searching, viewing and sharing the Web.</em:description> + <em:creator>Cooliris Inc.</em:creator> + <em:targetApplication> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>3.0</em:minVersion> + <em:maxVersion>3.1.*</em:maxVersion> + </Description> + </em:targetApplication> +<em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> + <em:homepageURL>http://www.cooliris.com/</em:homepageURL> + <em:iconURL>chrome://piclens/content/cooliris-32.png</em:iconURL> + <em:updateURL>https://update.cooliris.com/firefox/xpi_update.rdf?os=%APP_OS%&amp;abi=%APP_ABI%&amp;ffv=%APP_VERSION%&amp;plv=%ITEM_VERSION%</em:updateURL> + <em:updateInfoURL>https://update.cooliris.com/firefox/xpi_update_info.rdf?os=%APP_OS%&amp;abi=%APP_ABI%&amp;ffv=%APP_VERSION%&amp;locale=%APP_LOCALE%&amp;plv=%ITEM_VERSION%</em:updateInfoURL> + </Description> +</RDF> + diff --git a/libs/LaunchCooliris.exe b/libs/LaunchCooliris.exe new file mode 100644 index 0000000..bf63688 Binary files /dev/null and b/libs/LaunchCooliris.exe differ diff --git a/libs/PicLensHelper.exe b/libs/PicLensHelper.exe new file mode 100644 index 0000000..b955057 Binary files /dev/null and b/libs/PicLensHelper.exe differ diff --git a/libs/avcodec-51.dll b/libs/avcodec-51.dll new file mode 100644 index 0000000..9c1f54e Binary files /dev/null and b/libs/avcodec-51.dll differ diff --git a/libs/avformat-52.dll b/libs/avformat-52.dll new file mode 100644 index 0000000..0445898 Binary files /dev/null and b/libs/avformat-52.dll differ diff --git a/libs/avutil-49.dll b/libs/avutil-49.dll new file mode 100644 index 0000000..af978f8 Binary files /dev/null and b/libs/avutil-49.dll differ diff --git a/libs/cooliris19.dll b/libs/cooliris19.dll new file mode 100644 index 0000000..c3ae7cb Binary files /dev/null and b/libs/cooliris19.dll differ diff --git a/libs/freetype.dll b/libs/freetype.dll new file mode 100644 index 0000000..de4a9af Binary files /dev/null and b/libs/freetype.dll differ diff --git a/libs/pixomatic.dll b/libs/pixomatic.dll new file mode 100644 index 0000000..481d5a4 Binary files /dev/null and b/libs/pixomatic.dll differ
LightGuard/seam-exception-handling
3ac51851c209f99403fefc0950e438f0b70b0945
Completed docs
diff --git a/docs/src/main/docbook/en-US/client_usage.xml b/docs/src/main/docbook/en-US/client_usage.xml index 059ec8e..32dab84 100644 --- a/docs/src/main/docbook/en-US/client_usage.xml +++ b/docs/src/main/docbook/en-US/client_usage.xml @@ -1,50 +1,96 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []> <chapter id="exception.handling.client_usage"> <title>Usage</title> <para> An end user of the Seam Exception Handling Framework is typically only concerned with the ExceptionHandler class. Though, in creating their handlers they may make use of an implementation of State, and will also want to use the HandlerChain to end execution of the chain. For further information, please check the API docs. </para> <section id="exception.handling.client_usage.exception_handler"> <title>ExceptionHandler</title> <para> - </para> - + ExceptionHandler instances should generally be created to handle a single type of exception, of course more + general kinds of handlers could be written to support logging, handling of a whole hierarchy of exceptions, + etc. The ExceptionHandler interface is generized to aid with this concern: + </para> + + <programlisting><![CDATA[public interface ExceptionHandler<E extends Throwable, S extends State> +{ + int getPriority(); + + void handle(HandlerChain chain, S state, E e); +}]]> + </programlisting> + + <para> + <literal>E</literal> defines the exception type this handler will process in the handle method. <literal>S</literal> is for the type of state + object (more below) the handler expects. For example a handler could work slightly differently for the same + exception based on the environment. If a <literal>OptimisticLockException</literal> is raised a message to the user may be + desired, but building that message would be environment specific, is it a Swing dialog, a <literal>FacesMessage</literal>, a + <literal>SOAPFault</literal>? The State object can help to be an identifier of the type of environment in which the handler is meant to be + run. + </para> + + <para> + All of the logic of an ExceptionHandler is contained within the handle method. This is the method the framework + invokes for each exception that is raised that matches the Exception type and State types (or subclasses + thereof). + </para> + <section id="exception.handling.client_usage.adding_handlers"> <title>Adding Handlers</title> <para> + Adding a handler to the framework is as easy as creating the class and implementing the interface. Nothing + special is needed, the framework will pick up the handler at the start of the application. </para> </section> <section id="exception.handling.client_usage.ordering_handlers"> <title>Ordering of Handlers</title> <para> + The <literal>getPriority</literal> method of a handler helps determine the order of the handler within the chain of handlers. + The lower the number, the closer to the top of the chain a handler is placed. If two handlers are found + that have the same priority the hierarchy of the two exception types is taken into consideration. If one + exception is a super type of the other, the more specific handler is added before the other in the chain. </para> + + <para> + If the XML Configuration module is used, explicit ordering can be created by configuring the the + 'allHandlers' list of the ExceptionHandlerExecutor class. Please see the XML Configuration module + documentation for more information about configuring classes. + </para> </section> </section> <section id="exception.handling.client_usage.state"> <title>State</title> <para> + The <literal>State</literal> object holds information that the exception handler may need or desire to make decisions for handling + the exception. The basic State implemenation will allow the handler to retrieve the BeanManager. Other + examples would be in a JSF application the State implementation could extend the basic implemenation to contain the <literal>Application</literal>, + <literal>NavigationHandler</literal>, <literal>ExceptionQueuedEventContext</literal>, etc. Each implementation would be different and environment + specific. </para> </section> <section id="exception.handling.client_usage.handler_chain"> <title>Handler Chain</title> <para> + The HandlerChain only has one method: <literal>end</literal>. This method is used to halt execution of the handler chain at the + end of this exception handler. If end is not called the handler chain will continue to be traversed and + appropriate handlers invoked until end is called in a handler or the end of the chain is reached. </para> </section> <!-- vim:et:ts=3:sw=3:tw=120 --> </chapter> diff --git a/docs/src/main/docbook/en-US/integration.xml b/docs/src/main/docbook/en-US/integration.xml index b2f4f59..47facd5 100644 --- a/docs/src/main/docbook/en-US/integration.xml +++ b/docs/src/main/docbook/en-US/integration.xml @@ -1,26 +1,66 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []> -<chapter id=""> - <title></title> +<chapter id="exception.handling.framwork_integration"> + <title>Framework Integration</title> + <para> - </para> + Integration of Seam Exception Handling into other frameworks consists of two main areas: + </para> + + <itemizedlist> + <listitem>creating and firing an <literal>ExceptionEvent</literal></listitem> + <listitem>extending and implementing a <literal>State</literal></listitem> + </itemizedlist> - <section id=""> - <title></title> + <section id="exception.handling.framwork_integration.exceptionevent"> + <title>Creating and Firing an ExceptionEvent</title> <para> + An <literal>ExceptionEvent</literal> is constructed by passing a <literal>Throwable</literal> and a + <literal>State</literal> implementation. Firing that event is done via CDI events, please consult the CDI API + or specification for more information. </para> - - <section id=""> - <title></title> - <para> - </para> - </section> - - + + <para> + To ease the burden of the application developers, it is suggested that the following two approaches be taken + for allowing creation of <literal>ExceptionEvent</literal> objects + </para> + + <itemizedlist> + <listitem> + tie into the exception handling mechanism of the underlying framework + </listitem> + <listitem> + create a shortcut means of creating and firing events that takes a <literal>Throwable</literal> + </listitem> + </itemizedlist> + + <para> + By tying into the underlying framework's exception handling, any uncaught exception should be routed through + the Seam Exception Handling system and allow user created handlers to be invoked. This is the typical way of + using the Seam Exception Handling framework. This also should follow best practices for the specific framework + and allow more fine fleshed out <literal>State</literal> implementations to be passed to the handlers. + </para> + + <para> + A shortcut method of creating and firing the <literal>ExceptionEvent</literal> could be used in catch blocks, + but possibly would not allow as fleshed out of a <literal>State</literal> object. + </para> </section> + + <section id="exception.handling.framwork_integration.state"> + <title>Extending State</title> + + <para> + The basic <literal>State</literal> interface is very generic and only contains a + <literal>BeanManager</literal>. A new interface extending the basic one should be created for the framework. + This new interface should contain additional state or framework objects that the application developers could + use to determine handling of a specific exception, display messages to the users, and / or perform other + framework specific actions such as navigation, graceful termination, etc. + </para> + </section> <!-- vim:et:ts=3:sw=3:tw=120 --> </chapter> diff --git a/docs/src/main/docbook/en-US/master.xml b/docs/src/main/docbook/en-US/master.xml index 6fc00ed..2f155dc 100644 --- a/docs/src/main/docbook/en-US/master.xml +++ b/docs/src/main/docbook/en-US/master.xml @@ -1,17 +1,17 @@ <?xml version='1.0' encoding="utf-8"?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.35//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]> <book lang="en"> <toc/> <title>Seam Exception Handling</title> <xi:include href="introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="client_usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> - <!--<xi:include href="integration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> --> + <xi:include href="integration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <!-- <xi:include href="another_chapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> --> </book>
LightGuard/seam-exception-handling
66656847269743295f073fd2eb1f03a008b74af9
Adding vim swap files to ignore
diff --git a/.gitignore b/.gitignore index 51f47ae..32a3dff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ .gradle build *.iml *.ipr *.iws .classpath .project target +*.sw?
LightGuard/seam-exception-handling
4936826267da9610b42798923c76621ac50dd545
Begining documenation
diff --git a/docs/pom.xml b/docs/pom.xml index fd6080e..55fe441 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -1,83 +1,81 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-parent</artifactId> <version>3.0.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-reference-guide</artifactId> <version>3.0.0-SNAPSHOT</version> <packaging>jdocbook</packaging> <name>Seam Exception Handling Module Reference Guide</name> <properties> - <pdf.name>seam-exception-handling-reference-guide.pdf</pdf.name> - <weld.docbook.version>1.1.1-Beta5</weld.docbook.version> + <pdf.name>${project.artifactId}.pdf</pdf.name> </properties> <build> - <defaultGoal>process-classes</defaultGoal> <plugins> <plugin> <groupId>org.jboss.maven.plugins</groupId> <artifactId>maven-jdocbook-plugin</artifactId> </plugin> <!-- Attach docs as a war so dist can retrieve them --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>attach-zip</id> <phase>package</phase> <goals> <goal>attach-artifact</goal> </goals> <configuration> <artifacts> <artifact> <file>${project.build.outputDirectory}/${project.artifactId}-${project.version}.war</file> <type>war</type> </artifact> </artifacts> </configuration> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>distribution</id> <activation> <property> <name>release</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> </plugin> </plugins> </build> </profile> </profiles> <!-- <scm> <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/mail/trunk/docs</connection> <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/mail/trunk/docs</developerConnection> <url>http://fisheye.jboss.org/browse/seam/modules/mail/docs</url> </scm> --> </project> diff --git a/docs/readme.txt b/docs/readme.txt index 7a4d2a6..cf5304d 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -1,3 +1,3 @@ -To build the Seam Mail docs run the following command: +To build the Seam Exception Handling docs run the following command: mvn jdocbook:generate diff --git a/docs/src/main/docbook/en-US/client_usage.xml b/docs/src/main/docbook/en-US/client_usage.xml new file mode 100644 index 0000000..059ec8e --- /dev/null +++ b/docs/src/main/docbook/en-US/client_usage.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []> +<chapter id="exception.handling.client_usage"> + <title>Usage</title> + <para> + An end user of the Seam Exception Handling Framework is typically only concerned with the ExceptionHandler class. + Though, in creating their handlers they may make use of an implementation of State, and will also want to use the + HandlerChain to end execution of the chain. For further information, please check the API docs. + </para> + + <section id="exception.handling.client_usage.exception_handler"> + <title>ExceptionHandler</title> + + <para> + </para> + + <section id="exception.handling.client_usage.adding_handlers"> + <title>Adding Handlers</title> + <para> + </para> + </section> + + <section id="exception.handling.client_usage.ordering_handlers"> + <title>Ordering of Handlers</title> + <para> + </para> + </section> + + </section> + + <section id="exception.handling.client_usage.state"> + <title>State</title> + + <para> + </para> + + </section> + + <section id="exception.handling.client_usage.handler_chain"> + <title>Handler Chain</title> + + <para> + </para> + + </section> +<!-- +vim:et:ts=3:sw=3:tw=120 +--> +</chapter> diff --git a/docs/src/main/docbook/en-US/installation.xml b/docs/src/main/docbook/en-US/installation.xml new file mode 100644 index 0000000..f8856bc --- /dev/null +++ b/docs/src/main/docbook/en-US/installation.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" +"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []> +<chapter id="exception.handling.installation"> + <title>Installation</title> + <para> + The Seam Exception Handling API is the only compile time dependency a project needs, and an implementation must + also be included, either explicitly or via some other module depending on it (and exposing their own specialized + extension) is all that is needed during runtime. If you are using + <ulink url="http://maven.apache.org/">Maven</ulink> as your build tool, you can add the following dependency to + your pom.xml file: + </para> + <programlisting role="XML"><![CDATA[ + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-api</artifactId> + <version>${seam-exception-handling-version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-impl</artifactId> + <version>${seam-exception-handling-version}</version> + <scope>runtime</scope> + </dependency>]]> + </programlisting> + <note> + <para> + The runtime dependency is only needed if another Seam 3 module being used doesn't already use it. Typically + this will only be for Java SE development. + </para> + </note> + <tip> + <para> + Replace ${seam-exception-handling-version} with the most recent or appropriate version of Seam Exception + Handling. + </para> + </tip> + <!-- + vim:et:ts=3:sw=3:tw=120 + --> +</chapter> diff --git a/docs/src/main/docbook/en-US/integration.xml b/docs/src/main/docbook/en-US/integration.xml new file mode 100644 index 0000000..b2f4f59 --- /dev/null +++ b/docs/src/main/docbook/en-US/integration.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []> +<chapter id=""> + <title></title> + <para> + </para> + + <section id=""> + <title></title> + + <para> + </para> + + <section id=""> + <title></title> + <para> + </para> + </section> + + + </section> +<!-- +vim:et:ts=3:sw=3:tw=120 +--> +</chapter> diff --git a/docs/src/main/docbook/en-US/introduction.xml b/docs/src/main/docbook/en-US/introduction.xml index 7f10b85..295815c 100644 --- a/docs/src/main/docbook/en-US/introduction.xml +++ b/docs/src/main/docbook/en-US/introduction.xml @@ -1,17 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <chapter id="introduction"> <title>Seam Exception Handling Introduction</title> <para> - Lead in... + The Seam Exception Handling module creates a simple, yet robust base for other modules and users + to create a custom and complete exception handling process. Exception handling is done using + CDI events, keeping exception handling noninvasive and also helping the program or module to stay + minimally coupled to the exception handling framework. </para> - <section> - <title>Getting Started</title> - <para>Explain</para> - </section> <!-- vim:et:ts=3:sw=3:tw=120 --> </chapter> diff --git a/docs/src/main/docbook/en-US/master.xml b/docs/src/main/docbook/en-US/master.xml index 21c35bb..6fc00ed 100644 --- a/docs/src/main/docbook/en-US/master.xml +++ b/docs/src/main/docbook/en-US/master.xml @@ -1,14 +1,17 @@ <?xml version='1.0' encoding="utf-8"?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.35//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]> <book lang="en"> <toc/> <title>Seam Exception Handling</title> <xi:include href="introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + <xi:include href="installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + <xi:include href="client_usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + <!--<xi:include href="integration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> --> <!-- <xi:include href="another_chapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> --> </book>
LightGuard/seam-exception-handling
af50702d963cc95bde8e9c59b540ac5fddf84fff
Adding maven structure for release and docs
diff --git a/dist/pom.xml b/dist/pom.xml new file mode 100644 index 0000000..187404b --- /dev/null +++ b/dist/pom.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-parent</artifactId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>seam-exception-handling-distribution</artifactId> + <name>Seam Exception Handling Module Distribution</name> + <description>Builds a Seam Exception Handling module release distribution</description> + <packaging>pom</packaging> + + <properties> + <maven.deploy.skip>true</maven.deploy.skip> + </properties> + + <dependencies> + + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling</artifactId> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + </dependency> + + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling</artifactId> + <version>${project.version}</version> + <classifier>javadoc</classifier> + <optional>true</optional> + </dependency> + + <!-- + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-reference-guide</artifactId> + <version>${project.version}</version> + <type>war</type> + <optional>true</optional> + </dependency> + --> + + </dependencies> + + <build> + <finalName>seam-exception-handling</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> diff --git a/dist/src/main/assembly/assembly.xml b/dist/src/main/assembly/assembly.xml new file mode 100644 index 0000000..a4e1ab4 --- /dev/null +++ b/dist/src/main/assembly/assembly.xml @@ -0,0 +1,69 @@ +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + + <formats> + <format>zip</format> + </formats> + + <baseDirectory>${project.build.finalName}-${project.version}</baseDirectory> + + <!-- Add distribution files --> + <fileSets> + <fileSet> + <directory>src/main/assembly</directory> + <outputDirectory>.</outputDirectory> + <includes> + <include>readme.txt</include> + </includes> + </fileSet> + </fileSets> + + <dependencySets> + <!-- Add necessary binaries --> + <dependencySet> + <outputDirectory>artifacts</outputDirectory> + <useProjectArtifact>false</useProjectArtifact> + <includes> + <include>org.jboss.seam.exception-handling:seam-exception-handling</include> + </includes> + <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping> + </dependencySet> + <!-- Add necessary dependencies --> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <useProjectArtifact>false</useProjectArtifact> + <useTransitiveDependencies>true</useTransitiveDependencies> + <excludes> + <exclude>org.jboss.seam.exception-handling:*</exclude> + </excludes> + <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping> + </dependencySet> + <!-- Pull in the example projects --> + <!-- + <dependencySet> + <outputDirectory>examples</outputDirectory> + <unpack>true</unpack> + <useProjectArtifact>false</useProjectArtifact> + <includes> + <include>org.jboss.seam.mail:seam-mail-examples-sendmail</include> + </includes> + </dependencySet> + --> + <!-- Pull in docbook artifacts --> + <dependencySet> + <outputDirectory>doc/reference</outputDirectory> + <unpack>true</unpack> + <useProjectArtifact>false</useProjectArtifact> + <includes> + <include>org.jboss.seam.exception-handling:seam-exception-handling-reference-guide</include> + </includes> + <unpackOptions> + <excludes> + <exclude>META-INF/</exclude> + </excludes> + </unpackOptions> + </dependencySet> + </dependencySets> +</assembly> diff --git a/dist/src/main/assembly/readme.txt b/dist/src/main/assembly/readme.txt new file mode 100644 index 0000000..46efa9c --- /dev/null +++ b/dist/src/main/assembly/readme.txt @@ -0,0 +1,42 @@ + + Seam Exception Handling Module + 3.0.0 SNAPSHOT + + What is it? + =========== + + The Seam 3 Exception Handling Module is... + + Contents of distribution + ======================== + + docs/ + + API Docs and reference guide. + + examples/ + + Examples for module. + + ... + + Licensing + ========= + + This distribution, as a whole, is licensed under the terms of the LGPL v3 + (). + + Seam Faces URLs + =============== + + Seam 3 Exception Handling Module: + Seam 3 Home Page: http://www.sfwk.org/Seam3 + Downloads: http://www.sfwk.org/Seam3/DistributionDownloads + Forums: http://www.sfwk.org/Community/Seam3Users + Source Code: + Issue Tracking: + + Release Notes + ============= + + * diff --git a/docs/pom.xml b/docs/pom.xml new file mode 100644 index 0000000..fd6080e --- /dev/null +++ b/docs/pom.xml @@ -0,0 +1,83 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-parent</artifactId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-reference-guide</artifactId> + <version>3.0.0-SNAPSHOT</version> + <packaging>jdocbook</packaging> + <name>Seam Exception Handling Module Reference Guide</name> + + <properties> + <pdf.name>seam-exception-handling-reference-guide.pdf</pdf.name> + <weld.docbook.version>1.1.1-Beta5</weld.docbook.version> + </properties> + + <build> + <defaultGoal>process-classes</defaultGoal> + <plugins> + + <plugin> + <groupId>org.jboss.maven.plugins</groupId> + <artifactId>maven-jdocbook-plugin</artifactId> + </plugin> + + <!-- Attach docs as a war so dist can retrieve them --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-zip</id> + <phase>package</phase> + <goals> + <goal>attach-artifact</goal> + </goals> + <configuration> + <artifacts> + <artifact> + <file>${project.build.outputDirectory}/${project.artifactId}-${project.version}.war</file> + <type>war</type> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>distribution</id> + <activation> + <property> + <name>release</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <!-- + <scm> + <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/mail/trunk/docs</connection> + <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/mail/trunk/docs</developerConnection> + <url>http://fisheye.jboss.org/browse/seam/modules/mail/docs</url> + </scm> + --> +</project> diff --git a/docs/readme.txt b/docs/readme.txt new file mode 100644 index 0000000..7a4d2a6 --- /dev/null +++ b/docs/readme.txt @@ -0,0 +1,3 @@ +To build the Seam Mail docs run the following command: + +mvn jdocbook:generate diff --git a/docs/src/main/assembly/assembly.xml b/docs/src/main/assembly/assembly.xml new file mode 100644 index 0000000..496a5be --- /dev/null +++ b/docs/src/main/assembly/assembly.xml @@ -0,0 +1,17 @@ +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>sources</id> + <formats> + <format>zip</format> + </formats> + <baseDirectory>${project.artifactId}</baseDirectory> + <fileSets> + <fileSet> + <outputDirectory>.</outputDirectory> + <directory>${project.basedir}/src/main/docbook/en-US</directory> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + </fileSets> +</assembly> diff --git a/docs/src/main/docbook/en-US/introduction.xml b/docs/src/main/docbook/en-US/introduction.xml new file mode 100644 index 0000000..7f10b85 --- /dev/null +++ b/docs/src/main/docbook/en-US/introduction.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> +<chapter id="introduction"> + <title>Seam Exception Handling Introduction</title> + + <para> + Lead in... + </para> + + <section> + <title>Getting Started</title> + <para>Explain</para> + </section> +<!-- +vim:et:ts=3:sw=3:tw=120 +--> +</chapter> diff --git a/docs/src/main/docbook/en-US/master.xml b/docs/src/main/docbook/en-US/master.xml new file mode 100644 index 0000000..21c35bb --- /dev/null +++ b/docs/src/main/docbook/en-US/master.xml @@ -0,0 +1,14 @@ +<?xml version='1.0' encoding="utf-8"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.35//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]> +<book lang="en"> + + <toc/> + + <title>Seam Exception Handling</title> + <xi:include href="introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + <!-- + <xi:include href="another_chapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + --> + +</book> diff --git a/pom.xml b/pom.xml index 40d1df9..830d59e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,80 +1,80 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>seam-parent</artifactId> <groupId>org.jboss.seam</groupId> - <version>2</version> + <version>3</version> </parent> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-parent</artifactId> <packaging>pom</packaging> <version>3.0.0-SNAPSHOT</version> <name>Seam Exception Handling Parent</name> <properties> <seam.version>3.0.0.b01</seam.version> <joda-time.version>1.6</joda-time.version> </properties> <prerequisites> <maven>3.0</maven> </prerequisites> <modules> <module>api</module> <module>impl</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.seam</groupId> <artifactId>seam</artifactId> <version>${seam.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>${joda-time.version}</version> <type>jar</type> </dependency> </dependencies> </dependencyManagement> <!-- Dependencies common to the api and implementation(s) --> <dependencies> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>compile</scope> </dependency> </dependencies> <profiles> <profile> <id>distribution</id> <activation> <property> <name>release</name> </property> </activation> <modules> <module>dist</module> <module>docs</module> <module>examples</module> </modules> </profile> </profiles> <scm> <connection>scm:git:git://github.com/LightGuard/seam-exception-handling.git</connection> <url>http://github.com/LightGuard/seam-exception-handling/tree/master</url> </scm> </project>
LightGuard/seam-exception-handling
802bf24ab7cab83637c920d50127671b590f4570
Naming a variable a little better
diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java index 823abed..a4d7562 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -1,118 +1,118 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import javax.inject.Inject; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; /** * Finds and invokes all {@link ExceptionHandler} instants for a particular exception and {@link State}. <p> If any handlers are * found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> */ public class ExceptionHandlerExecutor { @Inject private List<ExceptionHandler> allHandlers; /** * Observes the event, finds the correct exception handler(s) and invokes them. * * @param event Event Payload */ @SuppressWarnings("unchecked") public void executeHandlers(@Observes ExceptionEvent event) { final HandlerChain chain = new HandlerChainImpl(); final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); final State state = event.getState(); final BeanManager beanManager = state.getBeanManager(); Throwable exception = event.getException(); - MethodParameterTypeHelper methodParameterTypeHelper; + MethodParameterTypeHelper handlerMethodParameters; do { unwrappedExceptions.push(exception); } while ((exception = exception.getCause()) != null); // Finding the correct exception handlers using reflection based on the method // to determine if it's the correct Throwable unwrapped; while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) { unwrapped = unwrappedExceptions.pop(); for (ExceptionHandler handler : this.allHandlers) { - methodParameterTypeHelper = new MethodParameterTypeHelper(handler); + handlerMethodParameters = new MethodParameterTypeHelper(handler); - if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) - && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) + if (handlerMethodParameters.containsExceptionTypeOrSuperType(unwrapped.getClass()) + && handlerMethodParameters.containsStateTypeOrSuperType(state.getClass())) { handler.handle(chain, state, unwrapped); event.setExceptionHandled(true); if (((HandlerChainImpl) chain).isChainEnd()) { break; } } } } } /** * Finds all instances of {@link org.jboss.seam.exceptionhandling.ExceptionHandler} and creates contextual instances for use. * <p/> * Method taken from Seam faces BeanManagerUtils. * * @param manager BeanManager instance * @return List of instantiated found by the bean manager */ @SuppressWarnings("unchecked") @Produces public List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) { List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) { CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( bean); if (context != null) { result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); } } Collections.sort(result, new ExceptionHandlerComparator()); return result; } }
LightGuard/seam-exception-handling
fee7f1640d7f5f26fb9d6bdcfc00e38bbf254d62
Seam XML config should work correctly now.
diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java index 775d8ab..823abed 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -1,110 +1,118 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; +import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; +import javax.inject.Inject; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; /** * Finds and invokes all {@link ExceptionHandler} instants for a particular exception and {@link State}. <p> If any handlers are * found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> */ public class ExceptionHandlerExecutor { + @Inject + private List<ExceptionHandler> allHandlers; + /** * Observes the event, finds the correct exception handler(s) and invokes them. * * @param event Event Payload */ @SuppressWarnings("unchecked") public void executeHandlers(@Observes ExceptionEvent event) { final HandlerChain chain = new HandlerChainImpl(); final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); final State state = event.getState(); final BeanManager beanManager = state.getBeanManager(); - final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); Throwable exception = event.getException(); MethodParameterTypeHelper methodParameterTypeHelper; - Collections.sort(allHandlers, new ExceptionHandlerComparator()); - do { unwrappedExceptions.push(exception); } while ((exception = exception.getCause()) != null); // Finding the correct exception handlers using reflection based on the method // to determine if it's the correct Throwable unwrapped; while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) { unwrapped = unwrappedExceptions.pop(); - for (ExceptionHandler handler : allHandlers) + for (ExceptionHandler handler : this.allHandlers) { methodParameterTypeHelper = new MethodParameterTypeHelper(handler); if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) { handler.handle(chain, state, unwrapped); event.setExceptionHandled(true); if (((HandlerChainImpl) chain).isChainEnd()) { break; } } } } } /** + * Finds all instances of {@link org.jboss.seam.exceptionhandling.ExceptionHandler} and creates contextual instances for use. + * <p/> * Method taken from Seam faces BeanManagerUtils. * * @param manager BeanManager instance * @return List of instantiated found by the bean manager */ @SuppressWarnings("unchecked") - private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) + @Produces + public List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) { List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) { CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( bean); if (context != null) { result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); } } + + Collections.sort(result, new ExceptionHandlerComparator()); + return result; } }
LightGuard/seam-exception-handling
b74a24f0b676078fe69e7ca1edb6afc8bfaddb0b
Maven install works correctly now.
diff --git a/impl/pom.xml b/impl/pom.xml index a8e6463..f10215a 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -1,85 +1,92 @@ <?xml version="1.0"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>seam-exception-handling-parent</artifactId> <groupId>org.jboss.seam.exception-handling</groupId> <version>3.0.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-impl</artifactId> <packaging>jar</packaging> <name>Seam Exception Handling Module Implementation</name> <dependencies> <dependency> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-api</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> </dependency> <dependency> <groupId>org.jboss.arquillian</groupId> <artifactId>arquillian-junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-weld-embedded</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.glassfish.web</groupId> + <artifactId>el-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <forkMode>once</forkMode> <argLine>-Xmx512m</argLine> </configuration> </plugin> </plugins> </build> <scm> <connection>scm:git:git://github.com/LightGuard/seam-exception-handling.git</connection> <url>http://github.com/LightGuard/seam-exception-handling/tree/master</url> </scm> </project> diff --git a/pom.xml b/pom.xml index bd3166a..40d1df9 100644 --- a/pom.xml +++ b/pom.xml @@ -1,82 +1,80 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>seam-parent</artifactId> <groupId>org.jboss.seam</groupId> - <version>1</version> + <version>2</version> </parent> <groupId>org.jboss.seam.exception-handling</groupId> <artifactId>seam-exception-handling-parent</artifactId> <packaging>pom</packaging> <version>3.0.0-SNAPSHOT</version> <name>Seam Exception Handling Parent</name> <properties> <seam.version>3.0.0.b01</seam.version> <joda-time.version>1.6</joda-time.version> </properties> - <!-- <prerequisites> <maven>3.0</maven> </prerequisites> - --> <modules> <module>api</module> <module>impl</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.seam</groupId> <artifactId>seam</artifactId> <version>${seam.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>${joda-time.version}</version> <type>jar</type> </dependency> </dependencies> </dependencyManagement> <!-- Dependencies common to the api and implementation(s) --> <dependencies> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>compile</scope> </dependency> </dependencies> <profiles> <profile> <id>distribution</id> <activation> <property> <name>release</name> </property> </activation> <modules> <module>dist</module> <module>docs</module> <module>examples</module> </modules> </profile> </profiles> <scm> <connection>scm:git:git://github.com/LightGuard/seam-exception-handling.git</connection> <url>http://github.com/LightGuard/seam-exception-handling/tree/master</url> </scm> </project>
LightGuard/seam-exception-handling
531fc0fb2267b7dfa845f32ff9abbb40c444189c
Initial maven support.
diff --git a/.gitignore b/.gitignore index 2cd61a4..51f47ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ .gradle build *.iml *.ipr *.iws .classpath .project +target diff --git a/api/pom.xml b/api/pom.xml new file mode 100644 index 0000000..21da909 --- /dev/null +++ b/api/pom.xml @@ -0,0 +1,40 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>seam-exception-handling-parent</artifactId> + <groupId>org.jboss.seam.exception-handling</groupId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>seam-exception-handling-api</artifactId> + <version>3.0.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Seam Exception Handling Module API</name> + + <profiles> + <profile> + <id>code-coverage</id> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>emma-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.sonatype.maven.plugin</groupId> + <artifactId>emma4it-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> diff --git a/impl/pom.xml b/impl/pom.xml new file mode 100644 index 0000000..a8e6463 --- /dev/null +++ b/impl/pom.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>seam-exception-handling-parent</artifactId> + <groupId>org.jboss.seam.exception-handling</groupId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-impl</artifactId> + <packaging>jar</packaging> + <name>Seam Exception Handling Module Implementation</name> + + <dependencies> + <dependency> + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-api</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + </dependency> + + <dependency> + <groupId>org.jboss.arquillian</groupId> + <artifactId>arquillian-junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.arquillian.container</groupId> + <artifactId>arquillian-weld-embedded</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.weld</groupId> + <artifactId>weld-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>once</forkMode> + <argLine>-Xmx512m</argLine> + </configuration> + </plugin> + </plugins> + </build> + + <scm> + <connection>scm:git:git://github.com/LightGuard/seam-exception-handling.git</connection> + <url>http://github.com/LightGuard/seam-exception-handling/tree/master</url> + </scm> + +</project> diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bd3166a --- /dev/null +++ b/pom.xml @@ -0,0 +1,82 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>seam-parent</artifactId> + <groupId>org.jboss.seam</groupId> + <version>1</version> + </parent> + + <groupId>org.jboss.seam.exception-handling</groupId> + <artifactId>seam-exception-handling-parent</artifactId> + <packaging>pom</packaging> + <version>3.0.0-SNAPSHOT</version> + <name>Seam Exception Handling Parent</name> + + <properties> + <seam.version>3.0.0.b01</seam.version> + <joda-time.version>1.6</joda-time.version> + </properties> + + <!-- + <prerequisites> + <maven>3.0</maven> + </prerequisites> + --> + + <modules> + <module>api</module> + <module>impl</module> + </modules> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.jboss.seam</groupId> + <artifactId>seam</artifactId> + <version>${seam.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <version>${joda-time.version}</version> + <type>jar</type> + </dependency> + </dependencies> + </dependencyManagement> + + <!-- Dependencies common to the api and implementation(s) --> + <dependencies> + <dependency> + <groupId>javax.enterprise</groupId> + <artifactId>cdi-api</artifactId> + <scope>compile</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>distribution</id> + <activation> + <property> + <name>release</name> + </property> + </activation> + <modules> + <module>dist</module> + <module>docs</module> + <module>examples</module> + </modules> + </profile> + </profiles> + + <scm> + <connection>scm:git:git://github.com/LightGuard/seam-exception-handling.git</connection> + <url>http://github.com/LightGuard/seam-exception-handling/tree/master</url> + </scm> + +</project>
LightGuard/seam-exception-handling
e5d6ac06376635ace77e576aea0f6f740cc84222
Making variables final where applicable. Switching to 132 chars on the right margin.
diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java index 7080e12..0c9696f 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java @@ -1,76 +1,74 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** * Payload for an exception to be handled. */ public class ExceptionEvent { - private State state; - private Throwable exception; + private final State state; + private final Throwable exception; private boolean exceptionHandled; public ExceptionEvent(Throwable exception, State state) { this.exception = exception; this.state = state; this.exceptionHandled = false; } /** * @return the exception to be handled. */ public Throwable getException() { return exception; } /** - * @return State instance related to the environment. This will often need to - * be cast to the correct sub class. + * @return State instance related to the environment. This will often need to be cast to the correct sub class. */ public State getState() { return state; } /** * @return flag indicating the exception has been handled. */ public boolean isExceptionHandled() { return exceptionHandled; } /** - * This should be set if the exception has been handled in an event observer - * or handler. + * This should be set if the exception has been handled in an event observer or handler. * * @param exceptionHandled new value */ public void setExceptionHandled(boolean exceptionHandled) { this.exceptionHandled = exceptionHandled; } } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java index ffcb76f..4013ead 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java @@ -1,44 +1,43 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Registers an exception handler for a specific exception and state, this is - * the main entry point for using Seam's exception handling infrastructure. + * Registers an exception handler for a specific exception and state, this is the main entry point for using Seam's exception + * handling infrastructure. */ public interface ExceptionHandler<E extends Throwable, S extends State> { /** - * @return the numeric priority of this handler in relationship to other - * handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other handlers, 1 being top priority */ int getPriority(); /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ void handle(HandlerChain chain, S state, E e); } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java index 3062283..270bffe 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java @@ -1,36 +1,34 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Provides the developer methods to affect the traversal of the chain of {@link - * ExceptionHandler} instances. + * Provides the developer methods to affect the traversal of the chain of {@link ExceptionHandler} instances. */ public interface HandlerChain { /** - * End execution of the chain. Calling this method will immediately stop - * executing the handler chain, leaving any handlers left in the chain as - * uncalled. + * End execution of the chain. Calling this method will immediately stop executing the handler chain, leaving any handlers left + * in the chain as uncalled. */ void end(); } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java index e5441bd..748c3e7 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java @@ -1,42 +1,40 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.inject.spi.BeanManager; /** - * The State object is meant to provide any state that may be helpful for the - * developer in determining what to do with a particular exception handling. It - * may include and application state, active processes, or other convenience - * methods for the {@link ExceptionHandler} developer. + * The State object is meant to provide any state that may be helpful for the developer in determining what to do with a particular + * exception handling. It may include and application state, active processes, or other convenience methods for the {@link + * ExceptionHandler} developer. * <p/> - * For example, a servlet state may include methods to retrieve the - * HttpServletRequest, HttpServletResponse and possibly a navigation convenience - * method. + * For example, a servlet state may include methods to retrieve the HttpServletRequest, HttpServletResponse and possibly a + * navigation convenience method. */ public interface State { /** * @return current BeanManager. */ public BeanManager getBeanManager(); } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java index fc752e6..ca2638f 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java @@ -1,94 +1,84 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import java.util.Comparator; /** - * Comparator to sort exception handlers according to priority (highest number - * first) then by class hierarchy of the Exception types being handled (most - * specific first). + * Comparator to sort exception handlers according to priority (highest number first) then by class hierarchy of the Exception types + * being handled (most specific first). */ public final class ExceptionHandlerComparator implements Comparator<ExceptionHandler> { /** - * Compares its two arguments for order. Returns a negative integer, zero, - * or a positive integer as the first argument is less than, equal to, or - * greater than the second.<p> + * Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less + * than, equal to, or greater than the second.<p> * <p/> - * In the foregoing description, the notation <tt>sgn(</tt><i>expression</i><tt>)</tt> - * designates the mathematical <i>signum</i> function, which is defined to - * return one of <tt>-1</tt>, <tt>0</tt>, or <tt>1</tt> according to whether - * the value of <i>expression</i> is negative, zero or positive.<p> + * In the foregoing description, the notation <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical <i>signum</i> + * function, which is defined to return one of <tt>-1</tt>, <tt>0</tt>, or <tt>1</tt> according to whether the value of + * <i>expression</i> is negative, zero or positive.<p> * <p/> - * The implementor must ensure that <tt>sgn(compare(x, y)) == -sgn(compare(y, - * x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This implies that - * <tt>compare(x, y)</tt> must throw an exception if and only if - * <tt>compare(y, x)</tt> throws an exception.)<p> + * The implementor must ensure that <tt>sgn(compare(x, y)) == -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This + * implies that <tt>compare(x, y)</tt> must throw an exception if and only if <tt>compare(y, x)</tt> throws an exception.)<p> * <p/> - * The implementor must also ensure that the relation is transitive: - * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies - * <tt>compare(x, z)&gt;0</tt>.<p> + * The implementor must also ensure that the relation is transitive: <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, + * z)&gt;0))</tt> implies <tt>compare(x, z)&gt;0</tt>.<p> * <p/> - * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> - * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all - * <tt>z</tt>.<p> + * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> implies that <tt>sgn(compare(x, z))==sgn(compare(y, + * z))</tt> for all <tt>z</tt>.<p> * <p/> - * It is generally the case, but <i>not</i> strictly required that - * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, any - * comparator that violates this condition should clearly indicate this fact. - * The recommended language is "Note: this comparator imposes orderings that - * are inconsistent with equals." + * It is generally the case, but <i>not</i> strictly required that <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally + * speaking, any comparator that violates this condition should clearly indicate this fact. The recommended language is "Note: + * this comparator imposes orderings that are inconsistent with equals." * * @param lhs the first object to be compared. * @param rhs the second object to be compared. - * @return a negative integer, zero, or a positive integer as the first - * argument is less than, equal to, or greater than the second. - * @throws ClassCastException if the arguments' types prevent them from being - * compared by this comparator. + * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the + * second. + * @throws ClassCastException if the arguments' types prevent them from being compared by this comparator. */ public int compare(ExceptionHandler lhs, ExceptionHandler rhs) { if (lhs.getPriority() == rhs.getPriority()) { final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); if (lhsTypes.equals(rhsTypes)) { return 0; } // the right hand side is the same or a super type of left hand side // In other words lhs is a parent type and show go later in the list for (Class type : rhsTypes.getExceptionTypes()) { if (lhsTypes.containsExceptionTypeOrSuperType(type)) { return 1; } } return -1; } return rhs.getPriority() - lhs.getPriority(); } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java index ff9d5d7..775d8ab 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -1,112 +1,110 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; /** - * Finds and invokes all {@link ExceptionHandler} instants for a particular - * exception and {@link State}. <p> If any handlers are found and invoked the - * the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> + * Finds and invokes all {@link ExceptionHandler} instants for a particular exception and {@link State}. <p> If any handlers are + * found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> */ public class ExceptionHandlerExecutor { /** - * Observes the event, finds the correct exception handler(s) and invokes - * them. + * Observes the event, finds the correct exception handler(s) and invokes them. * * @param event Event Payload */ @SuppressWarnings("unchecked") public void executeHandlers(@Observes ExceptionEvent event) { final HandlerChain chain = new HandlerChainImpl(); final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); final State state = event.getState(); final BeanManager beanManager = state.getBeanManager(); final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); Throwable exception = event.getException(); MethodParameterTypeHelper methodParameterTypeHelper; Collections.sort(allHandlers, new ExceptionHandlerComparator()); do { unwrappedExceptions.push(exception); } while ((exception = exception.getCause()) != null); // Finding the correct exception handlers using reflection based on the method // to determine if it's the correct Throwable unwrapped; while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) { unwrapped = unwrappedExceptions.pop(); for (ExceptionHandler handler : allHandlers) { methodParameterTypeHelper = new MethodParameterTypeHelper(handler); if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) { handler.handle(chain, state, unwrapped); event.setExceptionHandled(true); if (((HandlerChainImpl) chain).isChainEnd()) { break; } } } } } /** * Method taken from Seam faces BeanManagerUtils. * * @param manager BeanManager instance * @return List of instantiated found by the bean manager */ @SuppressWarnings("unchecked") private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) { List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) { CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( bean); if (context != null) { result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); } } return result; } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java index 9734ea1..06a0d67 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java @@ -1,50 +1,48 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Implementation of the {@link HandlerChain} interface. Provides a package - * private method to check if the chain needs to end. + * Implementation of the {@link HandlerChain} interface. Provides a package private method to check if the chain needs to end. */ public class HandlerChainImpl implements HandlerChain { private boolean chainEnd; /** - * End execution of the chain. Calling this method will immediately stop - * executing the handler chain, leaving any handlers left in the chain as - * uncalled. + * End execution of the chain. Calling this method will immediately stop executing the handler chain, leaving any handlers left + * in the chain as uncalled. */ public void end() { this.chainEnd = true; } /** * @return flag indicating if the chain should continue execution */ boolean isChainEnd() { return this.chainEnd; } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java index cf728fc..0a77209 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java @@ -1,160 +1,157 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import java.lang.reflect.Method; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** - * Helper to encapsulate reflection code for finding parameter types on the - * handler method. + * Helper to encapsulate reflection code for finding parameter types on the handler method. */ final public class MethodParameterTypeHelper { private Set<Class> exceptionTypes; private Set<Class> stateTypes; /** * Constructor. * * @param handler Handler for which this helper is constructed */ public MethodParameterTypeHelper(ExceptionHandler handler) { final Method[] methods = handler.getClass().getMethods(); this.exceptionTypes = new HashSet<Class>(); this.stateTypes = new HashSet<Class>(); for (Method m : methods) { if ("handle".equals(m.getName())) { this.stateTypes.add(m.getParameterTypes()[1]); this.exceptionTypes.add(m.getParameterTypes()[2]); } } // Cleanup base types if needed if (this.stateTypes.size() > 1) { this.stateTypes.remove(State.class); } if (this.exceptionTypes.size() > 1) { this.exceptionTypes.remove(Throwable.class); } } /** - * @return Unmodifiable collection of exception types found in the handle - * method(s). + * @return Unmodifiable collection of exception types found in the handle method(s). */ public Collection<Class> getExceptionTypes() { return Collections.unmodifiableCollection(exceptionTypes); } /** - * @return Unmodifiable collection of exception types found in the handle - * method(s). + * @return Unmodifiable collection of exception types found in the handle method(s). */ public Collection<Class> getStateTypes() { return Collections.unmodifiableCollection(stateTypes); } /** * Looks for the given type or super types in the exception type collection. * * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ public boolean containsExceptionTypeOrSuperType(Class type) { return this.containsTypeOrSuperType(this.exceptionTypes, type); } /** * Looks for the given type or super types in the state type collection. * * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ public boolean containsStateTypeOrSuperType(Class type) { return this.containsTypeOrSuperType(this.stateTypes, type); } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MethodParameterTypeHelper that = (MethodParameterTypeHelper) o; return this.exceptionTypes.equals(that.exceptionTypes) && this.stateTypes.equals(that.stateTypes); } public int hashCode() { int result = exceptionTypes != null ? exceptionTypes.hashCode() : 5; result = 73 * result + (stateTypes != null ? stateTypes.hashCode() : 5); return result; } /** * Looks for the given type or super types in the given collection. * * @param types Collection to search * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ @SuppressWarnings("unchecked") private boolean containsTypeOrSuperType(Collection<Class> types, Class type) { if (types.contains(type)) { return true; } for (Class t : types) { if (t.isAssignableFrom(type)) { return true; } } return false; } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java index 0e826c8..d4d346e 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java @@ -1,51 +1,51 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.inject.spi.BeanManager; /** * Basic {@link State} implementation. */ public class StateImpl implements State { - private BeanManager beanManager; + private final BeanManager beanManager; /** * Constructor * * @param beanManager instance of {@link BeanManager}. */ public StateImpl(BeanManager beanManager) { this.beanManager = beanManager; } /** * @return current BeanManager. */ public BeanManager getBeanManager() { return this.beanManager; } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java index 7256018..fc1424d 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java @@ -1,54 +1,53 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; import javax.enterprise.context.RequestScoped; @RequestScoped public class ExceptionExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<Exception, State> { /** - * @return the numeric priority of this handler in relationship to other - * handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other handlers, 1 being top priority */ public int getPriority() { return 0; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ public void handle(HandlerChain chain, State state, Exception e) { super.baseHandle(chain, state, e); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java index 2bb5a67..405441a 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java @@ -1,54 +1,53 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; import javax.enterprise.context.RequestScoped; @RequestScoped public class NullPointerExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<NullPointerException, State> { /** - * @return the numeric priority of this handler in relationship to other - * handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other handlers, 1 being top priority */ public int getPriority() { return 0; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ public void handle(HandlerChain chain, State state, NullPointerException e) { super.baseHandle(chain, state, e); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java index a4f41a6..cca9d62 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java @@ -1,55 +1,54 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; import javax.enterprise.context.RequestScoped; @RequestScoped public class UnsupportedOperationExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<UnsupportedOperationException, State> { /** - * @return the numeric priority of this handler in relationship to other - * handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other handlers, 1 being top priority */ public int getPriority() { return 1; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ public void handle(HandlerChain chain, State state, UnsupportedOperationException e) { super.baseHandle(chain, state, e); } }
LightGuard/seam-exception-handling
b0471497527d7e7c9c6d6e10b0affd67293fd888
Formatting to Seam 3 format.
diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java index 80252e7..7080e12 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java @@ -1,73 +1,76 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** * Payload for an exception to be handled. */ public class ExceptionEvent { private State state; private Throwable exception; private boolean exceptionHandled; public ExceptionEvent(Throwable exception, State state) { this.exception = exception; this.state = state; this.exceptionHandled = false; } /** * @return the exception to be handled. */ public Throwable getException() { return exception; } /** - * @return State instance related to the environment. This will often need to be cast to the correct sub class. + * @return State instance related to the environment. This will often need to + * be cast to the correct sub class. */ public State getState() { return state; } /** * @return flag indicating the exception has been handled. */ public boolean isExceptionHandled() { return exceptionHandled; } /** - * This should be set if the exception has been handled in an event observer or handler. + * This should be set if the exception has been handled in an event observer + * or handler. + * * @param exceptionHandled new value */ public void setExceptionHandled(boolean exceptionHandled) { this.exceptionHandled = exceptionHandled; } } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java index 6c37e67..ffcb76f 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java @@ -1,43 +1,44 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Registers an exception handler for a specific exception and state, this - * is the main entry point for using Seam's exception handling infrastructure. + * Registers an exception handler for a specific exception and state, this is + * the main entry point for using Seam's exception handling infrastructure. */ public interface ExceptionHandler<E extends Throwable, S extends State> { /** - * @return the numeric priority of this handler in relationship to - * other handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other + * handlers, 1 being top priority */ int getPriority(); /** * Method called to execute logic for an uncaught exception. + * * @param chain Chain object used to continue handling chain * @param state container for any useful application state - * @param e uncaught exception + * @param e uncaught exception */ void handle(HandlerChain chain, S state, E e); } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java index b014d4a..3062283 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java @@ -1,36 +1,36 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Provides the developer methods to affect the traversal of the - * chain of {@link ExceptionHandler} instances. + * Provides the developer methods to affect the traversal of the chain of {@link + * ExceptionHandler} instances. */ public interface HandlerChain { /** - * End execution of the chain. - * Calling this method will immediately stop executing the handler chain, leaving any - * handlers left in the chain as uncalled. + * End execution of the chain. Calling this method will immediately stop + * executing the handler chain, leaving any handlers left in the chain as + * uncalled. */ void end(); } diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java index cfc7039..e5441bd 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java @@ -1,40 +1,42 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.inject.spi.BeanManager; /** - * The State object is meant to provide any state that may be helpful for the developer - * in determining what to do with a particular exception handling. It may include and application - * state, active processes, or other convenience methods for the {@link ExceptionHandler} - * developer. + * The State object is meant to provide any state that may be helpful for the + * developer in determining what to do with a particular exception handling. It + * may include and application state, active processes, or other convenience + * methods for the {@link ExceptionHandler} developer. * <p/> - * For example, a servlet state may include methods to retrieve the HttpServletRequest, HttpServletResponse - * and possibly a navigation convenience method. + * For example, a servlet state may include methods to retrieve the + * HttpServletRequest, HttpServletResponse and possibly a navigation convenience + * method. */ -public interface State { - /** - * @return current BeanManager. - */ - public BeanManager getBeanManager(); +public interface State +{ + /** + * @return current BeanManager. + */ + public BeanManager getBeanManager(); } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java index 14aa8c3..fc752e6 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java @@ -1,89 +1,94 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import java.util.Comparator; /** - * Comparator to sort exception handlers according to priority (highest number first) then - * by class hierarchy of the Exception types being handled (most specific first). + * Comparator to sort exception handlers according to priority (highest number + * first) then by class hierarchy of the Exception types being handled (most + * specific first). */ -public final class ExceptionHandlerComparator implements Comparator<ExceptionHandler> { - /** - * Compares its two arguments for order. Returns a negative integer, - * zero, or a positive integer as the first argument is less than, equal - * to, or greater than the second.<p> - * <p/> - * In the foregoing description, the notation - * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical - * <i>signum</i> function, which is defined to return one of <tt>-1</tt>, - * <tt>0</tt>, or <tt>1</tt> according to whether the value of - * <i>expression</i> is negative, zero or positive.<p> - * <p/> - * The implementor must ensure that <tt>sgn(compare(x, y)) == - * -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This - * implies that <tt>compare(x, y)</tt> must throw an exception if and only - * if <tt>compare(y, x)</tt> throws an exception.)<p> - * <p/> - * The implementor must also ensure that the relation is transitive: - * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies - * <tt>compare(x, z)&gt;0</tt>.<p> - * <p/> - * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> - * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all - * <tt>z</tt>.<p> - * <p/> - * It is generally the case, but <i>not</i> strictly required that - * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, - * any comparator that violates this condition should clearly indicate - * this fact. The recommended language is "Note: this comparator - * imposes orderings that are inconsistent with equals." - * - * @param lhs the first object to be compared. - * @param rhs the second object to be compared. - * @return a negative integer, zero, or a positive integer as the - * first argument is less than, equal to, or greater than the - * second. - * @throws ClassCastException if the arguments' types prevent them from - * being compared by this comparator. - */ - public int compare(ExceptionHandler lhs, ExceptionHandler rhs) { - if (lhs.getPriority() == rhs.getPriority()) { - final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); - final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); +public final class ExceptionHandlerComparator implements Comparator<ExceptionHandler> +{ + /** + * Compares its two arguments for order. Returns a negative integer, zero, + * or a positive integer as the first argument is less than, equal to, or + * greater than the second.<p> + * <p/> + * In the foregoing description, the notation <tt>sgn(</tt><i>expression</i><tt>)</tt> + * designates the mathematical <i>signum</i> function, which is defined to + * return one of <tt>-1</tt>, <tt>0</tt>, or <tt>1</tt> according to whether + * the value of <i>expression</i> is negative, zero or positive.<p> + * <p/> + * The implementor must ensure that <tt>sgn(compare(x, y)) == -sgn(compare(y, + * x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This implies that + * <tt>compare(x, y)</tt> must throw an exception if and only if + * <tt>compare(y, x)</tt> throws an exception.)<p> + * <p/> + * The implementor must also ensure that the relation is transitive: + * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies + * <tt>compare(x, z)&gt;0</tt>.<p> + * <p/> + * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> + * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all + * <tt>z</tt>.<p> + * <p/> + * It is generally the case, but <i>not</i> strictly required that + * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, any + * comparator that violates this condition should clearly indicate this fact. + * The recommended language is "Note: this comparator imposes orderings that + * are inconsistent with equals." + * + * @param lhs the first object to be compared. + * @param rhs the second object to be compared. + * @return a negative integer, zero, or a positive integer as the first + * argument is less than, equal to, or greater than the second. + * @throws ClassCastException if the arguments' types prevent them from being + * compared by this comparator. + */ + public int compare(ExceptionHandler lhs, ExceptionHandler rhs) + { + if (lhs.getPriority() == rhs.getPriority()) + { + final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); + final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); - if (lhsTypes.equals(rhsTypes)) { - return 0; + if (lhsTypes.equals(rhsTypes)) + { + return 0; + } + // the right hand side is the same or a super type of left hand side + // In other words lhs is a parent type and show go later in the list + for (Class type : rhsTypes.getExceptionTypes()) + { + if (lhsTypes.containsExceptionTypeOrSuperType(type)) + { + return 1; } - // the right hand side is the same or a super type of left hand side - // In other words lhs is a parent type and show go later in the list - for (Class type : rhsTypes.getExceptionTypes()) { - if (lhsTypes.containsExceptionTypeOrSuperType(type)) { - return 1; - } - } - return -1; - } - return rhs.getPriority() - lhs.getPriority(); - } + } + return -1; + } + return rhs.getPriority() - lhs.getPriority(); + } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java index f5cac8e..ff9d5d7 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -1,100 +1,112 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; /** - * Finds and invokes all {@link ExceptionHandler} instants for a particular exception and {@link State}. <p> If any handlers are - * found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> + * Finds and invokes all {@link ExceptionHandler} instants for a particular + * exception and {@link State}. <p> If any handlers are found and invoked the + * the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> */ -public class ExceptionHandlerExecutor { - /** - * Observes the event, finds the correct exception handler(s) and invokes them. - * - * @param event Event Payload - */ - @SuppressWarnings("unchecked") - public void executeHandlers(@Observes ExceptionEvent event) { - final HandlerChain chain = new HandlerChainImpl(); - final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); - final State state = event.getState(); - final BeanManager beanManager = state.getBeanManager(); - final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); +public class ExceptionHandlerExecutor +{ + /** + * Observes the event, finds the correct exception handler(s) and invokes + * them. + * + * @param event Event Payload + */ + @SuppressWarnings("unchecked") + public void executeHandlers(@Observes ExceptionEvent event) + { + final HandlerChain chain = new HandlerChainImpl(); + final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); + final State state = event.getState(); + final BeanManager beanManager = state.getBeanManager(); + final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); - Throwable exception = event.getException(); - MethodParameterTypeHelper methodParameterTypeHelper; + Throwable exception = event.getException(); + MethodParameterTypeHelper methodParameterTypeHelper; - Collections.sort(allHandlers, new ExceptionHandlerComparator()); + Collections.sort(allHandlers, new ExceptionHandlerComparator()); - do { - unwrappedExceptions.push(exception); - } - while ((exception = exception.getCause()) != null); + do + { + unwrappedExceptions.push(exception); + } + while ((exception = exception.getCause()) != null); - // Finding the correct exception handlers using reflection based on the method - // to determine if it's the correct - Throwable unwrapped; - while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) { - unwrapped = unwrappedExceptions.pop(); - for (ExceptionHandler handler : allHandlers) { - methodParameterTypeHelper = new MethodParameterTypeHelper(handler); + // Finding the correct exception handlers using reflection based on the method + // to determine if it's the correct + Throwable unwrapped; + while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) + { + unwrapped = unwrappedExceptions.pop(); + for (ExceptionHandler handler : allHandlers) + { + methodParameterTypeHelper = new MethodParameterTypeHelper(handler); - if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) - && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) { - handler.handle(chain, state, unwrapped); - event.setExceptionHandled(true); + if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) + && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) + { + handler.handle(chain, state, unwrapped); + event.setExceptionHandled(true); - if (((HandlerChainImpl) chain).isChainEnd()) { - break; - } - } + if (((HandlerChainImpl) chain).isChainEnd()) + { + break; + } } - } - } + } + } + } - /** - * Method taken from Seam faces BeanManagerUtils. - * - * @param manager BeanManager instance - * @return List of instantiated found by the bean manager - */ - @SuppressWarnings("unchecked") - private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) { - List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); - for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) { - CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( - bean); - if (context != null) { - result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); - } - } - return result; - } + /** + * Method taken from Seam faces BeanManagerUtils. + * + * @param manager BeanManager instance + * @return List of instantiated found by the bean manager + */ + @SuppressWarnings("unchecked") + private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) + { + List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); + for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) + { + CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( + bean); + if (context != null) + { + result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); + } + } + return result; + } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java index 73a94b5..9734ea1 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java @@ -1,48 +1,50 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** - * Implementation of the {@link HandlerChain} interface. - * Provides a package private method to check if the chain - * needs to end. + * Implementation of the {@link HandlerChain} interface. Provides a package + * private method to check if the chain needs to end. */ -public class HandlerChainImpl implements HandlerChain { - private boolean chainEnd; +public class HandlerChainImpl implements HandlerChain +{ + private boolean chainEnd; - /** - * End execution of the chain. - * Calling this method will immediately stop executing the handler chain, leaving any - * handlers left in the chain as uncalled. - */ - public void end() { - this.chainEnd = true; - } + /** + * End execution of the chain. Calling this method will immediately stop + * executing the handler chain, leaving any handlers left in the chain as + * uncalled. + */ + public void end() + { + this.chainEnd = true; + } - /** - * @return flag indicating if the chain should continue execution - */ - boolean isChainEnd() { - return this.chainEnd; - } + /** + * @return flag indicating if the chain should continue execution + */ + boolean isChainEnd() + { + return this.chainEnd; + } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java index 0a77209..cf728fc 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java @@ -1,157 +1,160 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import java.lang.reflect.Method; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** - * Helper to encapsulate reflection code for finding parameter types on the handler method. + * Helper to encapsulate reflection code for finding parameter types on the + * handler method. */ final public class MethodParameterTypeHelper { private Set<Class> exceptionTypes; private Set<Class> stateTypes; /** * Constructor. * * @param handler Handler for which this helper is constructed */ public MethodParameterTypeHelper(ExceptionHandler handler) { final Method[] methods = handler.getClass().getMethods(); this.exceptionTypes = new HashSet<Class>(); this.stateTypes = new HashSet<Class>(); for (Method m : methods) { if ("handle".equals(m.getName())) { this.stateTypes.add(m.getParameterTypes()[1]); this.exceptionTypes.add(m.getParameterTypes()[2]); } } // Cleanup base types if needed if (this.stateTypes.size() > 1) { this.stateTypes.remove(State.class); } if (this.exceptionTypes.size() > 1) { this.exceptionTypes.remove(Throwable.class); } } /** - * @return Unmodifiable collection of exception types found in the handle method(s). + * @return Unmodifiable collection of exception types found in the handle + * method(s). */ public Collection<Class> getExceptionTypes() { return Collections.unmodifiableCollection(exceptionTypes); } /** - * @return Unmodifiable collection of exception types found in the handle method(s). + * @return Unmodifiable collection of exception types found in the handle + * method(s). */ public Collection<Class> getStateTypes() { return Collections.unmodifiableCollection(stateTypes); } /** * Looks for the given type or super types in the exception type collection. * * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ public boolean containsExceptionTypeOrSuperType(Class type) { return this.containsTypeOrSuperType(this.exceptionTypes, type); } /** * Looks for the given type or super types in the state type collection. * * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ public boolean containsStateTypeOrSuperType(Class type) { return this.containsTypeOrSuperType(this.stateTypes, type); } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MethodParameterTypeHelper that = (MethodParameterTypeHelper) o; return this.exceptionTypes.equals(that.exceptionTypes) && this.stateTypes.equals(that.stateTypes); } public int hashCode() { int result = exceptionTypes != null ? exceptionTypes.hashCode() : 5; result = 73 * result + (stateTypes != null ? stateTypes.hashCode() : 5); return result; } /** * Looks for the given type or super types in the given collection. * * @param types Collection to search * @param type type (or super types of) to search for * @return flag indicating if the type or super types of that type are found */ @SuppressWarnings("unchecked") private boolean containsTypeOrSuperType(Collection<Class> types, Class type) { if (types.contains(type)) { return true; } for (Class t : types) { if (t.isAssignableFrom(type)) { return true; } } return false; } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/BaseExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/BaseExceptionHandler.java index b622b15..c5e2dd2 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/BaseExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/BaseExceptionHandler.java @@ -1,67 +1,67 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; import org.joda.time.DateTime; public class BaseExceptionHandler { protected boolean handleCalled; protected boolean callEnd; protected DateTime timeCalled; public boolean isHandleCalled() { return this.handleCalled; } public void shouldCallEnd(boolean callEnd) { this.callEnd = callEnd; } public DateTime getTimeCalled() { return this.timeCalled; } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ - public void baseHandle( HandlerChain chain, State state, Throwable e) + public void baseHandle(HandlerChain chain, State state, Throwable e) { this.timeCalled = new DateTime(); this.handleCalled = true; if (this.callEnd) { chain.end(); } } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java index e5d3d29..7256018 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/ExceptionExceptionHandler.java @@ -1,54 +1,54 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; -import javax.enterprise.context.RequestScoped; - import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; +import javax.enterprise.context.RequestScoped; + @RequestScoped public class ExceptionExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<Exception, State> { /** - * @return the numeric priority of this handler in relationship to - * other handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other + * handlers, 1 being top priority */ public int getPriority() { return 0; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ - public void handle( HandlerChain chain, State state, Exception e) + public void handle(HandlerChain chain, State state, Exception e) { super.baseHandle(chain, state, e); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/MultipleHandlerTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/MultipleHandlerTest.java index f31a2a4..421857f 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/MultipleHandlerTest.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/MultipleHandlerTest.java @@ -1,74 +1,74 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.arquillian.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.seam.exceptionhandling.ExceptionEvent; import org.jboss.seam.exceptionhandling.ExceptionHandlerExecutor; import org.jboss.seam.exceptionhandling.StateImpl; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; import org.junit.Test; import org.junit.runner.RunWith; import javax.inject.Inject; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(Arquillian.class) public class MultipleHandlerTest extends BaseExceptionHandlerTest { @Inject private UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler; @Inject private ExceptionExceptionHandler exceptionExceptionHandler; @Inject private NullPointerExceptionHandler nullPointerExceptionHandler; @Deployment public static Archive<?> createTestArchive() { return ShrinkWrap.create("test.jar", JavaArchive.class) - .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionExceptionHandler.class, - ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) - .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionExceptionHandler.class, + ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); } @Test public void testAllValidHandlersCalled() { ExceptionEvent event = new ExceptionEvent(new UnsupportedOperationException(), new StateImpl(this.beanManager)); this.beanManager.fireEvent(event); assertTrue(this.unsupportedOperationExceptionHandler.isHandleCalled()); assertTrue(this.exceptionExceptionHandler.isHandleCalled()); assertFalse(this.nullPointerExceptionHandler.isHandleCalled()); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java index 9ebd9d1..2bb5a67 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/NullPointerExceptionHandler.java @@ -1,54 +1,54 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; -import javax.enterprise.context.RequestScoped; - import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; +import javax.enterprise.context.RequestScoped; + @RequestScoped public class NullPointerExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<NullPointerException, State> { /** - * @return the numeric priority of this handler in relationship to - * other handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other + * handlers, 1 being top priority */ public int getPriority() { return 0; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ - public void handle( HandlerChain chain, State state, NullPointerException e) + public void handle(HandlerChain chain, State state, NullPointerException e) { super.baseHandle(chain, state, e); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java index fd04d61..a4f41a6 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandler.java @@ -1,55 +1,55 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; -import javax.enterprise.context.RequestScoped; - import org.jboss.seam.exceptionhandling.ExceptionHandler; import org.jboss.seam.exceptionhandling.HandlerChain; import org.jboss.seam.exceptionhandling.State; +import javax.enterprise.context.RequestScoped; + @RequestScoped public class UnsupportedOperationExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<UnsupportedOperationException, State> { /** - * @return the numeric priority of this handler in relationship to - * other handlers, 1 being top priority + * @return the numeric priority of this handler in relationship to other + * handlers, 1 being top priority */ public int getPriority() { return 1; //To change body of implemented methods use File | Settings | File Templates. } /** * Method called to execute logic for an uncaught exception. * * @param chain Chain object used to continue handling chain * @param state container for any useful application state * @param e uncaught exception */ - public void handle( HandlerChain chain, State state, UnsupportedOperationException e) + public void handle(HandlerChain chain, State state, UnsupportedOperationException e) { super.baseHandle(chain, state, e); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandlerTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandlerTest.java index b7eaf22..4c6ef16 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandlerTest.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnsupportedOperationExceptionHandlerTest.java @@ -1,67 +1,67 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.arquillian.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.seam.exceptionhandling.ExceptionEvent; import org.jboss.seam.exceptionhandling.ExceptionHandlerExecutor; import org.jboss.seam.exceptionhandling.StateImpl; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; import org.junit.Test; import org.junit.runner.RunWith; import javax.inject.Inject; import java.io.IOException; import static org.junit.Assert.assertTrue; @RunWith(Arquillian.class) public class UnsupportedOperationExceptionHandlerTest extends BaseExceptionHandlerTest { @Inject private UnsupportedOperationExceptionHandler handler; @Deployment public static Archive<?> createTestArchive() { return ShrinkWrap.create("test.jar", JavaArchive.class) - .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionHandlerExecutor.class) - .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionHandlerExecutor.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); } @Test public void testHandlerIsCalled() throws IOException { this.handler.shouldCallEnd(true); // Set so I can reuse this handler in different tests ExceptionEvent event = new ExceptionEvent(new UnsupportedOperationException(), new StateImpl(this.beanManager)); this.beanManager.fireEvent(event); assertTrue(this.handler.isHandleCalled()); assertTrue(event.isExceptionHandled()); } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java index e6eff1e..fe4bb23 100644 --- a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java @@ -1,71 +1,74 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling.test; import org.jboss.arquillian.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.seam.exceptionhandling.ExceptionEvent; import org.jboss.seam.exceptionhandling.ExceptionHandlerExecutor; import org.jboss.seam.exceptionhandling.StateImpl; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; import org.junit.Test; import org.junit.runner.RunWith; import javax.inject.Inject; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(Arquillian.class) -public class UnwrapExceptionTest extends BaseExceptionHandlerTest { - @Inject - private UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler; +public class UnwrapExceptionTest extends BaseExceptionHandlerTest +{ + @Inject + private UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler; - @Inject - private NullPointerExceptionHandler nullPointerExceptionHandler; + @Inject + private NullPointerExceptionHandler nullPointerExceptionHandler; - @Deployment - public static Archive<?> createTestArchive() { - return ShrinkWrap.create("test.jar", JavaArchive.class) - .addClasses(UnsupportedOperationExceptionHandler.class, - ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) - .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); - } + @Deployment + public static Archive<?> createTestArchive() + { + return ShrinkWrap.create("test.jar", JavaArchive.class) + .addClasses(UnsupportedOperationExceptionHandler.class, + ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + } - @Test - public void assertInnerExceptionHandledOnlyCalled() { - Exception e = new UnsupportedOperationException("test", new NullPointerException("test")); + @Test + public void assertInnerExceptionHandledOnlyCalled() + { + Exception e = new UnsupportedOperationException("test", new NullPointerException("test")); - this.nullPointerExceptionHandler.shouldCallEnd(true); + this.nullPointerExceptionHandler.shouldCallEnd(true); - ExceptionEvent event = new ExceptionEvent(e, new StateImpl(this.beanManager)); - this.beanManager.fireEvent(event); + ExceptionEvent event = new ExceptionEvent(e, new StateImpl(this.beanManager)); + this.beanManager.fireEvent(event); - assertTrue(this.nullPointerExceptionHandler.isHandleCalled()); - assertFalse(this.unsupportedOperationExceptionHandler.isHandleCalled()); + assertTrue(this.nullPointerExceptionHandler.isHandleCalled()); + assertFalse(this.unsupportedOperationExceptionHandler.isHandleCalled()); - } + } }
LightGuard/seam-exception-handling
4afaf1ff479c3b83f6bb62b105f7b2cc64090af8
Adding eclipse project generation for the build
diff --git a/.gitignore b/.gitignore index 5b1dd54..2cd61a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .gradle build *.iml *.ipr *.iws +.classpath +.project diff --git a/build.gradle b/build.gradle index 52056d5..447b3d3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,41 +1,43 @@ apply plugin: 'idea' +apply plugin: 'eclipse' library_versions = [junit: '4.8.1', cdi: '1.0-SP1', shrinkWrap: '1.0.0-alpha-2', arquillian: '1.0.0.Alpha2', weld: '1.0.1-SP1', slf4j: '1.5.8', jodaTime: '1.6', el: '2.1.2-b04'] subprojects { group = 'org.jboss.seam.exception-handling' version = '1.0.0-SNAPSHOT' archivesBaseName = 'seam-exception-handling' apply plugin: 'java' apply plugin: 'maven' apply plugin: 'idea' + apply plugin: 'eclipse' repositories { mavenRepo(urls: 'https://repository.jboss.org/nexus/content/groups/public/') } dependencies { compile "javax.enterprise:cdi-api:${library_versions.cdi}" runtime "org.jboss.weld:weld-core:${library_versions.weld}" testCompile "junit:junit:${library_versions.junit}", "org.jboss.shrinkwrap:shrinkwrap-api:${library_versions.shrinkWrap}", "org.jboss.arquillian:arquillian-junit:${library_versions.arquillian}", "org.jboss.arquillian:arquillian-api:${library_versions.arquillian}" testRuntime "org.slf4j:slf4j-simple:${library_versions.slf4j}", "org.jboss.arquillian.container:arquillian-weld-embedded:${library_versions.arquillian}" } } task wrapper(type: Wrapper) { gradleVersion = gradle.gradleVersion jarPath = 'wrapper-libs' }
LightGuard/seam-exception-handling
9f1f59a57bb1d77a5deea0dc5499194357e69c2e
Fixing typo and grammer.
diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java index c4f7d2d..cfc7039 100644 --- a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java @@ -1,41 +1,40 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.inject.spi.BeanManager; /** * The State object is meant to provide any state that may be helpful for the developer - * in determining what to do with a particular exceptionhandling. It may include and application + * in determining what to do with a particular exception handling. It may include and application * state, active processes, or other convenience methods for the {@link ExceptionHandler} * developer. - * <p> - * A servlet state may include methods to retrieve the HttpServletRequest, HttpServletResponse + * <p/> + * For example, a servlet state may include methods to retrieve the HttpServletRequest, HttpServletResponse * and possibly a navigation convenience method. */ -public interface State -{ - /** - * @return current BeanManager. - */ - public BeanManager getBeanManager(); +public interface State { + /** + * @return current BeanManager. + */ + public BeanManager getBeanManager(); }
LightGuard/seam-exception-handling
622b230c8db0656aab55d74593a19475ce7bd277
Made the Comparator final, as there's no reason to subclass it.
diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java index a791778..14aa8c3 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java @@ -1,95 +1,89 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import java.util.Comparator; /** * Comparator to sort exception handlers according to priority (highest number first) then * by class hierarchy of the Exception types being handled (most specific first). */ -public class ExceptionHandlerComparator implements Comparator<ExceptionHandler> -{ - /** - * Compares its two arguments for order. Returns a negative integer, - * zero, or a positive integer as the first argument is less than, equal - * to, or greater than the second.<p> - * <p/> - * In the foregoing description, the notation - * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical - * <i>signum</i> function, which is defined to return one of <tt>-1</tt>, - * <tt>0</tt>, or <tt>1</tt> according to whether the value of - * <i>expression</i> is negative, zero or positive.<p> - * <p/> - * The implementor must ensure that <tt>sgn(compare(x, y)) == - * -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This - * implies that <tt>compare(x, y)</tt> must throw an exception if and only - * if <tt>compare(y, x)</tt> throws an exception.)<p> - * <p/> - * The implementor must also ensure that the relation is transitive: - * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies - * <tt>compare(x, z)&gt;0</tt>.<p> - * <p/> - * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> - * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all - * <tt>z</tt>.<p> - * <p/> - * It is generally the case, but <i>not</i> strictly required that - * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, - * any comparator that violates this condition should clearly indicate - * this fact. The recommended language is "Note: this comparator - * imposes orderings that are inconsistent with equals." - * - * @param lhs the first object to be compared. - * @param rhs the second object to be compared. - * @return a negative integer, zero, or a positive integer as the - * first argument is less than, equal to, or greater than the - * second. - * @throws ClassCastException if the arguments' types prevent them from - * being compared by this comparator. - */ - public int compare(ExceptionHandler lhs, ExceptionHandler rhs) - { - if (lhs.getPriority() == rhs.getPriority()) - { - final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); - final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); +public final class ExceptionHandlerComparator implements Comparator<ExceptionHandler> { + /** + * Compares its two arguments for order. Returns a negative integer, + * zero, or a positive integer as the first argument is less than, equal + * to, or greater than the second.<p> + * <p/> + * In the foregoing description, the notation + * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical + * <i>signum</i> function, which is defined to return one of <tt>-1</tt>, + * <tt>0</tt>, or <tt>1</tt> according to whether the value of + * <i>expression</i> is negative, zero or positive.<p> + * <p/> + * The implementor must ensure that <tt>sgn(compare(x, y)) == + * -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This + * implies that <tt>compare(x, y)</tt> must throw an exception if and only + * if <tt>compare(y, x)</tt> throws an exception.)<p> + * <p/> + * The implementor must also ensure that the relation is transitive: + * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies + * <tt>compare(x, z)&gt;0</tt>.<p> + * <p/> + * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> + * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all + * <tt>z</tt>.<p> + * <p/> + * It is generally the case, but <i>not</i> strictly required that + * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, + * any comparator that violates this condition should clearly indicate + * this fact. The recommended language is "Note: this comparator + * imposes orderings that are inconsistent with equals." + * + * @param lhs the first object to be compared. + * @param rhs the second object to be compared. + * @return a negative integer, zero, or a positive integer as the + * first argument is less than, equal to, or greater than the + * second. + * @throws ClassCastException if the arguments' types prevent them from + * being compared by this comparator. + */ + public int compare(ExceptionHandler lhs, ExceptionHandler rhs) { + if (lhs.getPriority() == rhs.getPriority()) { + final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); + final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); - if (lhsTypes.equals(rhsTypes)) - { - return 0; - } - // the right hand side is the same or a super type of left hand side - // In other words lhs is a parent type and show go later in the list - for (Class type : rhsTypes.getExceptionTypes()) - { - if (lhsTypes.containsExceptionTypeOrSuperType(type)) - { - return 1; + if (lhsTypes.equals(rhsTypes)) { + return 0; } - } - return -1; - } - return rhs.getPriority() - lhs.getPriority(); - } + // the right hand side is the same or a super type of left hand side + // In other words lhs is a parent type and show go later in the list + for (Class type : rhsTypes.getExceptionTypes()) { + if (lhsTypes.containsExceptionTypeOrSuperType(type)) { + return 1; + } + } + return -1; + } + return rhs.getPriority() - lhs.getPriority(); + } }
LightGuard/seam-exception-handling
80d40b414bbbd2fe085bce1c5998ab8d9731c368
Adding test for unwrapping an exception.
diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java index c3bd513..f5cac8e 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -1,111 +1,100 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Stack; /** - * Finds and invokes all {@link ExceptionHandler} instants for a particular - * exception and {@link State}. - * <p> - * If any handlers are found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. - * </p> + * Finds and invokes all {@link ExceptionHandler} instants for a particular exception and {@link State}. <p> If any handlers are + * found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. </p> */ -public class ExceptionHandlerExecutor -{ - /** - * Observes the event, finds the correct exception handler(s) and invokes them. - * - * @param event Event Payload - */ - @SuppressWarnings("unchecked") - public void executeHandlers(@Observes ExceptionEvent event) - { - final HandlerChain chain = new HandlerChainImpl(); - final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); - final State state = event.getState(); - final BeanManager beanManager = state.getBeanManager(); - final Set<ExceptionHandler> validHandlers = new TreeSet<ExceptionHandler>(new ExceptionHandlerComparator()); - final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); +public class ExceptionHandlerExecutor { + /** + * Observes the event, finds the correct exception handler(s) and invokes them. + * + * @param event Event Payload + */ + @SuppressWarnings("unchecked") + public void executeHandlers(@Observes ExceptionEvent event) { + final HandlerChain chain = new HandlerChainImpl(); + final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); + final State state = event.getState(); + final BeanManager beanManager = state.getBeanManager(); + final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); - Throwable exception = event.getException(); - MethodParameterTypeHelper methodParameterTypeHelper; + Throwable exception = event.getException(); + MethodParameterTypeHelper methodParameterTypeHelper; - do - { - unwrappedExceptions.push(exception); - } - while ((exception = exception.getCause()) != null); + Collections.sort(allHandlers, new ExceptionHandlerComparator()); - // Finding the correct exception handlers using reflection based on the method - // to determine if it's the correct - for (ExceptionHandler handler : allHandlers) - { - methodParameterTypeHelper = new MethodParameterTypeHelper(handler); + do { + unwrappedExceptions.push(exception); + } + while ((exception = exception.getCause()) != null); - for (Throwable unwrapped : unwrappedExceptions) - { - if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) - && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) - { - validHandlers.add(handler); - } - } - } + // Finding the correct exception handlers using reflection based on the method + // to determine if it's the correct + Throwable unwrapped; + while (!unwrappedExceptions.isEmpty() && !((HandlerChainImpl) chain).isChainEnd()) { + unwrapped = unwrappedExceptions.pop(); + for (ExceptionHandler handler : allHandlers) { + methodParameterTypeHelper = new MethodParameterTypeHelper(handler); - for (ExceptionHandler exceptionHandler : validHandlers) - { - exceptionHandler.handle(chain, state, exception); - event.setExceptionHandled(true); + if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) + && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) { + handler.handle(chain, state, unwrapped); + event.setExceptionHandled(true); - if (((HandlerChainImpl) chain).isChainEnd()) - { - break; - } - } - } + if (((HandlerChainImpl) chain).isChainEnd()) { + break; + } + } + } + } + } - /** - * Method taken from Seam faces BeanManagerUtils. - * - * @param manager BeanManager instance - * @return List of instantiated found by the bean manager - */ - @SuppressWarnings("unchecked") - private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) - { - List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); - for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) - { - CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext(bean); - if (context != null) - { - result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); - } - } - return result; - } + /** + * Method taken from Seam faces BeanManagerUtils. + * + * @param manager BeanManager instance + * @return List of instantiated found by the bean manager + */ + @SuppressWarnings("unchecked") + private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) { + List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); + for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) { + CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext( + bean); + if (context != null) { + result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); + } + } + return result; + } } diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java index 1da7e38..73a94b5 100644 --- a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java @@ -1,51 +1,48 @@ /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.exceptionhandling; /** * Implementation of the {@link HandlerChain} interface. * Provides a package private method to check if the chain * needs to end. */ -public class HandlerChainImpl implements HandlerChain -{ - private boolean chainEnd; +public class HandlerChainImpl implements HandlerChain { + private boolean chainEnd; - /** - * End execution of the chain. - * Calling this method will immediately stop executing the handler chain, leaving any - * handlers left in the chain as uncalled. - */ - public void end() - { - this.chainEnd = false; - } + /** + * End execution of the chain. + * Calling this method will immediately stop executing the handler chain, leaving any + * handlers left in the chain as uncalled. + */ + public void end() { + this.chainEnd = true; + } - /** - * @return flag indicating if the chain should continue execution - */ - boolean isChainEnd() - { - return this.chainEnd; - } + /** + * @return flag indicating if the chain should continue execution + */ + boolean isChainEnd() { + return this.chainEnd; + } } diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java new file mode 100644 index 0000000..6ef55bb --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/test/UnwrapExceptionTest.java @@ -0,0 +1,71 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.seam.exceptionhandling.test; + +import org.jboss.arquillian.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.seam.exceptionhandling.ExceptionEvent; +import org.jboss.seam.exceptionhandling.ExceptionHandlerExecutor; +import org.jboss.seam.exceptionhandling.StateImpl; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ArchivePaths; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RunWith(Arquillian.class) +public class UnwrapExceptionTest extends BaseExceptionHandlerTest { + @Inject + private UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler; + + @Inject + private NullPointerExceptionHandler nullPointerExceptionHandler; + + @Deployment + public static Archive<?> createTestArchive() { + return ShrinkWrap.create("test.jar", JavaArchive.class) + .addClasses(UnsupportedOperationExceptionHandler.class, + ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + } + + @Test + public void assertInnerExceptionHandledFirst() { + Exception e = new UnsupportedOperationException("test", new NullPointerException("test")); + + this.nullPointerExceptionHandler.shouldCallEnd(true); + + ExceptionEvent event = new ExceptionEvent(e, new StateImpl(this.beanManager)); + this.beanManager.fireEvent(event); + + assertTrue(this.nullPointerExceptionHandler.isHandleCalled()); + assertFalse(this.unsupportedOperationExceptionHandler.isHandleCalled()); + + } +}
LightGuard/seam-exception-handling
d66f73d64938cd2e73381fde55dd2dc7ba7dc3d6
Gradle can now generate the IDEA project
diff --git a/.gitignore b/.gitignore index 69c390d..5b1dd54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .gradle build *.iml *.ipr +*.iws diff --git a/build.gradle b/build.gradle index 450fd35..52056d5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,38 +1,41 @@ +apply plugin: 'idea' + library_versions = [junit: '4.8.1', cdi: '1.0-SP1', shrinkWrap: '1.0.0-alpha-2', arquillian: '1.0.0.Alpha2', weld: '1.0.1-SP1', slf4j: '1.5.8', jodaTime: '1.6', el: '2.1.2-b04'] -allprojects { +subprojects { group = 'org.jboss.seam.exception-handling' version = '1.0.0-SNAPSHOT' archivesBaseName = 'seam-exception-handling' apply plugin: 'java' apply plugin: 'maven' + apply plugin: 'idea' repositories { mavenRepo(urls: 'https://repository.jboss.org/nexus/content/groups/public/') } dependencies { compile "javax.enterprise:cdi-api:${library_versions.cdi}" runtime "org.jboss.weld:weld-core:${library_versions.weld}" testCompile "junit:junit:${library_versions.junit}", "org.jboss.shrinkwrap:shrinkwrap-api:${library_versions.shrinkWrap}", "org.jboss.arquillian:arquillian-junit:${library_versions.arquillian}", "org.jboss.arquillian:arquillian-api:${library_versions.arquillian}" testRuntime "org.slf4j:slf4j-simple:${library_versions.slf4j}", "org.jboss.arquillian.container:arquillian-weld-embedded:${library_versions.arquillian}" } } task wrapper(type: Wrapper) { gradleVersion = gradle.gradleVersion jarPath = 'wrapper-libs' }
LightGuard/seam-exception-handling
cbecd428c01da8fae601b3132a39beffc3c3c381
Adding Gradle Wrapper
diff --git a/build.gradle b/build.gradle index b158b3b..450fd35 100644 --- a/build.gradle +++ b/build.gradle @@ -1,33 +1,38 @@ - library_versions = [junit: '4.8.1', cdi: '1.0-SP1', shrinkWrap: '1.0.0-alpha-2', arquillian: '1.0.0.Alpha2', weld: '1.0.1-SP1', slf4j: '1.5.8', jodaTime: '1.6', el: '2.1.2-b04'] allprojects { group = 'org.jboss.seam.exception-handling' version = '1.0.0-SNAPSHOT' archivesBaseName = 'seam-exception-handling' apply plugin: 'java' apply plugin: 'maven' repositories { mavenRepo(urls: 'https://repository.jboss.org/nexus/content/groups/public/') } dependencies { compile "javax.enterprise:cdi-api:${library_versions.cdi}" runtime "org.jboss.weld:weld-core:${library_versions.weld}" testCompile "junit:junit:${library_versions.junit}", "org.jboss.shrinkwrap:shrinkwrap-api:${library_versions.shrinkWrap}", "org.jboss.arquillian:arquillian-junit:${library_versions.arquillian}", "org.jboss.arquillian:arquillian-api:${library_versions.arquillian}" testRuntime "org.slf4j:slf4j-simple:${library_versions.slf4j}", "org.jboss.arquillian.container:arquillian-weld-embedded:${library_versions.arquillian}" } } + +task wrapper(type: Wrapper) { + gradleVersion = gradle.gradleVersion + jarPath = 'wrapper-libs' +} + diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..fa6bc9c --- /dev/null +++ b/gradlew @@ -0,0 +1,142 @@ +#!/bin/bash + +############################################################################## +## ## +## Gradle wrapper script for UN*X ## +## ## +############################################################################## + +# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. +# GRADLE_OPTS="$GRADLE_OPTS -Xmx512" +# JAVA_OPTS="$JAVA_OPTS -Xmx512" + +GRADLE_APP_NAME=Gradle + +warn ( ) { + echo "${PROGNAME}: $*" +} + +die ( ) { + warn "$*" + exit 1 +} + + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set JAVA_HOME if it's not already set. +if [ -z "$JAVA_HOME" ] ; then + if $darwin ; then + [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home" + [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home" + else + javaExecutable="`which javac`" + [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME." + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME." + javaExecutable="`readlink -f \"$javaExecutable\"`" + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + export JAVA_HOME="$javaHome" + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"` + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain +CLASSPATH=`dirname "$0"`/wrapper-libs/gradle-wrapper.jar +WRAPPER_PROPERTIES=`dirname "$0"`/wrapper-libs/gradle-wrapper.properties +# Determine the Java command to use to start the JVM. +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="java" + fi +fi +if [ ! -x "$JAVACMD" ] ; then + die "JAVA_HOME is not defined correctly, can not execute: $JAVACMD" +fi +if [ -z "$JAVA_HOME" ] ; then + warn "JAVA_HOME environment variable is not set" +fi + +# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name +if $darwin; then + JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME" +# we may also want to set -Xdock:image +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +"$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \ + -classpath "$CLASSPATH" \ + -Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \ + $STARTER_MAIN_CLASS \ + "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..c981193 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,126 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem ## +@rem Gradle startup script for Windows ## +@rem ## +@rem ########################################################################## + +@rem +@rem $Revision: 10602 $ $Date: 2008-01-25 02:49:54 +0100 (ven., 25 janv. 2008) $ +@rem + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. +@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512 +@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512 + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=.\ + +@rem Determine the command interpreter to execute the "CD" later +set COMMAND_COM="cmd.exe" +if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe" +if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com" + +@rem Use explicit find.exe to prevent cygwin and others find.exe from being used +set FIND_EXE="find.exe" +if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe" +if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe" + +:check_JAVA_HOME +@rem Make sure we have a valid JAVA_HOME +if not "%JAVA_HOME%" == "" goto have_JAVA_HOME + +echo. +echo ERROR: Environment variable JAVA_HOME has not been set. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. +echo. +goto end + +:have_JAVA_HOME +@rem Validate JAVA_HOME +%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul +if not errorlevel 1 goto init + +echo. +echo ERROR: JAVA_HOME might be set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation if there are problems. +echo. + +:init +@rem get name of script to launch with full path +@rem Get command-line arguments, handling Windowz variants +SET _marker=%JAVA_HOME: =% +@rem IF NOT "%_marker%" == "%JAVA_HOME%" ECHO JAVA_HOME "%JAVA_HOME%" contains spaces. Please change to a location without spaces if this causes problems. + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%eval[2+2]" == "4" goto 4NT_args + +IF "%_marker%" == "%JAVA_HOME%" goto :win9xME_args + +set _FIXPATH= +call :fixpath "%JAVA_HOME%" +set JAVA_HOME=%_FIXPATH:~1% + +goto win9xME_args + +:fixpath +if not %1.==. ( +for /f "tokens=1* delims=;" %%a in (%1) do ( +call :shortfilename "%%a" & call :fixpath "%%b" +) +) +goto :EOF +:shortfilename +for %%i in (%1) do set _FIXPATH=%_FIXPATH%;%%~fsi +goto :EOF + + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain +set CLASSPATH=%DIRNAME%\wrapper-libs\gradle-wrapper.jar +set WRAPPER_PROPERTIES=%DIRNAME%\wrapper-libs\gradle-wrapper.properties +set JAVA_EXE=%JAVA_HOME%\bin\java.exe + +set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%" + +"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 + +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%" +exit /b "%ERRORLEVEL%" + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega \ No newline at end of file diff --git a/wrapper-libs/gradle-wrapper.jar b/wrapper-libs/gradle-wrapper.jar new file mode 100644 index 0000000..e557025 Binary files /dev/null and b/wrapper-libs/gradle-wrapper.jar differ diff --git a/wrapper-libs/gradle-wrapper.properties b/wrapper-libs/gradle-wrapper.properties new file mode 100644 index 0000000..888da26 --- /dev/null +++ b/wrapper-libs/gradle-wrapper.properties @@ -0,0 +1,9 @@ +#Sun Jul 18 00:00:17 MDT 2010 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +distributionVersion=0.9-20100717090357-0600 +zipStorePath=wrapper/dists +urlRoot=http\://dist.codehaus.org/gradle +distributionName=gradle +distributionClassifier=bin
LightGuard/seam-exception-handling
69179379f6dd7d8ab3fc4abf9f07c98947606997
Adding IDEA excludes
diff --git a/.gitignore b/.gitignore index f8b92c3..69c390d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .gradle build +*.iml +*.ipr
LightGuard/seam-exception-handling
8043f943b3d36e4081950b454aa3e0507b6391de
Build setup.
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8b92c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.gradle +build diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b158b3b --- /dev/null +++ b/build.gradle @@ -0,0 +1,33 @@ + +library_versions = [junit: '4.8.1', cdi: '1.0-SP1', shrinkWrap: '1.0.0-alpha-2', + arquillian: '1.0.0.Alpha2', weld: '1.0.1-SP1', slf4j: '1.5.8', + jodaTime: '1.6', el: '2.1.2-b04'] + + +allprojects { + group = 'org.jboss.seam.exception-handling' + version = '1.0.0-SNAPSHOT' + archivesBaseName = 'seam-exception-handling' + + apply plugin: 'java' + apply plugin: 'maven' + + repositories { + mavenRepo(urls: 'https://repository.jboss.org/nexus/content/groups/public/') + } + + dependencies { + compile "javax.enterprise:cdi-api:${library_versions.cdi}" + + runtime "org.jboss.weld:weld-core:${library_versions.weld}" + + testCompile "junit:junit:${library_versions.junit}", + "org.jboss.shrinkwrap:shrinkwrap-api:${library_versions.shrinkWrap}", + "org.jboss.arquillian:arquillian-junit:${library_versions.arquillian}", + "org.jboss.arquillian:arquillian-api:${library_versions.arquillian}" + + testRuntime "org.slf4j:slf4j-simple:${library_versions.slf4j}", + "org.jboss.arquillian.container:arquillian-weld-embedded:${library_versions.arquillian}" + + } +} diff --git a/impl/build.gradle b/impl/build.gradle new file mode 100644 index 0000000..35edb34 --- /dev/null +++ b/impl/build.gradle @@ -0,0 +1,6 @@ +dependencies { + compile project(':api'), + "joda-time:joda-time:${library_versions.jodaTime}" + + testRuntime "org.glassfish.web:el-impl:${library_versions.el}" +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..4f78e26 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,4 @@ +include 'api' +include 'impl' + +rootProject.name = 'seam-execption-handling'
LightGuard/seam-exception-handling
d4084a8069f48e8b6d8fb557a386eace12fad0e9
Adding source
diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java new file mode 100644 index 0000000..80252e7 --- /dev/null +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionEvent.java @@ -0,0 +1,73 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +/** + * Payload for an exception to be handled. + */ +public class ExceptionEvent +{ + private State state; + private Throwable exception; + private boolean exceptionHandled; + + public ExceptionEvent(Throwable exception, State state) + { + this.exception = exception; + this.state = state; + this.exceptionHandled = false; + } + + /** + * @return the exception to be handled. + */ + public Throwable getException() + { + return exception; + } + + /** + * @return State instance related to the environment. This will often need to be cast to the correct sub class. + */ + public State getState() + { + return state; + } + + /** + * @return flag indicating the exception has been handled. + */ + public boolean isExceptionHandled() + { + return exceptionHandled; + } + + /** + * This should be set if the exception has been handled in an event observer or handler. + * @param exceptionHandled new value + */ + public void setExceptionHandled(boolean exceptionHandled) + { + this.exceptionHandled = exceptionHandled; + } +} diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java new file mode 100644 index 0000000..6c37e67 --- /dev/null +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandler.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.seam.exceptionhandling; + +/** + * Registers an exception handler for a specific exception and state, this + * is the main entry point for using Seam's exception handling infrastructure. + */ +public interface ExceptionHandler<E extends Throwable, S extends State> +{ + /** + * @return the numeric priority of this handler in relationship to + * other handlers, 1 being top priority + */ + int getPriority(); + + /** + * Method called to execute logic for an uncaught exception. + * @param chain Chain object used to continue handling chain + * @param state container for any useful application state + * @param e uncaught exception + */ + void handle(HandlerChain chain, S state, E e); +} diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java new file mode 100644 index 0000000..b014d4a --- /dev/null +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/HandlerChain.java @@ -0,0 +1,36 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.seam.exceptionhandling; + +/** + * Provides the developer methods to affect the traversal of the + * chain of {@link ExceptionHandler} instances. + */ +public interface HandlerChain +{ + /** + * End execution of the chain. + * Calling this method will immediately stop executing the handler chain, leaving any + * handlers left in the chain as uncalled. + */ + void end(); +} diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/State.java b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java new file mode 100644 index 0000000..c4f7d2d --- /dev/null +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/State.java @@ -0,0 +1,41 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.inject.spi.BeanManager; + +/** + * The State object is meant to provide any state that may be helpful for the developer + * in determining what to do with a particular exceptionhandling. It may include and application + * state, active processes, or other convenience methods for the {@link ExceptionHandler} + * developer. + * <p> + * A servlet state may include methods to retrieve the HttpServletRequest, HttpServletResponse + * and possibly a navigation convenience method. + */ +public interface State +{ + /** + * @return current BeanManager. + */ + public BeanManager getBeanManager(); +} diff --git a/api/src/main/java/org/jboss/seam/exceptionhandling/package-info.java b/api/src/main/java/org/jboss/seam/exceptionhandling/package-info.java new file mode 100644 index 0000000..5e0b4d4 --- /dev/null +++ b/api/src/main/java/org/jboss/seam/exceptionhandling/package-info.java @@ -0,0 +1,26 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +/** + * An extensible exception handling handling framework. + */ +package org.jboss.seam.exceptionhandling; diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java new file mode 100644 index 0000000..a791778 --- /dev/null +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparator.java @@ -0,0 +1,95 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import java.util.Comparator; + +/** + * Comparator to sort exception handlers according to priority (highest number first) then + * by class hierarchy of the Exception types being handled (most specific first). + */ +public class ExceptionHandlerComparator implements Comparator<ExceptionHandler> +{ + /** + * Compares its two arguments for order. Returns a negative integer, + * zero, or a positive integer as the first argument is less than, equal + * to, or greater than the second.<p> + * <p/> + * In the foregoing description, the notation + * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical + * <i>signum</i> function, which is defined to return one of <tt>-1</tt>, + * <tt>0</tt>, or <tt>1</tt> according to whether the value of + * <i>expression</i> is negative, zero or positive.<p> + * <p/> + * The implementor must ensure that <tt>sgn(compare(x, y)) == + * -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This + * implies that <tt>compare(x, y)</tt> must throw an exception if and only + * if <tt>compare(y, x)</tt> throws an exception.)<p> + * <p/> + * The implementor must also ensure that the relation is transitive: + * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies + * <tt>compare(x, z)&gt;0</tt>.<p> + * <p/> + * Finally, the implementor must ensure that <tt>compare(x, y)==0</tt> + * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all + * <tt>z</tt>.<p> + * <p/> + * It is generally the case, but <i>not</i> strictly required that + * <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking, + * any comparator that violates this condition should clearly indicate + * this fact. The recommended language is "Note: this comparator + * imposes orderings that are inconsistent with equals." + * + * @param lhs the first object to be compared. + * @param rhs the second object to be compared. + * @return a negative integer, zero, or a positive integer as the + * first argument is less than, equal to, or greater than the + * second. + * @throws ClassCastException if the arguments' types prevent them from + * being compared by this comparator. + */ + public int compare(ExceptionHandler lhs, ExceptionHandler rhs) + { + if (lhs.getPriority() == rhs.getPriority()) + { + final MethodParameterTypeHelper lhsTypes = new MethodParameterTypeHelper(lhs); + final MethodParameterTypeHelper rhsTypes = new MethodParameterTypeHelper(rhs); + + if (lhsTypes.equals(rhsTypes)) + { + return 0; + } + // the right hand side is the same or a super type of left hand side + // In other words lhs is a parent type and show go later in the list + for (Class type : rhsTypes.getExceptionTypes()) + { + if (lhsTypes.containsExceptionTypeOrSuperType(type)) + { + return 1; + } + } + return -1; + } + return rhs.getPriority() - lhs.getPriority(); + } +} diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java new file mode 100644 index 0000000..c3bd513 --- /dev/null +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/ExceptionHandlerExecutor.java @@ -0,0 +1,111 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.event.Observes; +import javax.enterprise.inject.spi.Bean; +import javax.enterprise.inject.spi.BeanManager; +import java.util.*; + +/** + * Finds and invokes all {@link ExceptionHandler} instants for a particular + * exception and {@link State}. + * <p> + * If any handlers are found and invoked the the {@link ExceptionEvent#setExceptionHandled(boolean)} is set to true. + * </p> + */ +public class ExceptionHandlerExecutor +{ + /** + * Observes the event, finds the correct exception handler(s) and invokes them. + * + * @param event Event Payload + */ + @SuppressWarnings("unchecked") + public void executeHandlers(@Observes ExceptionEvent event) + { + final HandlerChain chain = new HandlerChainImpl(); + final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>(); + final State state = event.getState(); + final BeanManager beanManager = state.getBeanManager(); + final Set<ExceptionHandler> validHandlers = new TreeSet<ExceptionHandler>(new ExceptionHandlerComparator()); + final List<ExceptionHandler> allHandlers = this.getContextualExceptionHandlerInstances(beanManager); + + Throwable exception = event.getException(); + MethodParameterTypeHelper methodParameterTypeHelper; + + do + { + unwrappedExceptions.push(exception); + } + while ((exception = exception.getCause()) != null); + + // Finding the correct exception handlers using reflection based on the method + // to determine if it's the correct + for (ExceptionHandler handler : allHandlers) + { + methodParameterTypeHelper = new MethodParameterTypeHelper(handler); + + for (Throwable unwrapped : unwrappedExceptions) + { + if (methodParameterTypeHelper.containsExceptionTypeOrSuperType(unwrapped.getClass()) + && methodParameterTypeHelper.containsStateTypeOrSuperType(state.getClass())) + { + validHandlers.add(handler); + } + } + } + + for (ExceptionHandler exceptionHandler : validHandlers) + { + exceptionHandler.handle(chain, state, exception); + event.setExceptionHandled(true); + + if (((HandlerChainImpl) chain).isChainEnd()) + { + break; + } + } + } + + /** + * Method taken from Seam faces BeanManagerUtils. + * + * @param manager BeanManager instance + * @return List of instantiated found by the bean manager + */ + @SuppressWarnings("unchecked") + private List<ExceptionHandler> getContextualExceptionHandlerInstances(BeanManager manager) + { + List<ExceptionHandler> result = new ArrayList<ExceptionHandler>(); + for (Bean<?> bean : manager.getBeans(ExceptionHandler.class)) + { + CreationalContext<ExceptionHandler> context = (CreationalContext<ExceptionHandler>) manager.createCreationalContext(bean); + if (context != null) + { + result.add((ExceptionHandler) manager.getReference(bean, ExceptionHandler.class, context)); + } + } + return result; + } +} diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java new file mode 100644 index 0000000..1da7e38 --- /dev/null +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/HandlerChainImpl.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +/** + * Implementation of the {@link HandlerChain} interface. + * Provides a package private method to check if the chain + * needs to end. + */ +public class HandlerChainImpl implements HandlerChain +{ + private boolean chainEnd; + + /** + * End execution of the chain. + * Calling this method will immediately stop executing the handler chain, leaving any + * handlers left in the chain as uncalled. + */ + public void end() + { + this.chainEnd = false; + } + + /** + * @return flag indicating if the chain should continue execution + */ + boolean isChainEnd() + { + return this.chainEnd; + } +} diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java new file mode 100644 index 0000000..0a77209 --- /dev/null +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/MethodParameterTypeHelper.java @@ -0,0 +1,157 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * Helper to encapsulate reflection code for finding parameter types on the handler method. + */ +final public class MethodParameterTypeHelper +{ + private Set<Class> exceptionTypes; + private Set<Class> stateTypes; + + /** + * Constructor. + * + * @param handler Handler for which this helper is constructed + */ + public MethodParameterTypeHelper(ExceptionHandler handler) + { + final Method[] methods = handler.getClass().getMethods(); + this.exceptionTypes = new HashSet<Class>(); + this.stateTypes = new HashSet<Class>(); + + for (Method m : methods) + { + if ("handle".equals(m.getName())) + { + this.stateTypes.add(m.getParameterTypes()[1]); + this.exceptionTypes.add(m.getParameterTypes()[2]); + } + } + + // Cleanup base types if needed + if (this.stateTypes.size() > 1) + { + this.stateTypes.remove(State.class); + } + + if (this.exceptionTypes.size() > 1) + { + this.exceptionTypes.remove(Throwable.class); + } + } + + /** + * @return Unmodifiable collection of exception types found in the handle method(s). + */ + public Collection<Class> getExceptionTypes() + { + return Collections.unmodifiableCollection(exceptionTypes); + } + + /** + * @return Unmodifiable collection of exception types found in the handle method(s). + */ + public Collection<Class> getStateTypes() + { + return Collections.unmodifiableCollection(stateTypes); + } + + /** + * Looks for the given type or super types in the exception type collection. + * + * @param type type (or super types of) to search for + * @return flag indicating if the type or super types of that type are found + */ + public boolean containsExceptionTypeOrSuperType(Class type) + { + return this.containsTypeOrSuperType(this.exceptionTypes, type); + } + + /** + * Looks for the given type or super types in the state type collection. + * + * @param type type (or super types of) to search for + * @return flag indicating if the type or super types of that type are found + */ + public boolean containsStateTypeOrSuperType(Class type) + { + return this.containsTypeOrSuperType(this.stateTypes, type); + } + + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + MethodParameterTypeHelper that = (MethodParameterTypeHelper) o; + + return this.exceptionTypes.equals(that.exceptionTypes) && this.stateTypes.equals(that.stateTypes); + } + + public int hashCode() + { + int result = exceptionTypes != null ? exceptionTypes.hashCode() : 5; + result = 73 * result + (stateTypes != null ? stateTypes.hashCode() : 5); + return result; + } + + /** + * Looks for the given type or super types in the given collection. + * + * @param types Collection to search + * @param type type (or super types of) to search for + * @return flag indicating if the type or super types of that type are found + */ + @SuppressWarnings("unchecked") + private boolean containsTypeOrSuperType(Collection<Class> types, Class type) + { + if (types.contains(type)) + { + return true; + } + + for (Class t : types) + { + if (t.isAssignableFrom(type)) + { + return true; + } + } + + return false; + } +} diff --git a/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java b/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java new file mode 100644 index 0000000..0e826c8 --- /dev/null +++ b/impl/src/main/java/org/jboss/seam/exceptionhandling/StateImpl.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.inject.spi.BeanManager; + +/** + * Basic {@link State} implementation. + */ +public class StateImpl implements State +{ + private BeanManager beanManager; + + /** + * Constructor + * + * @param beanManager instance of {@link BeanManager}. + */ + public StateImpl(BeanManager beanManager) + { + this.beanManager = beanManager; + } + + /** + * @return current BeanManager. + */ + public BeanManager getBeanManager() + { + return this.beanManager; + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandler.java new file mode 100644 index 0000000..ec3e7c8 --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandler.java @@ -0,0 +1,65 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import org.joda.time.DateTime; + +public class BaseExceptionHandler +{ + protected boolean handleCalled; + protected boolean callEnd; + protected DateTime timeCalled; + + public boolean isHandleCalled() + { + return this.handleCalled; + } + + public void shouldCallEnd(boolean callEnd) + { + this.callEnd = callEnd; + } + + public DateTime getTimeCalled() + { + return this.timeCalled; + } + + /** + * Method called to execute logic for an uncaught exception. + * + * @param chain Chain object used to continue handling chain + * @param state container for any useful application state + * @param e uncaught exception + */ + public void baseHandle(HandlerChain chain, State state, Throwable e) + { + this.timeCalled = new DateTime(); + this.handleCalled = true; + + if (this.callEnd) + { + chain.end(); + } + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandlerTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandlerTest.java new file mode 100644 index 0000000..7eb7123 --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/BaseExceptionHandlerTest.java @@ -0,0 +1,32 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.inject.spi.BeanManager; +import javax.inject.Inject; + +public abstract class BaseExceptionHandlerTest +{ + @Inject + protected BeanManager beanManager; +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionExceptionHandler.java new file mode 100644 index 0000000..0f27af1 --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionExceptionHandler.java @@ -0,0 +1,50 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.context.RequestScoped; + +@RequestScoped +public class ExceptionExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<Exception, State> +{ + /** + * @return the numeric priority of this handler in relationship to + * other handlers, 1 being top priority + */ + public int getPriority() + { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + /** + * Method called to execute logic for an uncaught exception. + * + * @param chain Chain object used to continue handling chain + * @param state container for any useful application state + * @param e uncaught exception + */ + public void handle(HandlerChain chain, State state, Exception e) + { + super.baseHandle(chain, state, e); + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparatorTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparatorTest.java new file mode 100644 index 0000000..59d0eb1 --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/ExceptionHandlerComparatorTest.java @@ -0,0 +1,66 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class ExceptionHandlerComparatorTest +{ + @Test + public void testHandlersCalledInCorrectOrder() + { + NullPointerExceptionHandler nullPointerExceptionHandler = new NullPointerExceptionHandler(); + ExceptionExceptionHandler exceptionExceptionHandler = new ExceptionExceptionHandler(); + UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler = new UnsupportedOperationExceptionHandler(); + List<? extends ExceptionHandler<? extends Exception, State>> handlerList; + handlerList = Arrays.asList(nullPointerExceptionHandler, exceptionExceptionHandler, unsupportedOperationExceptionHandler); + + Collections.sort(handlerList, new ExceptionHandlerComparator()); + + assertEquals(unsupportedOperationExceptionHandler, handlerList.get(0)); + assertEquals(nullPointerExceptionHandler, handlerList.get(1)); + assertEquals(exceptionExceptionHandler, handlerList.get(2)); + } + + @Test + public void testHandlersCalledInCorrectOrder2() + { + NullPointerExceptionHandler nullPointerExceptionHandler = new NullPointerExceptionHandler(); + ExceptionExceptionHandler exceptionExceptionHandler = new ExceptionExceptionHandler(); + UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler = new UnsupportedOperationExceptionHandler(); + List<? extends ExceptionHandler<? extends Exception, State>> handlerList; + handlerList = Arrays.asList(unsupportedOperationExceptionHandler, exceptionExceptionHandler, nullPointerExceptionHandler); + + Collections.sort(handlerList, new ExceptionHandlerComparator()); + + assertEquals(unsupportedOperationExceptionHandler, handlerList.get(0)); + assertEquals(nullPointerExceptionHandler, handlerList.get(1)); + assertEquals(exceptionExceptionHandler, handlerList.get(2)); + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/MultipleHandlerTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/MultipleHandlerTest.java new file mode 100644 index 0000000..1f2b1de --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/MultipleHandlerTest.java @@ -0,0 +1,71 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import org.jboss.arquillian.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ArchivePaths; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RunWith(Arquillian.class) +public class MultipleHandlerTest extends BaseExceptionHandlerTest +{ + @Inject + private UnsupportedOperationExceptionHandler unsupportedOperationExceptionHandler; + + @Inject + private ExceptionExceptionHandler exceptionExceptionHandler; + + @Inject + private NullPointerExceptionHandler nullPointerExceptionHandler; + + @Deployment + public static Archive<?> createTestArchive() + { + return ShrinkWrap.create("test.jar", JavaArchive.class) + .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionExceptionHandler.class, + ExceptionHandlerExecutor.class, NullPointerExceptionHandler.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + } + + @Test + public void testAllValidHandlersCalled() + { + ExceptionEvent event = new ExceptionEvent(new UnsupportedOperationException(), new StateImpl(this.beanManager)); + this.beanManager.fireEvent(event); + + assertTrue(this.unsupportedOperationExceptionHandler.isHandleCalled()); + assertTrue(this.exceptionExceptionHandler.isHandleCalled()); + assertFalse(this.nullPointerExceptionHandler.isHandleCalled()); + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/NullPointerExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/NullPointerExceptionHandler.java new file mode 100644 index 0000000..3903afb --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/NullPointerExceptionHandler.java @@ -0,0 +1,50 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.context.RequestScoped; + +@RequestScoped +public class NullPointerExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<NullPointerException, State> +{ + /** + * @return the numeric priority of this handler in relationship to + * other handlers, 1 being top priority + */ + public int getPriority() + { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + /** + * Method called to execute logic for an uncaught exception. + * + * @param chain Chain object used to continue handling chain + * @param state container for any useful application state + * @param e uncaught exception + */ + public void handle(HandlerChain chain, State state, NullPointerException e) + { + super.baseHandle(chain, state, e); + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandler.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandler.java new file mode 100644 index 0000000..345f16a --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandler.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import javax.enterprise.context.RequestScoped; + +@RequestScoped +public class UnsupportedOperationExceptionHandler extends BaseExceptionHandler implements ExceptionHandler<UnsupportedOperationException, State> +{ + + /** + * @return the numeric priority of this handler in relationship to + * other handlers, 1 being top priority + */ + public int getPriority() + { + return 1; //To change body of implemented methods use File | Settings | File Templates. + } + + /** + * Method called to execute logic for an uncaught exception. + * + * @param chain Chain object used to continue handling chain + * @param state container for any useful application state + * @param e uncaught exception + */ + public void handle(HandlerChain chain, State state, UnsupportedOperationException e) + { + super.baseHandle(chain, state, e); + } +} diff --git a/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandlerTest.java b/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandlerTest.java new file mode 100644 index 0000000..273a9f5 --- /dev/null +++ b/impl/src/test/java/org/jboss/seam/exceptionhandling/UnsupportedOperationExceptionHandlerTest.java @@ -0,0 +1,64 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.seam.exceptionhandling; + +import org.jboss.arquillian.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ArchivePaths; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import java.io.IOException; + +import static org.junit.Assert.assertTrue; + +@RunWith(Arquillian.class) +public class UnsupportedOperationExceptionHandlerTest extends BaseExceptionHandlerTest +{ + @Inject + private UnsupportedOperationExceptionHandler handler; + + @Deployment + public static Archive<?> createTestArchive() + { + return ShrinkWrap.create("test.jar", JavaArchive.class) + .addClasses(UnsupportedOperationExceptionHandler.class, ExceptionHandlerExecutor.class) + .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")); + } + + @Test + public void testHandlerIsCalled() throws IOException + { + this.handler.shouldCallEnd(true); // Set so I can reuse this handler in different tests + ExceptionEvent event = new ExceptionEvent(new UnsupportedOperationException(), new StateImpl(this.beanManager)); + this.beanManager.fireEvent(event); + + assertTrue(this.handler.isHandleCalled()); + assertTrue(event.isExceptionHandled()); + } +}
avar/bot-twatterhose
101004da77c003bf111a3217e39d6fd9d624ca4a
Ignore URLs, or stuff matching :// rather
diff --git a/Changes b/Changes index 925f9ba..32fdad7 100644 --- a/Changes +++ b/Changes @@ -1,17 +1,23 @@ Revision history for Bot::Twatterhose {{$NEXT}} + - Fix Makefile.PL breakage caused by Dist::Zilla FAIL: + http://github.com/rjbs/dist-zilla/commit/2e47b6c205 + + - Ignore URLs, or stuff matching :// rather. Keeps the brain + smaller. + 0.03 2010-04-27 12:19:19 - Don't learn from non-ASCII input on Twitter. It's too complex to handle south-east asian languages and others that don't split their words on whitespace. 0.02 2010-04-26 12:13:03 - Correct module name in Changes file 0.01 2010-04-26 12:10:40 - Initial CPAN release diff --git a/lib/Bot/Twatterhose.pm b/lib/Bot/Twatterhose.pm index 328999c..f5ba4d8 100644 --- a/lib/Bot/Twatterhose.pm +++ b/lib/Bot/Twatterhose.pm @@ -1,184 +1,184 @@ package Bot::Twatterhose; use 5.010; use autodie; use Any::Moose; use Any::Moose 'X::Getopt'; use Any::Moose 'X::Types::'.any_moose() => [qw/Int Str Bool HashRef/]; use JSON; use Hailo; use Net::Twitter::Lite; use Scalar::Util qw(blessed); use namespace::clean -except => 'meta'; with any_moose('X::Getopt::Dashes'); has help => ( traits => [ qw/ Getopt / ], cmd_aliases => 'h', isa => Bool, is => 'ro', documentation => "You're soaking it in", ); has username => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'u', documentation => "Your Twitter username", ); has password => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'p', documentation => "Your Twitter password", ); has brain => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'b', documentation => "The Hailo brain to use", ); has limit => ( traits => [ qw/ Getopt / ], isa => Int, default => 1000, is => 'ro', cmd_aliases => 'l', documentation => "The number of twats to consume from the firehose", ); has _twatter => ( traits => [ qw/ NoGetopt / ], isa => 'Net::Twitter::Lite', is => 'ro', documentation => "Net::Twatter::Lite instance", lazy_build => 1, ); sub _build__twatter { my ($self) = @_; my $twatter = Net::Twitter::Lite->new( username => $self->username, password => $self->password, source => 'twatterhose', traits => ['API::REST'], clientname => 'Twatterhose twatterbot', clienturl => 'http://github.com/avar/bot-twatterhose', ); return $twatter; } sub run { my ($self) = @_; my $hailo = Hailo->new(brain => $self->brain); my $callback = sub { my ($twat, $data) = @_; my $text = $twat->{text}; return unless $text; return unless length $text >= 70; # Twitter sucks $text =~ s/&gt;/</g; $text =~ s/&lt;/>/g; if ($data->{count}++ >= $self->limit) { # Say something on Twatter my $reply = $self->get_reply($hailo); my $twatter = $self->_twatter; local $@; eval { $twatter->update($reply); }; if ($@) { if (!blessed($@) || !$@->isa('Net::Twitter::Error::Lite')) { die "Unknown Net::Twitter::Lite error: $@"; } } else { # Updated status, all OK say "Twatted: $reply"; exit 0; } } else { - if ($text =~ /^[[:ascii:]]+$/ and $text !~ /\n/) { + if ($text =~ /^[[:ascii:]]+$/ and $text !~ /\n/ and $text !~ m[://]) { $hailo->learn($text); say sprintf "Got twat %d/%d: %s", $data->{count}, $self->limit, $text; } else { say sprintf "NOT twat %d/%d: %s", $data->{count}, $self->limit, $text; } } }; $self->twatterhose($callback); } sub get_reply { my ($self, $hailo) = @_; while (1) { my $reply = $hailo->reply(); return $reply if length $reply <= 140; } } sub twatterhose { my ($self, $callback) = @_; my ($username, $password) = map { $self->$_ } qw(username password); my $cmd = "curl -s http://stream.twitter.com/1/statuses/sample.json -u${username}:${password}"; open my $twitter, "$cmd |"; my $data = {}; while (my $line = <$twitter>) { chomp $line; my $twat = from_json($line); $callback->($twat, $data); } } __PACKAGE__->meta->make_immutable; =head1 NAME Bot::Twatterhose - Consume the Twitter firehose and babble to Twitter with L<Hailo> =head1 SYNOPSIS # Consume 500 tweets and twat one based on those twatterhose --username someuser --password somepass --brain twatterhose.brn --limit 500 # Put this in cron, wait a few years and a cult will have formed # around your bot: */30 * * * * (sleep $(($RANDOM % 3600))) && twatterhose --username someuser --password somepass --brain ~/twatterhose.brn =head1 DESCRIPTION Uses the L<twitter streaming API|http://apiwiki.twitter.com/Streaming-API-Documentation> to get tweets from the firehose, feeds those to L<Hailo> and tweets a random permutation of the previous input to Twitter. The author is trying to start a religion larger than L. Ron Hubbard's. =head1 AUTHOR E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> =head1 LICENSE AND COPYRIGHT Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut
avar/bot-twatterhose
b0560e3421b41edd5367d8fa54489e5c9196ced5
ignore .txt
diff --git a/.gitignore b/.gitignore index def79cb..0c3b4dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /*-* /.build /*.brn +/*.txt
avar/bot-twatterhose
db3a62f57ca78d2191861a0234c990524ad35aa8
ignore .txt
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index c2ecc12..e5c43a3 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -1 +1,2 @@ \.brn$ +\.txt$
avar/bot-twatterhose
03d7636b39b3b014eae5198b8de7d1eb5840a707
Don't learn from non-ASCII
diff --git a/Changes b/Changes index 48eb442..4d54f76 100644 --- a/Changes +++ b/Changes @@ -1,11 +1,15 @@ Revision history for Bot::Twatterhose {{$NEXT}} + - Don't learn from non-ASCII input on Twitter. It's too complex to + handle south-east asian languages and others that don't split + their words on whitespace. + 0.02 2010-04-26 12:13:03 - Correct module name in Changes file 0.01 2010-04-26 12:10:40 - Initial CPAN release diff --git a/lib/Bot/Twatterhose.pm b/lib/Bot/Twatterhose.pm index 6dba45c..328999c 100644 --- a/lib/Bot/Twatterhose.pm +++ b/lib/Bot/Twatterhose.pm @@ -1,180 +1,184 @@ package Bot::Twatterhose; use 5.010; use autodie; use Any::Moose; use Any::Moose 'X::Getopt'; use Any::Moose 'X::Types::'.any_moose() => [qw/Int Str Bool HashRef/]; use JSON; use Hailo; use Net::Twitter::Lite; use Scalar::Util qw(blessed); use namespace::clean -except => 'meta'; with any_moose('X::Getopt::Dashes'); has help => ( traits => [ qw/ Getopt / ], cmd_aliases => 'h', isa => Bool, is => 'ro', documentation => "You're soaking it in", ); has username => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'u', documentation => "Your Twitter username", ); has password => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'p', documentation => "Your Twitter password", ); has brain => ( traits => [ qw/ Getopt / ], isa => Str, is => 'ro', cmd_aliases => 'b', documentation => "The Hailo brain to use", ); has limit => ( traits => [ qw/ Getopt / ], isa => Int, default => 1000, is => 'ro', cmd_aliases => 'l', documentation => "The number of twats to consume from the firehose", ); has _twatter => ( traits => [ qw/ NoGetopt / ], isa => 'Net::Twitter::Lite', is => 'ro', documentation => "Net::Twatter::Lite instance", lazy_build => 1, ); sub _build__twatter { my ($self) = @_; my $twatter = Net::Twitter::Lite->new( username => $self->username, password => $self->password, source => 'twatterhose', traits => ['API::REST'], clientname => 'Twatterhose twatterbot', clienturl => 'http://github.com/avar/bot-twatterhose', ); return $twatter; } sub run { my ($self) = @_; my $hailo = Hailo->new(brain => $self->brain); my $callback = sub { my ($twat, $data) = @_; my $text = $twat->{text}; return unless $text; return unless length $text >= 70; # Twitter sucks $text =~ s/&gt;/</g; $text =~ s/&lt;/>/g; if ($data->{count}++ >= $self->limit) { # Say something on Twatter my $reply = $self->get_reply($hailo); my $twatter = $self->_twatter; local $@; eval { $twatter->update($reply); }; if ($@) { if (!blessed($@) || !$@->isa('Net::Twitter::Error::Lite')) { die "Unknown Net::Twitter::Lite error: $@"; } } else { # Updated status, all OK say "Twatted: $reply"; exit 0; } } else { - $hailo->learn($text); - say sprintf "Got twat %d/%d: %s", $data->{count}, $self->limit, $text; + if ($text =~ /^[[:ascii:]]+$/ and $text !~ /\n/) { + $hailo->learn($text); + say sprintf "Got twat %d/%d: %s", $data->{count}, $self->limit, $text; + } else { + say sprintf "NOT twat %d/%d: %s", $data->{count}, $self->limit, $text; + } } }; $self->twatterhose($callback); } sub get_reply { my ($self, $hailo) = @_; while (1) { my $reply = $hailo->reply(); return $reply if length $reply <= 140; } } sub twatterhose { my ($self, $callback) = @_; my ($username, $password) = map { $self->$_ } qw(username password); my $cmd = "curl -s http://stream.twitter.com/1/statuses/sample.json -u${username}:${password}"; open my $twitter, "$cmd |"; my $data = {}; while (my $line = <$twitter>) { chomp $line; my $twat = from_json($line); $callback->($twat, $data); } } __PACKAGE__->meta->make_immutable; =head1 NAME Bot::Twatterhose - Consume the Twitter firehose and babble to Twitter with L<Hailo> =head1 SYNOPSIS # Consume 500 tweets and twat one based on those twatterhose --username someuser --password somepass --brain twatterhose.brn --limit 500 # Put this in cron, wait a few years and a cult will have formed # around your bot: */30 * * * * (sleep $(($RANDOM % 3600))) && twatterhose --username someuser --password somepass --brain ~/twatterhose.brn =head1 DESCRIPTION Uses the L<twitter streaming API|http://apiwiki.twitter.com/Streaming-API-Documentation> to get tweets from the firehose, feeds those to L<Hailo> and tweets a random permutation of the previous input to Twitter. The author is trying to start a religion larger than L. Ron Hubbard's. =head1 AUTHOR E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> =head1 LICENSE AND COPYRIGHT Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut
avar/bot-twatterhose
a0cb2dd0f97c8d8c482638f7b40b08783ad914c1
Mention correct module name
diff --git a/Changes b/Changes index 2471a29..ec20dc4 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,7 @@ -Revision history for $module +Revision history for Bot::Twatterhose {{$NEXT}} 0.01 2010-04-26 12:10:40 - Initial CPAN release
avar/bot-twatterhose
397ccef3785c7392b77699a3605eb6684c43f0b9
initial cpan release
diff --git a/Changes b/Changes index a029194..0f649bb 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,5 @@ Revision history for $module {{$NEXT}} - - + - Initial CPAN release
avar/bot-twatterhose
8252d252f6f45a9a48b44c79637d871ed196d0a1
Bot::Twatterhose is working
diff --git a/.gitignore b/.gitignore index 8861634..def79cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /*-* /.build +/*.brn diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 0000000..c2ecc12 --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1 @@ +\.brn$ diff --git a/bin/twatterhose b/bin/twatterhose new file mode 100644 index 0000000..928ad09 --- /dev/null +++ b/bin/twatterhose @@ -0,0 +1,53 @@ +#!/usr/bin/env perl +use 5.010; +use open qw< :encoding(utf8) :std >; +use Any::Moose; +use Encode qw(decode); +use Bot::Twatterhose; +use namespace::clean -except => 'meta'; + +# Nothing to see here +__PACKAGE__->meta->make_immutable; + +# use utf8 everywhere +$_ = decode('utf8', $_) for @ARGV; + +# Set programname +$0 = 'twatterhose'; + +if ($^O eq 'linux') { + local $@; + eval { + require Sys::Prctl; + Sys::Prctl::prctl_name('hailo'); + }; +} + +# Show help if run without arguments +@ARGV = qw(--help) unless @ARGV; + +# Hailing frequencies open +Bot::Twatterhose->new_with_options->run; + +=encoding utf8 + +=head1 NAME + +twatterhose - Command-line interface to the L<Bot::Twatterhose> Twitter Markov bot + +=head1 DESCRIPTION + +See the documentation for L<Bot::Twatterhose> for more information. + +=head1 AUTHOR + +E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> + +=head1 LICENSE AND COPYRIGHT + +Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> + +This program is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/dist.ini b/dist.ini index cc28258..2e31395 100644 --- a/dist.ini +++ b/dist.ini @@ -1,11 +1,13 @@ name = Bot-Twatterhose author = Ævar Arnfjörð Bjarmason <[email protected]> copyright_holder = Ævar Arnfjörð Bjarmason license = Perl_5 [@AVAR] dist = Bot-Twatterhose bugtracker = rt -;no_AutoPrereq = 1 -;[Prereq] +[Prereq] +Mouse = 0.50 +MouseX::Types = 0.05 +MouseX::Getopt = 0.2601 diff --git a/lib/Bot/Twatterhose.pm b/lib/Bot/Twatterhose.pm new file mode 100644 index 0000000..6dba45c --- /dev/null +++ b/lib/Bot/Twatterhose.pm @@ -0,0 +1,180 @@ +package Bot::Twatterhose; +use 5.010; +use autodie; +use Any::Moose; +use Any::Moose 'X::Getopt'; +use Any::Moose 'X::Types::'.any_moose() => [qw/Int Str Bool HashRef/]; +use JSON; +use Hailo; +use Net::Twitter::Lite; +use Scalar::Util qw(blessed); +use namespace::clean -except => 'meta'; + +with any_moose('X::Getopt::Dashes'); + +has help => ( + traits => [ qw/ Getopt / ], + cmd_aliases => 'h', + isa => Bool, + is => 'ro', + documentation => "You're soaking it in", +); + +has username => ( + traits => [ qw/ Getopt / ], + isa => Str, + is => 'ro', + cmd_aliases => 'u', + documentation => "Your Twitter username", +); + +has password => ( + traits => [ qw/ Getopt / ], + isa => Str, + is => 'ro', + cmd_aliases => 'p', + documentation => "Your Twitter password", +); + +has brain => ( + traits => [ qw/ Getopt / ], + isa => Str, + is => 'ro', + cmd_aliases => 'b', + documentation => "The Hailo brain to use", +); + +has limit => ( + traits => [ qw/ Getopt / ], + isa => Int, + default => 1000, + is => 'ro', + cmd_aliases => 'l', + documentation => "The number of twats to consume from the firehose", +); + +has _twatter => ( + traits => [ qw/ NoGetopt / ], + isa => 'Net::Twitter::Lite', + is => 'ro', + documentation => "Net::Twatter::Lite instance", + lazy_build => 1, +); + +sub _build__twatter { + my ($self) = @_; + + my $twatter = Net::Twitter::Lite->new( + username => $self->username, + password => $self->password, + source => 'twatterhose', + traits => ['API::REST'], + clientname => 'Twatterhose twatterbot', + clienturl => 'http://github.com/avar/bot-twatterhose', + ); + + return $twatter; +} + +sub run { + my ($self) = @_; + + my $hailo = Hailo->new(brain => $self->brain); + + my $callback = sub { + my ($twat, $data) = @_; + + my $text = $twat->{text}; + return unless $text; + return unless length $text >= 70; + # Twitter sucks + $text =~ s/&gt;/</g; + $text =~ s/&lt;/>/g; + + if ($data->{count}++ >= $self->limit) { + # Say something on Twatter + my $reply = $self->get_reply($hailo); + my $twatter = $self->_twatter; + local $@; + eval { + $twatter->update($reply); + }; + if ($@) { + if (!blessed($@) || !$@->isa('Net::Twitter::Error::Lite')) { + die "Unknown Net::Twitter::Lite error: $@"; + } + } else { + # Updated status, all OK + say "Twatted: $reply"; + exit 0; + } + } else { + $hailo->learn($text); + say sprintf "Got twat %d/%d: %s", $data->{count}, $self->limit, $text; + } + }; + + $self->twatterhose($callback); +} + +sub get_reply { + my ($self, $hailo) = @_; + + while (1) { + my $reply = $hailo->reply(); + return $reply if length $reply <= 140; + } +} + +sub twatterhose { + my ($self, $callback) = @_; + + my ($username, $password) = map { $self->$_ } qw(username password); + my $cmd = "curl -s http://stream.twitter.com/1/statuses/sample.json -u${username}:${password}"; + open my $twitter, "$cmd |"; + + my $data = {}; + while (my $line = <$twitter>) { + chomp $line; + + my $twat = from_json($line); + $callback->($twat, $data); + } +} + +__PACKAGE__->meta->make_immutable; + +=head1 NAME + +Bot::Twatterhose - Consume the Twitter firehose and babble to Twitter with L<Hailo> + +=head1 SYNOPSIS + + # Consume 500 tweets and twat one based on those + twatterhose --username someuser --password somepass --brain twatterhose.brn --limit 500 + + # Put this in cron, wait a few years and a cult will have formed + # around your bot: + */30 * * * * (sleep $(($RANDOM % 3600))) && twatterhose --username someuser --password somepass --brain ~/twatterhose.brn + +=head1 DESCRIPTION + +Uses the L<twitter streaming +API|http://apiwiki.twitter.com/Streaming-API-Documentation> to get +tweets from the firehose, feeds those to L<Hailo> and tweets a random +permutation of the previous input to Twitter. + +The author is trying to start a religion larger than L. Ron Hubbard's. + +=head1 AUTHOR + +E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> + +=head1 LICENSE AND COPYRIGHT + +Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <[email protected]> + +This program is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut
avar/bot-twatterhose
a358ddd78f2533dbae912c2d42dc8522ddb13c52
Creating Bot-Twatterhose
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8861634 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/*-* +/.build diff --git a/Changes b/Changes new file mode 100644 index 0000000..a029194 --- /dev/null +++ b/Changes @@ -0,0 +1,5 @@ +Revision history for $module + +{{$NEXT}} + + - diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..cc28258 --- /dev/null +++ b/dist.ini @@ -0,0 +1,11 @@ +name = Bot-Twatterhose +author = Ævar Arnfjörð Bjarmason <[email protected]> +copyright_holder = Ævar Arnfjörð Bjarmason +license = Perl_5 + +[@AVAR] +dist = Bot-Twatterhose +bugtracker = rt +;no_AutoPrereq = 1 + +;[Prereq]
gpapini/sample_app
5e3afe164290b980c64380a18490b2793cec1e7f
Chapter 5, exercise 2, layout_links_spec - should have the right links on the layout
diff --git a/spec/requests/layout_links_spec.rb b/spec/requests/layout_links_spec.rb index 48ec215..4989657 100644 --- a/spec/requests/layout_links_spec.rb +++ b/spec/requests/layout_links_spec.rb @@ -1,29 +1,44 @@ require 'spec_helper' describe "LayoutLinks" do it "should have a Home page at '/'" do get '/' response.should have_selector('title', :content => "Home") end it "should have a Contact page at '/contact'" do get '/contact' response.should have_selector('title', :content => "Contact") end it "should have an About page at '/about'" do get '/about' response.should have_selector('title', :content => "About") end it "should have a Help page at '/help'" do get '/help' response.should have_selector('title', :content => "Help") end it "should have a signup page at '/signup'" do get '/signup' response.should have_selector('title', :content => "Sign up") end - end + + it "should have the right links on the layout" do + visit root_path + click_link "About" + response.should have_selector('title', :content => "About") + click_link "Help" + response.should have_selector('title', :content => "Help") + click_link "Contact" + response.should have_selector('title', :content => "Contact") + click_link "Home" + response.should have_selector('title', :content => "Home") + click_link "Sign up now!" + response.should have_selector('title', :content => "Sign up") + end + +end
gpapini/sample_app
4204405f7ad68243e671367d406ca5620c6788ee
Finished layout and routes (chapter 5)
diff --git a/.DS_Store b/.DS_Store index 6b6238a..71fe664 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/.DS_Store b/app/.DS_Store index 2b4b344..b359585 100644 Binary files a/app/.DS_Store and b/app/.DS_Store differ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..11a6a5e --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,6 @@ +class UsersController < ApplicationController + def new + @title = "Sign up" + end + +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/views/.DS_Store b/app/views/.DS_Store index 80e8837..b55e356 100644 Binary files a/app/views/.DS_Store and b/app/views/.DS_Store differ diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..eff12d2 --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,10 @@ +<footer> + <nav class="round"> + <ul> + <li><%= link_to "About", about_path %></li> + <li><%= link_to "Contact", contact_path %></li> + <li><a href="http://news.railstutorial.org/">News</a></li> + <li><a href="http://www.railstutorial.org/">Rails Tutorial</a></li> + </ul> + </nav> +</footer> \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb new file mode 100644 index 0000000..29f7418 --- /dev/null +++ b/app/views/layouts/_header.html.erb @@ -0,0 +1,11 @@ +<header> + <% logo = image_tag("logo.png", :alt => "Sample App", :class => "round") %> + <%= link_to logo, root_path %> + <nav class="round"> + <ul> + <li><%= link_to "Home", root_path %></li> + <li><%= link_to "Help", help_path %></li> + <li><%= link_to "Sign in", '#' %></li> + </ul> + </nav> +</header> diff --git a/app/views/layouts/_stylesheets.html.erb b/app/views/layouts/_stylesheets.html.erb new file mode 100644 index 0000000..2ef9342 --- /dev/null +++ b/app/views/layouts/_stylesheets.html.erb @@ -0,0 +1,7 @@ +<!--[if lt IE 9]> +<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> +<![endif]--> +<%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %> +<%= stylesheet_link_tag 'blueprint/print', :media => 'print' %> +<!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]--> +<%= stylesheet_link_tag 'custom', :media => 'screen' %> diff --git a/app/views/pages/help.html.erb b/app/views/pages/help.html.erb new file mode 100644 index 0000000..3cbf65d --- /dev/null +++ b/app/views/pages/help.html.erb @@ -0,0 +1,7 @@ +<h1>Help</h1> +<p> + Get help on Ruby on Rails Tutorial at the + <a href="http://railstutorial.org/help">Rails Tutorial help page</a>. + To get help on this sample app, see the + <a href="http://railstutorial.org/book">Rails Tutorial book</a>. +</p> \ No newline at end of file diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index c574df1..f0ef7eb 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,9 +1,9 @@ <h1>Sample App</h1> <p> This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application. </p> -<%= link_to "Sign up now!", '#', :class => "signup_button round" %> +<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..c21a1ad --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,2 @@ +<h1>Users#new</h1> +<p>Find me in app/views/users/new.html.erb</p> diff --git a/config/routes.rb b/config/routes.rb index a826902..36b3bcd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,73 +1,78 @@ SampleApp::Application.routes.draw do + + get "users/new" + + match '/signup', :to => 'users#new' + match '/contact', :to => 'pages#contact' match '/about', :to => 'pages#about' match '/help', :to => 'pages#help' root :to => 'pages#home' # get "pages/home" # get "pages/contact" # get "pages/about" # get "pages/help" # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get 'recent', :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. # root :to => "welcome#index" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that's not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match ':controller(/:action(/:id(.:format)))' end diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP index fe41f5c..c18c375 100644 --- a/doc/README_FOR_APP +++ b/doc/README_FOR_APP @@ -1,2 +1,6 @@ Use this README file to introduce your application and point to useful places in the API for learning more. Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. + + +9-15-10: Resume at +5.2.3 Named routes diff --git a/public/.DS_Store b/public/.DS_Store new file mode 100644 index 0000000..2dcf630 Binary files /dev/null and b/public/.DS_Store differ diff --git a/public/images/logo.png b/public/images/logo.png new file mode 100644 index 0000000..66439e0 Binary files /dev/null and b/public/images/logo.png differ diff --git a/public/stylesheets/.DS_Store b/public/stylesheets/.DS_Store new file mode 100644 index 0000000..8f433bc Binary files /dev/null and b/public/stylesheets/.DS_Store differ diff --git a/public/stylesheets/blueprint/ie.css b/public/stylesheets/blueprint/ie.css new file mode 100755 index 0000000..3dddda9 --- /dev/null +++ b/public/stylesheets/blueprint/ie.css @@ -0,0 +1,35 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* ie.css */ +body {text-align:center;} +.container {text-align:left;} +* html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {display:inline;overflow-x:hidden;} +* html legend {margin:0px -8px 16px 0;padding:0;} +sup {vertical-align:text-top;} +sub {vertical-align:text-bottom;} +html>body p code {*white-space:normal;} +hr {margin:-8px auto 11px;} +img {-ms-interpolation-mode:bicubic;} +.clearfix, .container {display:inline-block;} +* html .clearfix, * html .container {height:1%;} +fieldset {padding-top:0;} +textarea {overflow:auto;} +input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} +input.text:focus, input.title:focus {border-color:#666;} +input.text, input.title, textarea, select {margin:0.5em 0;} +input.checkbox, input.radio {position:relative;top:.25em;} +form.inline div, form.inline p {vertical-align:middle;} +form.inline label {position:relative;top:-0.25em;} +form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} +button, input.button {position:relative;top:0.25em;} \ No newline at end of file diff --git a/public/stylesheets/blueprint/plugins/buttons/icons/cross.png b/public/stylesheets/blueprint/plugins/buttons/icons/cross.png new file mode 100755 index 0000000..1514d51 Binary files /dev/null and b/public/stylesheets/blueprint/plugins/buttons/icons/cross.png differ diff --git a/public/stylesheets/blueprint/plugins/buttons/icons/key.png b/public/stylesheets/blueprint/plugins/buttons/icons/key.png new file mode 100755 index 0000000..a9d5e4f Binary files /dev/null and b/public/stylesheets/blueprint/plugins/buttons/icons/key.png differ diff --git a/public/stylesheets/blueprint/plugins/buttons/icons/tick.png b/public/stylesheets/blueprint/plugins/buttons/icons/tick.png new file mode 100755 index 0000000..a9925a0 Binary files /dev/null and b/public/stylesheets/blueprint/plugins/buttons/icons/tick.png differ diff --git a/public/stylesheets/blueprint/plugins/buttons/readme.txt b/public/stylesheets/blueprint/plugins/buttons/readme.txt new file mode 100755 index 0000000..aa9fe26 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/buttons/readme.txt @@ -0,0 +1,32 @@ +Buttons + +* Gives you great looking CSS buttons, for both <a> and <button>. +* Demo: particletree.com/features/rediscovering-the-button-element + + +Credits +---------------------------------------------------------------- + +* Created by Kevin Hale [particletree.com] +* Adapted for Blueprint by Olav Bjorkoy [bjorkoy.com] + + +Usage +---------------------------------------------------------------- + +1) Add this plugin to lib/settings.yml. + See compress.rb for instructions. + +2) Use the following HTML code to place the buttons on your site: + + <button type="submit" class="button positive"> + <img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/> Save + </button> + + <a class="button" href="/password/reset/"> + <img src="css/blueprint/plugins/buttons/icons/key.png" alt=""/> Change Password + </a> + + <a href="#" class="button negative"> + <img src="css/blueprint/plugins/buttons/icons/cross.png" alt=""/> Cancel + </a> diff --git a/public/stylesheets/blueprint/plugins/buttons/screen.css b/public/stylesheets/blueprint/plugins/buttons/screen.css new file mode 100755 index 0000000..bb66b21 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/buttons/screen.css @@ -0,0 +1,97 @@ +/* -------------------------------------------------------------- + + buttons.css + * Gives you some great CSS-only buttons. + + Created by Kevin Hale [particletree.com] + * particletree.com/features/rediscovering-the-button-element + + See Readme.txt in this folder for instructions. + +-------------------------------------------------------------- */ + +a.button, button { + display:block; + float:left; + margin: 0.7em 0.5em 0.7em 0; + padding:5px 10px 5px 7px; /* Links */ + + border:1px solid #dedede; + border-top:1px solid #eee; + border-left:1px solid #eee; + + background-color:#f5f5f5; + font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; + font-size:100%; + line-height:130%; + text-decoration:none; + font-weight:bold; + color:#565656; + cursor:pointer; +} +button { + width:auto; + overflow:visible; + padding:4px 10px 3px 7px; /* IE6 */ +} +button[type] { + padding:4px 10px 4px 7px; /* Firefox */ + line-height:17px; /* Safari */ +} +*:first-child+html button[type] { + padding:4px 10px 3px 7px; /* IE7 */ +} +button img, a.button img{ + margin:0 3px -3px 0 !important; + padding:0; + border:none; + width:16px; + height:16px; + float:none; +} + + +/* Button colors +-------------------------------------------------------------- */ + +/* Standard */ +button:hover, a.button:hover{ + background-color:#dff4ff; + border:1px solid #c2e1ef; + color:#336699; +} +a.button:active{ + background-color:#6299c5; + border:1px solid #6299c5; + color:#fff; +} + +/* Positive */ +body .positive { + color:#529214; +} +a.positive:hover, button.positive:hover { + background-color:#E6EFC2; + border:1px solid #C6D880; + color:#529214; +} +a.positive:active { + background-color:#529214; + border:1px solid #529214; + color:#fff; +} + +/* Negative */ +body .negative { + color:#d12f19; +} +a.negative:hover, button.negative:hover { + background-color:#fbe3e4; + border:1px solid #fbc2c4; + color:#d12f19; +} +a.negative:active { + background-color:#d12f19; + border:1px solid #d12f19; + color:#fff; +} diff --git a/public/stylesheets/blueprint/plugins/fancy-type/readme.txt b/public/stylesheets/blueprint/plugins/fancy-type/readme.txt new file mode 100755 index 0000000..85f2491 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/fancy-type/readme.txt @@ -0,0 +1,14 @@ +Fancy Type + +* Gives you classes to use if you'd like some + extra fancy typography. + +Credits and instructions are specified above each class +in the fancy-type.css file in this directory. + + +Usage +---------------------------------------------------------------- + +1) Add this plugin to lib/settings.yml. + See compress.rb for instructions. diff --git a/public/stylesheets/blueprint/plugins/fancy-type/screen.css b/public/stylesheets/blueprint/plugins/fancy-type/screen.css new file mode 100755 index 0000000..127cf25 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/fancy-type/screen.css @@ -0,0 +1,71 @@ +/* -------------------------------------------------------------- + + fancy-type.css + * Lots of pretty advanced classes for manipulating text. + + See the Readme file in this folder for additional instructions. + +-------------------------------------------------------------- */ + +/* Indentation instead of line shifts for sibling paragraphs. */ + p + p { text-indent:2em; margin-top:-1.5em; } + form p + p { text-indent: 0; } /* Don't want this in forms. */ + + +/* For great looking type, use this code instead of asdf: + <span class="alt">asdf</span> + Best used on prepositions and ampersands. */ + +.alt { + color: #666; + font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif; + font-style: italic; + font-weight: normal; +} + + +/* For great looking quote marks in titles, replace "asdf" with: + <span class="dquo">&#8220;</span>asdf&#8221; + (That is, when the title starts with a quote mark). + (You may have to change this value depending on your font size). */ + +.dquo { margin-left: -.5em; } + + +/* Reduced size type with incremental leading + (http://www.markboulton.co.uk/journal/comments/incremental_leading/) + + This could be used for side notes. For smaller type, you don't necessarily want to + follow the 1.5x vertical rhythm -- the line-height is too much. + + Using this class, it reduces your font size and line-height so that for + every four lines of normal sized type, there is five lines of the sidenote. eg: + + New type size in em's: + 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems) + + New line-height value: + 12px x 1.5 = 18px (old line-height) + 18px x 4 = 72px + 72px / 5 = 14.4px (new line height) + 14.4px / 10px = 1.44 (new line height in em's) */ + +p.incr, .incr p { + font-size: 10px; + line-height: 1.44em; + margin-bottom: 1.5em; +} + + +/* Surround uppercase words and abbreviations with this class. + Based on work by Jørgen Arnor GÃ¥rdsø Lom [http://twistedintellect.com/] */ + +.caps { + font-variant: small-caps; + letter-spacing: 1px; + text-transform: lowercase; + font-size:1.2em; + line-height:1%; + font-weight:bold; + padding:0 2px; +} diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png b/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png new file mode 100755 index 0000000..834cdfa Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/email.png b/public/stylesheets/blueprint/plugins/link-icons/icons/email.png new file mode 100755 index 0000000..7348aed Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/email.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/external.png b/public/stylesheets/blueprint/plugins/link-icons/icons/external.png new file mode 100755 index 0000000..cf1cfb4 Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/external.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png b/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png new file mode 100755 index 0000000..315c4f4 Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/im.png b/public/stylesheets/blueprint/plugins/link-icons/icons/im.png new file mode 100755 index 0000000..79f35cc Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/im.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png b/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png new file mode 100755 index 0000000..8f8095e Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png b/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png new file mode 100755 index 0000000..ebf206d Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png b/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png new file mode 100755 index 0000000..b977d7e Binary files /dev/null and b/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png differ diff --git a/public/stylesheets/blueprint/plugins/link-icons/readme.txt b/public/stylesheets/blueprint/plugins/link-icons/readme.txt new file mode 100755 index 0000000..fc4dc64 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/link-icons/readme.txt @@ -0,0 +1,18 @@ +Link Icons +* Icons for links based on protocol or file type. + +This is not supported in IE versions < 7. + + +Credits +---------------------------------------------------------------- + +* Marc Morgan +* Olav Bjorkoy [bjorkoy.com] + + +Usage +---------------------------------------------------------------- + +1) Add this line to your HTML: + <link rel="stylesheet" href="css/blueprint/plugins/link-icons/screen.css" type="text/css" media="screen, projection"> diff --git a/public/stylesheets/blueprint/plugins/link-icons/screen.css b/public/stylesheets/blueprint/plugins/link-icons/screen.css new file mode 100755 index 0000000..7b4bef9 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/link-icons/screen.css @@ -0,0 +1,40 @@ +/* -------------------------------------------------------------- + + link-icons.css + * Icons for links based on protocol or file type. + + See the Readme file in this folder for additional instructions. + +-------------------------------------------------------------- */ + +/* Use this class if a link gets an icon when it shouldn't. */ +body a.noicon { + background:transparent none !important; + padding:0 !important; + margin:0 !important; +} + +/* Make sure the icons are not cut */ +a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, +a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], +a[href$=".rdf"], a[href^="aim:"] { + padding:2px 22px 2px 0; + margin:-2px 0; + background-repeat: no-repeat; + background-position: right center; +} + +/* External links */ +a[href^="http:"] { background-image: url(icons/external.png); } +a[href^="mailto:"] { background-image: url(icons/email.png); } +a[href^="http:"]:visited { background-image: url(icons/visited.png); } + +/* Files */ +a[href$=".pdf"] { background-image: url(icons/pdf.png); } +a[href$=".doc"] { background-image: url(icons/doc.png); } +a[href$=".xls"] { background-image: url(icons/xls.png); } + +/* Misc */ +a[href$=".rss"], +a[href$=".rdf"] { background-image: url(icons/feed.png); } +a[href^="aim:"] { background-image: url(icons/im.png); } diff --git a/public/stylesheets/blueprint/plugins/rtl/readme.txt b/public/stylesheets/blueprint/plugins/rtl/readme.txt new file mode 100755 index 0000000..5564c40 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/rtl/readme.txt @@ -0,0 +1,10 @@ +RTL +* Mirrors Blueprint, so it can be used with Right-to-Left languages. + +By Ran Yaniv Hartstein, ranh.co.il + +Usage +---------------------------------------------------------------- + +1) Add this line to your HTML: + <link rel="stylesheet" href="css/blueprint/plugins/rtl/screen.css" type="text/css" media="screen, projection"> diff --git a/public/stylesheets/blueprint/plugins/rtl/screen.css b/public/stylesheets/blueprint/plugins/rtl/screen.css new file mode 100755 index 0000000..7db7eb5 --- /dev/null +++ b/public/stylesheets/blueprint/plugins/rtl/screen.css @@ -0,0 +1,110 @@ +/* -------------------------------------------------------------- + + rtl.css + * Mirrors Blueprint for left-to-right languages + + By Ran Yaniv Hartstein [ranh.co.il] + +-------------------------------------------------------------- */ + +body .container { direction: rtl; } +body .column, body .span-1, body .span-2, body .span-3, body .span-4, body .span-5, body .span-6, body .span-7, body .span-8, body .span-9, body .span-10, body .span-11, body .span-12, body .span-13, body .span-14, body .span-15, body .span-16, body .span-17, body .span-18, body .span-19, body .span-20, body .span-21, body .span-22, body .span-23, body .span-24 { + float: right; + margin-right: 0; + margin-left: 10px; + text-align:right; +} + +body div.last { margin-left: 0; } +body table .last { padding-left: 0; } + +body .append-1 { padding-right: 0; padding-left: 40px; } +body .append-2 { padding-right: 0; padding-left: 80px; } +body .append-3 { padding-right: 0; padding-left: 120px; } +body .append-4 { padding-right: 0; padding-left: 160px; } +body .append-5 { padding-right: 0; padding-left: 200px; } +body .append-6 { padding-right: 0; padding-left: 240px; } +body .append-7 { padding-right: 0; padding-left: 280px; } +body .append-8 { padding-right: 0; padding-left: 320px; } +body .append-9 { padding-right: 0; padding-left: 360px; } +body .append-10 { padding-right: 0; padding-left: 400px; } +body .append-11 { padding-right: 0; padding-left: 440px; } +body .append-12 { padding-right: 0; padding-left: 480px; } +body .append-13 { padding-right: 0; padding-left: 520px; } +body .append-14 { padding-right: 0; padding-left: 560px; } +body .append-15 { padding-right: 0; padding-left: 600px; } +body .append-16 { padding-right: 0; padding-left: 640px; } +body .append-17 { padding-right: 0; padding-left: 680px; } +body .append-18 { padding-right: 0; padding-left: 720px; } +body .append-19 { padding-right: 0; padding-left: 760px; } +body .append-20 { padding-right: 0; padding-left: 800px; } +body .append-21 { padding-right: 0; padding-left: 840px; } +body .append-22 { padding-right: 0; padding-left: 880px; } +body .append-23 { padding-right: 0; padding-left: 920px; } + +body .prepend-1 { padding-left: 0; padding-right: 40px; } +body .prepend-2 { padding-left: 0; padding-right: 80px; } +body .prepend-3 { padding-left: 0; padding-right: 120px; } +body .prepend-4 { padding-left: 0; padding-right: 160px; } +body .prepend-5 { padding-left: 0; padding-right: 200px; } +body .prepend-6 { padding-left: 0; padding-right: 240px; } +body .prepend-7 { padding-left: 0; padding-right: 280px; } +body .prepend-8 { padding-left: 0; padding-right: 320px; } +body .prepend-9 { padding-left: 0; padding-right: 360px; } +body .prepend-10 { padding-left: 0; padding-right: 400px; } +body .prepend-11 { padding-left: 0; padding-right: 440px; } +body .prepend-12 { padding-left: 0; padding-right: 480px; } +body .prepend-13 { padding-left: 0; padding-right: 520px; } +body .prepend-14 { padding-left: 0; padding-right: 560px; } +body .prepend-15 { padding-left: 0; padding-right: 600px; } +body .prepend-16 { padding-left: 0; padding-right: 640px; } +body .prepend-17 { padding-left: 0; padding-right: 680px; } +body .prepend-18 { padding-left: 0; padding-right: 720px; } +body .prepend-19 { padding-left: 0; padding-right: 760px; } +body .prepend-20 { padding-left: 0; padding-right: 800px; } +body .prepend-21 { padding-left: 0; padding-right: 840px; } +body .prepend-22 { padding-left: 0; padding-right: 880px; } +body .prepend-23 { padding-left: 0; padding-right: 920px; } + +body .border { + padding-right: 0; + padding-left: 4px; + margin-right: 0; + margin-left: 5px; + border-right: none; + border-left: 1px solid #eee; +} + +body .colborder { + padding-right: 0; + padding-left: 24px; + margin-right: 0; + margin-left: 25px; + border-right: none; + border-left: 1px solid #eee; +} + +body .pull-1 { margin-left: 0; margin-right: -40px; } +body .pull-2 { margin-left: 0; margin-right: -80px; } +body .pull-3 { margin-left: 0; margin-right: -120px; } +body .pull-4 { margin-left: 0; margin-right: -160px; } + +body .push-0 { margin: 0 18px 0 0; } +body .push-1 { margin: 0 18px 0 -40px; } +body .push-2 { margin: 0 18px 0 -80px; } +body .push-3 { margin: 0 18px 0 -120px; } +body .push-4 { margin: 0 18px 0 -160px; } +body .push-0, body .push-1, body .push-2, +body .push-3, body .push-4 { float: left; } + + +/* Typography with RTL support */ +body h1,body h2,body h3, +body h4,body h5,body h6 { font-family: Arial, sans-serif; } +html body { font-family: Arial, sans-serif; } +body pre,body code,body tt { font-family: monospace; } + +/* Mirror floats and margins on typographic elements */ +body p img { float: right; margin: 1.5em 0 1.5em 1.5em; } +body dd, body ul, body ol { margin-left: 0; margin-right: 1.5em;} +body td, body th { text-align:right; } diff --git a/public/stylesheets/blueprint/print.css b/public/stylesheets/blueprint/print.css new file mode 100755 index 0000000..fdb8220 --- /dev/null +++ b/public/stylesheets/blueprint/print.css @@ -0,0 +1,29 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* print.css */ +body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;} +.container {background:none;} +hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;} +code {font:.9em "Courier New", Monaco, Courier, monospace;} +a img {border:none;} +p img.top {margin-top:0;} +blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;} +.small {font-size:.9em;} +.large {font-size:1.1em;} +.quiet {color:#999;} +.hide {display:none;} +a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;} +a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;} \ No newline at end of file diff --git a/public/stylesheets/blueprint/screen.css b/public/stylesheets/blueprint/screen.css new file mode 100755 index 0000000..521ced8 --- /dev/null +++ b/public/stylesheets/blueprint/screen.css @@ -0,0 +1,262 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html {margin:0;padding:0;border:0;} +body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;background:white;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;float:none !important;} +table, th, td {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:'';} +blockquote, q {quotes:"" "";} +a img {border:none;} +:focus {outline:0;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#09f;} +a {color:#06c;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:1.5em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#e5ecf9;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;} +.notice {background:#fff6bf;color:#514721;border-color:#ffd324;} +.success {background:#e6efc2;color:#264409;border-color:#c6d880;} +.info {background:#d5edf8;color:#205791;border-color:#92cae4;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.info a {color:#205791;} + +/* grid.css */ +.container {width:950px;margin:0 auto;} +.showgrid {background:url(src/grid.png);} +.column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 {float:left;margin-right:10px;} +.last {margin-right:0;} +.span-1 {width:30px;} +.span-2 {width:70px;} +.span-3 {width:110px;} +.span-4 {width:150px;} +.span-5 {width:190px;} +.span-6 {width:230px;} +.span-7 {width:270px;} +.span-8 {width:310px;} +.span-9 {width:350px;} +.span-10 {width:390px;} +.span-11 {width:430px;} +.span-12 {width:470px;} +.span-13 {width:510px;} +.span-14 {width:550px;} +.span-15 {width:590px;} +.span-16 {width:630px;} +.span-17 {width:670px;} +.span-18 {width:710px;} +.span-19 {width:750px;} +.span-20 {width:790px;} +.span-21 {width:830px;} +.span-22 {width:870px;} +.span-23 {width:910px;} +.span-24 {width:950px;margin-right:0;} +input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {border-left-width:1px;border-right-width:1px;padding-left:5px;padding-right:5px;} +input.span-1, textarea.span-1 {width:18px;} +input.span-2, textarea.span-2 {width:58px;} +input.span-3, textarea.span-3 {width:98px;} +input.span-4, textarea.span-4 {width:138px;} +input.span-5, textarea.span-5 {width:178px;} +input.span-6, textarea.span-6 {width:218px;} +input.span-7, textarea.span-7 {width:258px;} +input.span-8, textarea.span-8 {width:298px;} +input.span-9, textarea.span-9 {width:338px;} +input.span-10, textarea.span-10 {width:378px;} +input.span-11, textarea.span-11 {width:418px;} +input.span-12, textarea.span-12 {width:458px;} +input.span-13, textarea.span-13 {width:498px;} +input.span-14, textarea.span-14 {width:538px;} +input.span-15, textarea.span-15 {width:578px;} +input.span-16, textarea.span-16 {width:618px;} +input.span-17, textarea.span-17 {width:658px;} +input.span-18, textarea.span-18 {width:698px;} +input.span-19, textarea.span-19 {width:738px;} +input.span-20, textarea.span-20 {width:778px;} +input.span-21, textarea.span-21 {width:818px;} +input.span-22, textarea.span-22 {width:858px;} +input.span-23, textarea.span-23 {width:898px;} +input.span-24, textarea.span-24 {width:938px;} +.append-1 {padding-right:40px;} +.append-2 {padding-right:80px;} +.append-3 {padding-right:120px;} +.append-4 {padding-right:160px;} +.append-5 {padding-right:200px;} +.append-6 {padding-right:240px;} +.append-7 {padding-right:280px;} +.append-8 {padding-right:320px;} +.append-9 {padding-right:360px;} +.append-10 {padding-right:400px;} +.append-11 {padding-right:440px;} +.append-12 {padding-right:480px;} +.append-13 {padding-right:520px;} +.append-14 {padding-right:560px;} +.append-15 {padding-right:600px;} +.append-16 {padding-right:640px;} +.append-17 {padding-right:680px;} +.append-18 {padding-right:720px;} +.append-19 {padding-right:760px;} +.append-20 {padding-right:800px;} +.append-21 {padding-right:840px;} +.append-22 {padding-right:880px;} +.append-23 {padding-right:920px;} +.prepend-1 {padding-left:40px;} +.prepend-2 {padding-left:80px;} +.prepend-3 {padding-left:120px;} +.prepend-4 {padding-left:160px;} +.prepend-5 {padding-left:200px;} +.prepend-6 {padding-left:240px;} +.prepend-7 {padding-left:280px;} +.prepend-8 {padding-left:320px;} +.prepend-9 {padding-left:360px;} +.prepend-10 {padding-left:400px;} +.prepend-11 {padding-left:440px;} +.prepend-12 {padding-left:480px;} +.prepend-13 {padding-left:520px;} +.prepend-14 {padding-left:560px;} +.prepend-15 {padding-left:600px;} +.prepend-16 {padding-left:640px;} +.prepend-17 {padding-left:680px;} +.prepend-18 {padding-left:720px;} +.prepend-19 {padding-left:760px;} +.prepend-20 {padding-left:800px;} +.prepend-21 {padding-left:840px;} +.prepend-22 {padding-left:880px;} +.prepend-23 {padding-left:920px;} +.border {padding-right:4px;margin-right:5px;border-right:1px solid #ddd;} +.colborder {padding-right:24px;margin-right:25px;border-right:1px solid #ddd;} +.pull-1 {margin-left:-40px;} +.pull-2 {margin-left:-80px;} +.pull-3 {margin-left:-120px;} +.pull-4 {margin-left:-160px;} +.pull-5 {margin-left:-200px;} +.pull-6 {margin-left:-240px;} +.pull-7 {margin-left:-280px;} +.pull-8 {margin-left:-320px;} +.pull-9 {margin-left:-360px;} +.pull-10 {margin-left:-400px;} +.pull-11 {margin-left:-440px;} +.pull-12 {margin-left:-480px;} +.pull-13 {margin-left:-520px;} +.pull-14 {margin-left:-560px;} +.pull-15 {margin-left:-600px;} +.pull-16 {margin-left:-640px;} +.pull-17 {margin-left:-680px;} +.pull-18 {margin-left:-720px;} +.pull-19 {margin-left:-760px;} +.pull-20 {margin-left:-800px;} +.pull-21 {margin-left:-840px;} +.pull-22 {margin-left:-880px;} +.pull-23 {margin-left:-920px;} +.pull-24 {margin-left:-960px;} +.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;} +.push-1 {margin:0 -40px 1.5em 40px;} +.push-2 {margin:0 -80px 1.5em 80px;} +.push-3 {margin:0 -120px 1.5em 120px;} +.push-4 {margin:0 -160px 1.5em 160px;} +.push-5 {margin:0 -200px 1.5em 200px;} +.push-6 {margin:0 -240px 1.5em 240px;} +.push-7 {margin:0 -280px 1.5em 280px;} +.push-8 {margin:0 -320px 1.5em 320px;} +.push-9 {margin:0 -360px 1.5em 360px;} +.push-10 {margin:0 -400px 1.5em 400px;} +.push-11 {margin:0 -440px 1.5em 440px;} +.push-12 {margin:0 -480px 1.5em 480px;} +.push-13 {margin:0 -520px 1.5em 520px;} +.push-14 {margin:0 -560px 1.5em 560px;} +.push-15 {margin:0 -600px 1.5em 600px;} +.push-16 {margin:0 -640px 1.5em 640px;} +.push-17 {margin:0 -680px 1.5em 680px;} +.push-18 {margin:0 -720px 1.5em 720px;} +.push-19 {margin:0 -760px 1.5em 760px;} +.push-20 {margin:0 -800px 1.5em 800px;} +.push-21 {margin:0 -840px 1.5em 840px;} +.push-22 {margin:0 -880px 1.5em 880px;} +.push-23 {margin:0 -920px 1.5em 920px;} +.push-24 {margin:0 -960px 1.5em 960px;} +.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:left;position:relative;} +div.prepend-top, .prepend-top {margin-top:1.5em;} +div.append-bottom, .append-bottom {margin-bottom:1.5em;} +.box {padding:1.5em;margin-bottom:1.5em;background:#e5eCf9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:1px;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} \ No newline at end of file diff --git a/public/stylesheets/blueprint/src/forms.css b/public/stylesheets/blueprint/src/forms.css new file mode 100755 index 0000000..8b2c8e9 --- /dev/null +++ b/public/stylesheets/blueprint/src/forms.css @@ -0,0 +1,68 @@ +/* -------------------------------------------------------------- + + forms.css + * Sets up some default styling for forms + * Gives you classes to enhance your forms + + Usage: + * For text fields, use class .title or .text + * For inline forms, use .inline (even when using columns) + +-------------------------------------------------------------- */ + +label { font-weight: bold; } +fieldset { padding:1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; } +legend { font-weight: bold; font-size:1.2em; } + + +/* Form fields +-------------------------------------------------------------- */ + +input[type=text], input[type=password], +input.text, input.title, +textarea, select { + background-color:#fff; + border:1px solid #bbb; +} +input[type=text]:focus, input[type=password]:focus, +input.text:focus, input.title:focus, +textarea:focus, select:focus { + border-color:#666; +} + +input[type=text], input[type=password], +input.text, input.title, +textarea, select { + margin:0.5em 0; +} + +input.text, +input.title { width: 300px; padding:5px; } +input.title { font-size:1.5em; } +textarea { width: 390px; height: 250px; padding:5px; } + +input[type=checkbox], input[type=radio], +input.checkbox, input.radio { + position:relative; top:.25em; +} + +form.inline { line-height:3; } +form.inline p { margin-bottom:0; } + + +/* Success, notice and error boxes +-------------------------------------------------------------- */ + +.error, +.notice, +.success, +.info { padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; } + +.error { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; } +.notice { background: #fff6bf; color: #514721; border-color: #ffd324; } +.success { background: #e6efc2; color: #264409; border-color: #c6d880; } +.info { background: #d5edf8; color: #205791; border-color: #92cae4; } +.error a { color: #8a1f11; } +.notice a { color: #514721; } +.success a { color: #264409; } +.info a { color: #205791; } diff --git a/public/stylesheets/blueprint/src/grid.css b/public/stylesheets/blueprint/src/grid.css new file mode 100755 index 0000000..c102c1f --- /dev/null +++ b/public/stylesheets/blueprint/src/grid.css @@ -0,0 +1,280 @@ +/* -------------------------------------------------------------- + + grid.css + * Sets up an easy-to-use grid of 24 columns. + + By default, the grid is 950px wide, with 24 columns + spanning 30px, and a 10px margin between columns. + + If you need fewer or more columns, namespaces or semantic + element names, use the compressor script (lib/compress.rb) + +-------------------------------------------------------------- */ + +/* A container should group all your columns. */ +.container { + width: 950px; + margin: 0 auto; +} + +/* Use this class on any .span / container to see the grid. */ +.showgrid { + background: url(src/grid.png); +} + + +/* Columns +-------------------------------------------------------------- */ + +/* Sets up basic grid floating and margin. */ +.column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 { + float: left; + margin-right: 10px; +} + +/* The last column in a row needs this class. */ +.last { margin-right: 0; } + +/* Use these classes to set the width of a column. */ +.span-1 {width: 30px;} + +.span-2 {width: 70px;} +.span-3 {width: 110px;} +.span-4 {width: 150px;} +.span-5 {width: 190px;} +.span-6 {width: 230px;} +.span-7 {width: 270px;} +.span-8 {width: 310px;} +.span-9 {width: 350px;} +.span-10 {width: 390px;} +.span-11 {width: 430px;} +.span-12 {width: 470px;} +.span-13 {width: 510px;} +.span-14 {width: 550px;} +.span-15 {width: 590px;} +.span-16 {width: 630px;} +.span-17 {width: 670px;} +.span-18 {width: 710px;} +.span-19 {width: 750px;} +.span-20 {width: 790px;} +.span-21 {width: 830px;} +.span-22 {width: 870px;} +.span-23 {width: 910px;} +.span-24 {width:950px; margin-right:0;} + +/* Use these classes to set the width of an input. */ +input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 { + border-left-width: 1px; + border-right-width: 1px; + padding-left: 5px; + padding-right: 5px; +} + +input.span-1, textarea.span-1 { width: 18px; } +input.span-2, textarea.span-2 { width: 58px; } +input.span-3, textarea.span-3 { width: 98px; } +input.span-4, textarea.span-4 { width: 138px; } +input.span-5, textarea.span-5 { width: 178px; } +input.span-6, textarea.span-6 { width: 218px; } +input.span-7, textarea.span-7 { width: 258px; } +input.span-8, textarea.span-8 { width: 298px; } +input.span-9, textarea.span-9 { width: 338px; } +input.span-10, textarea.span-10 { width: 378px; } +input.span-11, textarea.span-11 { width: 418px; } +input.span-12, textarea.span-12 { width: 458px; } +input.span-13, textarea.span-13 { width: 498px; } +input.span-14, textarea.span-14 { width: 538px; } +input.span-15, textarea.span-15 { width: 578px; } +input.span-16, textarea.span-16 { width: 618px; } +input.span-17, textarea.span-17 { width: 658px; } +input.span-18, textarea.span-18 { width: 698px; } +input.span-19, textarea.span-19 { width: 738px; } +input.span-20, textarea.span-20 { width: 778px; } +input.span-21, textarea.span-21 { width: 818px; } +input.span-22, textarea.span-22 { width: 858px; } +input.span-23, textarea.span-23 { width: 898px; } +input.span-24, textarea.span-24 { width: 938px; } + +/* Add these to a column to append empty cols. */ + +.append-1 { padding-right: 40px;} +.append-2 { padding-right: 80px;} +.append-3 { padding-right: 120px;} +.append-4 { padding-right: 160px;} +.append-5 { padding-right: 200px;} +.append-6 { padding-right: 240px;} +.append-7 { padding-right: 280px;} +.append-8 { padding-right: 320px;} +.append-9 { padding-right: 360px;} +.append-10 { padding-right: 400px;} +.append-11 { padding-right: 440px;} +.append-12 { padding-right: 480px;} +.append-13 { padding-right: 520px;} +.append-14 { padding-right: 560px;} +.append-15 { padding-right: 600px;} +.append-16 { padding-right: 640px;} +.append-17 { padding-right: 680px;} +.append-18 { padding-right: 720px;} +.append-19 { padding-right: 760px;} +.append-20 { padding-right: 800px;} +.append-21 { padding-right: 840px;} +.append-22 { padding-right: 880px;} +.append-23 { padding-right: 920px;} + +/* Add these to a column to prepend empty cols. */ + +.prepend-1 { padding-left: 40px;} +.prepend-2 { padding-left: 80px;} +.prepend-3 { padding-left: 120px;} +.prepend-4 { padding-left: 160px;} +.prepend-5 { padding-left: 200px;} +.prepend-6 { padding-left: 240px;} +.prepend-7 { padding-left: 280px;} +.prepend-8 { padding-left: 320px;} +.prepend-9 { padding-left: 360px;} +.prepend-10 { padding-left: 400px;} +.prepend-11 { padding-left: 440px;} +.prepend-12 { padding-left: 480px;} +.prepend-13 { padding-left: 520px;} +.prepend-14 { padding-left: 560px;} +.prepend-15 { padding-left: 600px;} +.prepend-16 { padding-left: 640px;} +.prepend-17 { padding-left: 680px;} +.prepend-18 { padding-left: 720px;} +.prepend-19 { padding-left: 760px;} +.prepend-20 { padding-left: 800px;} +.prepend-21 { padding-left: 840px;} +.prepend-22 { padding-left: 880px;} +.prepend-23 { padding-left: 920px;} + + +/* Border on right hand side of a column. */ +.border { + padding-right: 4px; + margin-right: 5px; + border-right: 1px solid #ddd; +} + +/* Border with more whitespace, spans one column. */ +.colborder { + padding-right: 24px; + margin-right: 25px; + border-right: 1px solid #ddd; +} + + +/* Use these classes on an element to push it into the +next column, or to pull it into the previous column. */ + + +.pull-1 { margin-left: -40px; } +.pull-2 { margin-left: -80px; } +.pull-3 { margin-left: -120px; } +.pull-4 { margin-left: -160px; } +.pull-5 { margin-left: -200px; } +.pull-6 { margin-left: -240px; } +.pull-7 { margin-left: -280px; } +.pull-8 { margin-left: -320px; } +.pull-9 { margin-left: -360px; } +.pull-10 { margin-left: -400px; } +.pull-11 { margin-left: -440px; } +.pull-12 { margin-left: -480px; } +.pull-13 { margin-left: -520px; } +.pull-14 { margin-left: -560px; } +.pull-15 { margin-left: -600px; } +.pull-16 { margin-left: -640px; } +.pull-17 { margin-left: -680px; } +.pull-18 { margin-left: -720px; } +.pull-19 { margin-left: -760px; } +.pull-20 { margin-left: -800px; } +.pull-21 { margin-left: -840px; } +.pull-22 { margin-left: -880px; } +.pull-23 { margin-left: -920px; } +.pull-24 { margin-left: -960px; } + +.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float: left; position:relative;} + + +.push-1 { margin: 0 -40px 1.5em 40px; } +.push-2 { margin: 0 -80px 1.5em 80px; } +.push-3 { margin: 0 -120px 1.5em 120px; } +.push-4 { margin: 0 -160px 1.5em 160px; } +.push-5 { margin: 0 -200px 1.5em 200px; } +.push-6 { margin: 0 -240px 1.5em 240px; } +.push-7 { margin: 0 -280px 1.5em 280px; } +.push-8 { margin: 0 -320px 1.5em 320px; } +.push-9 { margin: 0 -360px 1.5em 360px; } +.push-10 { margin: 0 -400px 1.5em 400px; } +.push-11 { margin: 0 -440px 1.5em 440px; } +.push-12 { margin: 0 -480px 1.5em 480px; } +.push-13 { margin: 0 -520px 1.5em 520px; } +.push-14 { margin: 0 -560px 1.5em 560px; } +.push-15 { margin: 0 -600px 1.5em 600px; } +.push-16 { margin: 0 -640px 1.5em 640px; } +.push-17 { margin: 0 -680px 1.5em 680px; } +.push-18 { margin: 0 -720px 1.5em 720px; } +.push-19 { margin: 0 -760px 1.5em 760px; } +.push-20 { margin: 0 -800px 1.5em 800px; } +.push-21 { margin: 0 -840px 1.5em 840px; } +.push-22 { margin: 0 -880px 1.5em 880px; } +.push-23 { margin: 0 -920px 1.5em 920px; } +.push-24 { margin: 0 -960px 1.5em 960px; } + +.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float: left; position:relative;} + + +/* Misc classes and elements +-------------------------------------------------------------- */ + +/* In case you need to add a gutter above/below an element */ +div.prepend-top, .prepend-top { + margin-top:1.5em; +} +div.append-bottom, .append-bottom { + margin-bottom:1.5em; +} + +/* Use a .box to create a padded box inside a column. */ +.box { + padding: 1.5em; + margin-bottom: 1.5em; + background: #e5eCf9; +} + +/* Use this to create a horizontal ruler across a column. */ +hr { + background: #ddd; + color: #ddd; + clear: both; + float: none; + width: 100%; + height: 1px; + margin: 0 0 1.45em; + border: none; +} + +hr.space { + background: #fff; + color: #fff; + visibility: hidden; +} + + +/* Clearing floats without extra markup + Based on How To Clear Floats Without Structural Markup by PiE + [http://www.positioniseverything.net/easyclearing.html] */ + +.clearfix:after, .container:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + visibility: hidden; + overflow:hidden; +} +.clearfix, .container {display: block;} + +/* Regular clearing + apply to column that should drop below previous ones. */ + +.clear { clear:both; } diff --git a/public/stylesheets/blueprint/src/grid.png b/public/stylesheets/blueprint/src/grid.png new file mode 100755 index 0000000..d42a6c3 Binary files /dev/null and b/public/stylesheets/blueprint/src/grid.png differ diff --git a/public/stylesheets/blueprint/src/ie.css b/public/stylesheets/blueprint/src/ie.css new file mode 100755 index 0000000..0f458e6 --- /dev/null +++ b/public/stylesheets/blueprint/src/ie.css @@ -0,0 +1,76 @@ +/* -------------------------------------------------------------- + + ie.css + + Contains every hack for Internet Explorer, + so that our core files stay sweet and nimble. + +-------------------------------------------------------------- */ + +/* Make sure the layout is centered in IE5 */ +body { text-align: center; } +.container { text-align: left; } + +/* Fixes IE margin bugs */ +* html .column, * html .span-1, * html .span-2, +* html .span-3, * html .span-4, * html .span-5, +* html .span-6, * html .span-7, * html .span-8, +* html .span-9, * html .span-10, * html .span-11, +* html .span-12, * html .span-13, * html .span-14, +* html .span-15, * html .span-16, * html .span-17, +* html .span-18, * html .span-19, * html .span-20, +* html .span-21, * html .span-22, * html .span-23, +* html .span-24 { display:inline; overflow-x: hidden; } + + +/* Elements +-------------------------------------------------------------- */ + +/* Fixes incorrect styling of legend in IE6. */ +* html legend { margin:0px -8px 16px 0; padding:0; } + +/* Fixes wrong line-height on sup/sub in IE. */ +sup { vertical-align:text-top; } +sub { vertical-align:text-bottom; } + +/* Fixes IE7 missing wrapping of code elements. */ +html>body p code { *white-space: normal; } + +/* IE 6&7 has problems with setting proper <hr> margins. */ +hr { margin:-8px auto 11px; } + +/* Explicitly set interpolation, allowing dynamically resized images to not look horrible */ +img { -ms-interpolation-mode:bicubic; } + +/* Clearing +-------------------------------------------------------------- */ + +/* Makes clearfix actually work in IE */ +.clearfix, .container { display:inline-block; } +* html .clearfix, +* html .container { height:1%; } + + +/* Forms +-------------------------------------------------------------- */ + +/* Fixes padding on fieldset */ +fieldset { padding-top:0; } + +/* Makes classic textareas in IE 6 resemble other browsers */ +textarea { overflow:auto; } + +/* Fixes rule that IE 6 ignores */ +input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; } +input.text:focus, input.title:focus { border-color:#666; } +input.text, input.title, textarea, select { margin:0.5em 0; } +input.checkbox, input.radio { position:relative; top:.25em; } + +/* Fixes alignment of inline form elements */ +form.inline div, form.inline p { vertical-align:middle; } +form.inline label { position:relative;top:-0.25em; } +form.inline input.checkbox, form.inline input.radio, +form.inline input.button, form.inline button { + margin:0.5em 0; +} +button, input.button { position:relative;top:0.25em; } diff --git a/public/stylesheets/blueprint/src/print.css b/public/stylesheets/blueprint/src/print.css new file mode 100755 index 0000000..bbc7948 --- /dev/null +++ b/public/stylesheets/blueprint/src/print.css @@ -0,0 +1,85 @@ +/* -------------------------------------------------------------- + + print.css + * Gives you some sensible styles for printing pages. + * See Readme file in this directory for further instructions. + + Some additions you'll want to make, customized to your markup: + #header, #footer, #navigation { display:none; } + +-------------------------------------------------------------- */ + +body { + line-height: 1.5; + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; + color:#000; + background: none; + font-size: 10pt; +} + + +/* Layout +-------------------------------------------------------------- */ + +.container { + background: none; +} + +hr { + background:#ccc; + color:#ccc; + width:100%; + height:2px; + margin:2em 0; + padding:0; + border:none; +} +hr.space { + background: #fff; + color: #fff; + visibility: hidden; +} + + +/* Text +-------------------------------------------------------------- */ + +h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; } +code { font:.9em "Courier New", Monaco, Courier, monospace; } + +a img { border:none; } +p img.top { margin-top: 0; } + +blockquote { + margin:1.5em; + padding:1em; + font-style:italic; + font-size:.9em; +} + +.small { font-size: .9em; } +.large { font-size: 1.1em; } +.quiet { color: #999; } +.hide { display:none; } + + +/* Links +-------------------------------------------------------------- */ + +a:link, a:visited { + background: transparent; + font-weight:700; + text-decoration: underline; +} + +a:link:after, a:visited:after { + content: " (" attr(href) ")"; + font-size: 90%; +} + +/* If you're having trouble printing relative links, uncomment and customize this: + (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */ + +/* a[href^="/"]:after { + content: " (http://www.yourdomain.com" attr(href) ") "; +} */ diff --git a/public/stylesheets/blueprint/src/reset.css b/public/stylesheets/blueprint/src/reset.css new file mode 100755 index 0000000..1417c4c --- /dev/null +++ b/public/stylesheets/blueprint/src/reset.css @@ -0,0 +1,67 @@ +/* -------------------------------------------------------------- + + reset.css + * Resets default browser CSS. + +-------------------------------------------------------------- */ + +html { + margin:0; + padding:0; + border:0; +} + +body, div, span, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, code, +del, dfn, em, img, q, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, dialog, figure, footer, header, +hgroup, nav, section { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} + +/* This helps to make newer HTML5 elements behave like DIVs in older browers */ +article, aside, dialog, figure, footer, header, +hgroup, nav, section { + display:block; +} + +/* Line-height should always be unitless! */ +body { + line-height: 1.5; + background: white; +} + +/* Tables still need 'cellspacing="0"' in the markup. */ +table { + border-collapse: separate; + border-spacing: 0; +} +/* float:none prevents the span-x classes from breaking table-cell display */ +caption, th, td { + text-align: left; + font-weight: normal; + float:none !important; +} +table, th, td { + vertical-align: middle; +} + +/* Remove possible quote marks (") from <q>, <blockquote>. */ +blockquote:before, blockquote:after, q:before, q:after { content: ''; } +blockquote, q { quotes: "" ""; } + +/* Remove annoying border on linked images. */ +a img { border: none; } + +/* Remember to define your own focus styles! */ +:focus { outline: 0; } \ No newline at end of file diff --git a/public/stylesheets/blueprint/src/typography.css b/public/stylesheets/blueprint/src/typography.css new file mode 100755 index 0000000..f46de03 --- /dev/null +++ b/public/stylesheets/blueprint/src/typography.css @@ -0,0 +1,106 @@ +/* -------------------------------------------------------------- + + typography.css + * Sets up some sensible default typography. + +-------------------------------------------------------------- */ + +/* Default font settings. + The font-size percentage is of 16px. (0.75 * 16px = 12px) */ +html { font-size:100.01%; } +body { + font-size: 75%; + color: #222; + background: #fff; + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; +} + + +/* Headings +-------------------------------------------------------------- */ + +h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; } + +h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; } +h2 { font-size: 2em; margin-bottom: 0.75em; } +h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; } +h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; } +h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; } +h6 { font-size: 1em; font-weight: bold; } + +h1 img, h2 img, h3 img, +h4 img, h5 img, h6 img { + margin: 0; +} + + +/* Text elements +-------------------------------------------------------------- */ + +p { margin: 0 0 1.5em; } +p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } +p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; } + +a:focus, +a:hover { color: #09f; } +a { color: #06c; text-decoration: underline; } + +blockquote { margin: 1.5em; color: #666; font-style: italic; } +strong { font-weight: bold; } +em,dfn { font-style: italic; } +dfn { font-weight: bold; } +sup, sub { line-height: 0; } + +abbr, +acronym { border-bottom: 1px dotted #666; } +address { margin: 0 0 1.5em; font-style: italic; } +del { color:#666; } + +pre { margin: 1.5em 0; white-space: pre; } +pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } + + +/* Lists +-------------------------------------------------------------- */ + +li ul, +li ol { margin: 0; } +ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; } + +ul { list-style-type: disc; } +ol { list-style-type: decimal; } + +dl { margin: 0 0 1.5em 0; } +dl dt { font-weight: bold; } +dd { margin-left: 1.5em;} + + +/* Tables +-------------------------------------------------------------- */ + +table { margin-bottom: 1.4em; width:100%; } +th { font-weight: bold; } +thead th { background: #c3d9ff; } +th,td,caption { padding: 4px 10px 4px 5px; } +tr.even td { background: #e5ecf9; } +tfoot { font-style: italic; } +caption { background: #eee; } + + +/* Misc classes +-------------------------------------------------------------- */ + +.small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; } +.large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; } +.hide { display: none; } + +.quiet { color: #666; } +.loud { color: #000; } +.highlight { background:#ff0; } +.added { background:#060; color: #fff; } +.removed { background:#900; color: #fff; } + +.first { margin-left:0; padding-left:0; } +.last { margin-right:0; padding-right:0; } +.top { margin-top:0; padding-top:0; } +.bottom { margin-bottom:0; padding-bottom:0; } diff --git a/public/stylesheets/custom.css b/public/stylesheets/custom.css new file mode 100644 index 0000000..ec46b83 --- /dev/null +++ b/public/stylesheets/custom.css @@ -0,0 +1,116 @@ +.container { + width: 710px; +} + +body { + background: #cff; +} + +header { + padding-top: 20px; +} + +header img { + padding: 1em; + background: #fff; +} + +section { + margin-top: 1em; + font-size: 120%; + padding: 20px; + background: #fff; +} + +section h1 { + font-size: 200%; +} + +/* Links */ + +a { + color: #09c; + text-decoration: none; +} + +a:hover { + color: #069; + text-decoration: underline; +} + +a:visited { + color: #069; +} + + +/* Navigation */ + +nav { + float: right; +} + +nav { + background-color: white; + padding: 0 0.7em; + white-space: nowrap; +} + +nav ul { + margin: 0; + padding: 0; +} + +nav ul li { + list-style-type: none; + display: inline-block; + padding: 0.2em 0; +} + +nav ul li a { + padding: 0 5px; + font-weight: bold; +} + +nav ul li a:visited { + color: #09c; +} + +nav ul li a:hover { + text-decoration: underline; +} + +/* Sign up button */ + +a.signup_button { + margin-left: auto; + margin-right: auto; + display: block; + text-align: center; + width: 190px; + color: #fff; + background: #006400; + font-size: 150%; + font-weight: bold; + padding: 20px; +} + +/* Round corners */ + +.round { + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +/* Footer */ +footer { + text-align: center; + margin-top: 10px; + width: 710px; + margin-left: auto; + margin-right: auto; +} + +footer nav { + float: none; +} diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/.gitignore b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/.gitignore new file mode 100755 index 0000000..e111d85 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/.gitignore @@ -0,0 +1,5 @@ +*.swp +*.svn +*.DS_Store +tmp/* +lib/settings.yml diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/AUTHORS.textile b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/AUTHORS.textile new file mode 100755 index 0000000..d873e01 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/AUTHORS.textile @@ -0,0 +1,42 @@ +h1. Blueprint CSS Framework Authors and Contributors + +Blueprint is based on the work of many talented people. It is +through their good intentions we are allowed to use many of the +techniques found in the framework. + +h2. Current Team + +Blueprint was realized and maintained through version 0.7.1 by +"Olav Bjorkoy":http://bjorkoy.com who has sinced passed the torch +to the current team. They are: + +Admins: +* "Christian Montoya":http://christianmontoya.net +* "Josh Clayton":http://jdclayton.com + +Contributors: +* "Glenn Rempe":http://blog.rempe.us/ +* "Chris Eppstein":http://twitter.com/chriseppstein +* "Sean K. Stewart":http://seankstewart.com/ + +h2. Original CSS authors + +The first iteration of Blueprint was built upon many conventions +and ideas that were developed by true CSS experts. + +The grid and typography is based on work by: +* "Jeff Croft":http://jeffcroft.com +* "Nathan Borror":http://www.playgroundblues.com +* "Christian Metts":http://mintchaos.com +* "Wilson Miner":http://www.wilsonminer.com + +The CSS reset is based on work by: +* "Eric Meyer":http://www.meyerweb.com/eric + +The Fancy Type plugin is based on work by: +* "Mark Boulton":http://www.markboulton.co.uk +* "Typogrify":http://typogrify.googlecode.com + +(However, remember that these people are not involved with the +framework, so please don't waste their or your time asking them +for support.) diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/CHANGELOG b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/CHANGELOG new file mode 100755 index 0000000..7c94e3b --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/CHANGELOG @@ -0,0 +1,159 @@ +Blueprint CSS Framework Change Log +---------------------------------------------------------------- + +Version 0.9 - Date May 29, 2009 +-- + New features: + * Changed all conditional comments to [if lt IE 8] for IE 8 compatibility [CMM] + * Updated forms code to align inline form elements, with additions for IE 6 [CMM] + * Use <form class="inline"> for inline forms + * Use classes "text", "button", "radio" and "checkbox" on inputs for IE 6 compatibility + + +Version 0.8 - Date November 11, 2008 +-- + New features: + * Much of the flexibility of 0.6 has been pushed back into the core [CMM] + * Plugins from 0.6 are now back in the core [CMM] + + Bug fixes: + * Lots. See http://blueprintcss.lighthouseapp.com/projects/15318-blueprint-css + + +Version 0.7.1 - Date February 21, 2008 +-- + New features: + * Rubydoc for compressor [JC] + + Bug fixes: + * Fixed bug in the compressor related to Rubygems. [JC] + * <tt> should be inline, not block. [OFB] + + +Version 0.7 - February 19, 2008 +-- + New features: + * New directory structure. [OFB] + * New compressor script. [JC] + * Ability to set custom namespace for BP classes. [JC] + * Optional custom column count and widths. [JC] + * Ability to add your own CSS files. [JC] + * Custom output paths. [JC] + * Support for multiple projects. [JC] + * Semantic class naming from CSS rules. [JC] + * Automatic compression for plugins. [JC] + * Compressed version of ie.css. [OFB] + * Alternating table row colors. [OFB] + * Added class .showgrid to see the grid of any column or container. [OFB] + * No need for .column! You now have to use divs for columns, + but you can still use span/prepend/append for other elements as well. + In other words, div.span-x now implies that the element is a .column. [OFB] + + Bug fixes: + * Sidebar alignment in tests/sample.html. [OFB] + * Line-height on sub/sup. [OFB] + * Clearfix not properly applied to container. [OFB] + * Misc validation errors in tests. [OFB] + * Proper margin on address. [OFB] + * Unwanted bottom margin on nested lists. [OFB] + * Form labels with unwanted fancy-type indentation. [OFB] + * Proper margin on all form elements. [OFB] + * No margins for images in headings. [OFB] + * Push-x bottom margin. [OFB] + * Vertical align set to middle on tables. [OFB] + * Improved .notice, .error and .success color contrast. [OFB] + * Size of input[text]. [OFB] + * Baseline alignment of <h4>. [OFB] + + Misc: + * Improved structure in print.css. [OFB] + * Dual-licensed under MIT and GPL licenses. [OFB] + * Changed name of .clear to .clearfix, and added .clear (clear:both;). [OFB] + + +Version 0.6 - September 21, 2007 +-- + * Created a new plugin, "iepngfix", that adds support for PNG transparency in IE5.5+ [OFB] + * Added an IE stylesheet, updated the test files and the readme accordingly [OFB] + * Re-added improved support for em units [OFB] + * Lots of minor changes to typography.css and reset.css, provided by Christian Montoya [OFB] + * Extracted the fancy typography section in typography.css to a new plugin [OFB] + * Extracted the support for CSS buttons into a new plugin. [OFB] + * Added new plugin structure. [OFB] + * Changed some default fonts so that BP works better with ClearType in XP [OFB] + * Re-added the hack for clearing floats without extra markup. [OFB] + * Added Changelog.txt to track changes in each release. [GR] + * Cleaned up and rationalized SVN dir structure. [GR, OFB] + * print.css : removed reference to 'baseline.png' as it no longer exists. [GR] + * grid.css : removed reference to '.first' css class as it no longer exists. [GR] + * Added append-13 to append-23 and prepend-13 to prepend-23 to allow pushing elements + to both extreme sides of the grid. Added test cases to tests/grid.css [GR] + * Moved test sample files to blueprint/tests sub-directory so tests stay with the code. [GR] + * Consolidated all references to release version number to screen.css [OFB] + * Added ruby script (generate_compressed_css.rb) to scripts dir, and 'csstidy' binary (OS X Universal) + for generating tidied version of Blueprint (lib/compressed.css). + * Consolidated test pages into one single page (test.html). Uses compressed stylesheet by default. This ensures test of + the chain of generation. (todo) Intention is to delete other test files if single file works well. (todo) ensure singular + test file contains latest changes to other test files. [GR] + * Moved the blueprint framework to its own folder in the package, so that the tests, script, + license and readme don't clutter up our BP folder. [OFB] + * Re-saved grid.png with Photoshop to remove Fireworks data which was bloating it. + Now its about 3KB instead of 40+KB. Resolves Issue 22. [GR] + * Moved compressed files to new compressed dir [OFB] + * print.css is now also being generated by the compressor ruby script and is available for use. + * Added new script 'validate_css.rb' which will validate all css files and present a report with + a local java binary of the W3C validator. + * Created an experimental CSS classes plugin, by popular demand. [OFB] + * Improved handling of multi-line headings. [OFB] + * Improved styling of <table>s, you may now use .span classes on <th>s to create tables that follow the grid. [OFB] + * Added support for indented paragraphs to the Fancy-type plugin. [OFB] + * Added a new plugin: link-icons. [OFB] + * Seperated the plugins tests into their own file. [OFB] + * Re-structured some of the tests.html sections. [OFB] + * Added class ".colborder" to grid.css. [OFB] + * Added .error, .notice and .success classes to typography.css. [OFB] + * Added tests for more elements which gets reset in reset.css [OFB, GR] + * Added forms.css, awaiting implementation. Moved form styling from typography.css [OFB] + * Updated compressor script to include forms.css [OFB] + * Improved forms.html tests for upcoming forms.css implementation. This will change based on the + markup that forms.css will use. [OFB] + * Fixed clearing image in button element bug in buttons.css [OFB] + * Fixed bug where IE6 clips pushed/pulled elements. [OFB] + * Fixed typo in grid.css formula. [OFB] + * Fixed varying formatting across core files. [OFB] + * Fixed legend element in IE6. [OFB] + * Fixed indentation in test files. [OFB] + * Removed tests for plugins not bundled with the next release. [OFB] + * Improved styling of <h3>. [OFB] + * Fixed indentation bug in ul/ol, removed some redundant styling. [OFB] + * Fixed validation errors in tests. [OFB] + * Changed IE stylesheet condition comment to include all versions of IE. [OFB] + * Started on a new approach for the PNG plugin. Will not be included in this release. [OFB] + * Fixed incorrect rendering of ol in IE6/7. [OFB] + * Created a new, spiffier sample page. [OFB] + + +Version 0.5 - August 28, 2007 +-- + * Changed grid width from 14 to 24 columns [OFB] + * Removed 'first' CSS class and the need to apply it to the first column in a row of columns. [OFB] + * Reverted to using pixels instead of em units to specify vertical spacing due to baseline issues with + all browsers except Firefox. [OFB] + * New set of default fonts. (Experimental) [OFB] + * Added test files [OFB] + + +Version 0.4 - August 11, 2007 +-- + * All font sizes and vertical margins are now elastic, through the use of em units. + Resizing works great in every tested browser. [OFB] + * Comes with a new, compressed version of BP, which reduces the size of the core files by 60 percent. [OFB] + * Support for incremental leading, contributed by Mark Boulton. [OFB] + * Adds perfected CSS buttons, by Kevin Hale of Particletree fame. [OFB] + * Fixes all known IE bugs. [OFB] + * Loads of minor fixes and additions. [OFB] + + +Version 0.3 - March 8, 2007 +-- + * Initial release of Blueprint (versions 0.1 and 0.2 were internal only). diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/LICENSE b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/LICENSE new file mode 100755 index 0000000..13076fb --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2007 - 2010 blueprintcss.org + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/README.textile b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/README.textile new file mode 100755 index 0000000..f4be0a8 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/README.textile @@ -0,0 +1,83 @@ +h1. Blueprint CSS Framework Readme + +Welcome to Blueprint! This is a CSS framework designed to cut down on your CSS development time. It gives you a solid foundation to build your own CSS on. Here are some of the features BP provides out-of-the-box: + +* An easily customizable grid +* Sensible default typography +* A typographic baseline +* Perfected browser CSS reset +* A stylesheet for printing +* Powerful scripts for customization +* Absolutely no bloat! + +h2. Project Info + +* *Web*: "http://blueprintcss.org":http://blueprintcss.org +* *Source*: "http://github.com/joshuaclayton/blueprint-css":http://github.com/joshuaclayton/blueprint-css +* *Wiki*: "http://github.com/joshuaclayton/blueprint-css/wikis/home":http://github.com/joshuaclayton/blueprint-css/wikis/home +* *Bug/Feature Tracking*: "http://blueprintcss.lighthouseapp.com":http://blueprintcss.lighthouseapp.com + +h2. Setup Instructions + +Here's how you set up Blueprint on your site. + +# Upload the "blueprint" folder in this folder to your server, and place it in whatever folder you'd like. A good choice would be your CSS folder. +# Add the following three lines to every @<head/>@ of your site. Make sure the three @href@ paths are correct (here, BP is in my CSS folder): <pre><code> +<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection"> +<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print"> +<!--[if lt IE 8]> + <link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"> +<![endif]--></code></pre> +Remember to include trailing slashes (" />") in these lines if you're using XHTML. +# For development, add the .showgrid class to any container or column to see the underlying grid. Check out the @plugins@ directory for more advanced functionality. + + +h2. Tutorials + +* "How to customize BP with the compressor script":http://jdclayton.com/blueprints_compress_a_walkthrough.html +* "How to use a grid in a layout":http://subtraction.com/2007/03/18/oh-yeeaahh +* "How to use a baseline in your typography":http://alistapart.com/articles/settingtypeontheweb + +h2. Files in Blueprint + +The framework has a few files you should check out. Every file in the @src@ directory contains lots of (hopefully) clarifying comments. + +Compressed files (these go in the HTML): + +* @blueprint/screen.css@ +* @blueprint/print.css@ +* @blueprint/ie.css@ + +Source files: +* @blueprint/src/reset.css@<br/> +This file resets CSS values that browsers tend to set for you. +* @blueprint/src/grid.css@<br/> +This file sets up the grid (it's true). It has a lot of classes you apply to @<div/>@ elements to set up any sort of column-based grid. +* @blueprint/lib/blueprint/grid.css.erb@<br/> +This file is used by the compressor (see below) when generating grids. All changes to grid.css are mirrored in this file, manually. +* @blueprint/src/typography.css@<br/> +This file sets some default typography. It also has a few methods for some really fancy stuff to do with your text. +* @blueprint/src/forms.css@<br/> +Includes some minimal styling of forms. +* @blueprint/src/print.css@<br/> +This file sets some default print rules, so that printed versions of your site looks better than they usually would. It should be included on every page. +* @blueprint/src/ie.css@<br/> +Includes every hack for our beloved IE6 and 7. + +Scripts: +* @lib/compress.rb@<br/> +A Ruby script for compressing and customizing your CSS. Set a custom namespace, column count, widths, output paths, multiple projects, and semantic class names. See commenting in @compress.rb@ or run @$ruby compress.rb -h@ for more information. +* @lib/validate.rb@<br/> +Validates the Blueprint core files with the W3C CSS validator. + +Other: +* @blueprint/plugins/@<br/> +Contains additional functionality in the form of simple plugins for Blueprint. See individual readme files in the directory of each plugin for further instructions. +* @tests/@<br/> +Contains html files which tests most aspects of Blueprint. Open @tests/index.html@ for further instructions. + +h2. Extra Information + +* For credits and origins, see AUTHORS. +* For license instructions, see LICENSE. +* For the latest updates, see CHANGELOG. diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/TUTORIAL.textile b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/TUTORIAL.textile new file mode 100755 index 0000000..4ff0570 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/TUTORIAL.textile @@ -0,0 +1,206 @@ +h1. Blueprint CSS Framework Tutorial + +Welcome to this tutorial on Blueprint. It will give you a thorough intro to what you can do with the framework, and a few notes on what you shouldn't do with it. Let's get started. + +h2. About Blueprint + +Blueprint is a CSS framework, designed to cut down on your development time. It gives you a solid foundation to build your CSS on top of, including some sensible default typography, a customizable grid, a print stylesheet and much more. + +However, BP is not a silver bullet, and it's best suited for websites where each page may require its own design. Take a look at existing BP pages before deciding if the framework is right for you. You may also check out the test files in the @tests@ directory, which demonstrates most of the features in Blueprint. + +The word "framework" may be a bit misleading in this context, since BP does not make suggestions on how you should organize or write your CSS. It's more like a "css toolbox" with helpful bits and pieces, from which you may pick and choose based on your needs. + +h2. Structural Overview + +From the bottom up, here are the CSS layers in Blueprint: + +# *CSS reset*: Removes any default CSS rules set by each browser. +# *Typography*: Gives you some nice default typography and colors. +# *Grid*: Provides a set of CSS classes for making grid layouts. + +The second part of Blueprint are the scripts, which let you customize most +aspects of the framework, from column count and widths, to output paths and +CSS class namespaces. We have two scripts: + +# *Compressor*: For compressing and customizing the source files. +# *Validator*: For validating the Blueprint core files. + +That's the quick overview, so now we can finally get into the details. First, we'll take +a look at the CSS in Blueprint. We'll then move on to the scripts, where I'll show you +how to customize the framework. + +h2. Setting Up Blueprint + +To use Blueprint, you must include three files in your HTML: + +* @blueprint/screen.css@: All CSS for screen, projection viewing. +* @blueprint/print.css@: A basic stylesheet for printing. +* @blueprint/ie.css@: A few needed corrections for Internet Explorer + +To include them, use the following HTML (make sure the href paths are correct): +<pre> + <link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]> + <link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"> + <![endif]--> +</pre> +Remember to add trailing slashes if you're using XHTML (" />"). + +h2. Using the CSS in Blueprint + +As mentioned before, there's basically three layers of CSS in Blueprint. The first two layers, the browser CSS reset and the default typography, apply themselves by changing the CSS of standard HTML elements. In other words, you don't need to change anything in these files. If you, for instance, want to change the font size, do this in your own stylesheet, so that it's easy to upgrade Blueprint when new versions arrive. + +h3. Classes for Typography + +While the typography of Blueprint mainly applies itself, there's a few classes +provided. Here's a list of their names and what they do: + +<dl> + <dt>@.small@</dt><dd>Makes the text of this element smaller.</dd> + <dt>@.large@</dt><dd>Makes the text of this element larger.</dd> + <dt>@.hide@</dt><dd>Hides an element.</dd> + <dt>@.quiet@</dt><dd>Tones down the font color for this element.</dd> + <dt>@.loud@</dt><dd>Makes this elements text black.</dd> + <dt>@.highlight@</dt><dd>Adds a yellow background to the text.</dd> + <dt>@.added@</dt><dd>Adds green background to the text.</dd> + <dt>@.removed@</dt><dd>Adds red background to the text.</dd> + <dt>@.first@</dt><dd>Removes any left sided margin/padding from the element.</dd> + <dt>@.last@</dt><dd>Removes any right sided margin/padding from the element.</dd> + <dt>@.top@</dt><dd>Removes any top margin/padding from the element.</dd> + <dt>@.bottom@</dt><dd>Removes any bottom margin/padding from the element.</dd> +</dl> + +h3. Styling Forms + +To make Blueprint style your input elements, each text input element should +have the class @.text@, or @.title@, where @.text@ is the normal size, +and @.title@ gives you an input field with larger text. + +There's also a few classes you may use for success and error messages: + +<dl> + <dt>@div.error@</dt><dd>Creates an error box (red).</dd> + <dt>@div.notice@</dt><dd>Creates a box for notices (yellow).</dd> + <dt>@div.success@</dt><dd>Creates a box for success messages (green).</dd> +</dl> + +h3. Creating a Grid + +The third layer is the grid CSS classes, which is the tool Blueprint gives you to create almost any kind of grid layout for your site. Keep in mind that most of the CSS behind the grid can be customized (explained below). In this section however, I'm using the default settings. + +The default grid is made up of 24 columns, each spanning 30px, with a 10px margin between each column. The total width comes to 950px, which is a good width for 1024x768 resolution displays. If you're interested in a narrower design, see the section on customizing the grid, below. + +So how do you set up a grid? By using classes provided by Blueprint. To create a column, make a new @<div/>@, and apply one of the @.span-x@ classes to it. For instance, if you want a 3-column setup, with two narrow and one wide column, a header and a footer here's how you do it: + +<pre> + <div class="container"> + <div class="span-24"> + The header + </div> + + <div class="span-4"> + The first column + </div> + <div class="span-16"> + The center column + </div> + <div class="span-4 last"> + The last column + </div> + + <div class="span-24"> + The footer + </div> + </div> +</pre> + +In addition to the spans, there are two important classes you need to know about. First of all, every Blueprint site needs to be wrapped in a div with the class @.container@, which is usually placed right after the body tag. + +Second, the last column in a row (which by default has 24 columns), needs the class @.last@ to remove its left hand margin. Note, however, that each @.span-24@ don't need the @.last@ class, since these always span the entire width of the page. + +To create basic grids, this is all you need to know. The grid CSS however, provides many more classes for more intricate designs. To see some of them in action, check out the files in @tests/parts/@. These files demonstrate what's possible with the grid in Blueprint. + +Here's a quick overview of the other classes you can use in to make your grid: + +<dl> + <dt>@.append-x@</dt><dd>Appends x number of empty columns after a column.</dd> + <dt>@.prepend-x@</dt><dd>Preppends x number of empty columns before a column.</dd> + <dt>@.push-x@</dt><dd>Pushes a column x columns to the left. Can be used to swap columns.</dd> + <dt>@.pull-x@</dt><dd>Pulls a column x columns to the right. Can be used to swap columns.</dd> + <dt>@.border@</dt><dd>Applies a border to the right side of the column.</dd> + <dt>@.colborder@</dt><dd>Appends one empty column, with a border down the middle.</dd> + <dt>@.clear@</dt><dd>Makes a column drop below a row, regardless of space.</dd> + <dt>@.showgrid@</dt><dd>Add to container or column to see the grid and baseline.</dd> +</dl> + +In this list, @x@ is a number from 1 through 23 for append/prepend and 1 through 24 for push/pull. These numbers will of course change if you set a new number of columns in the settings file. + +Here's another example where we have four columns of equal width, with a border between the two first and the two last columns, as well as a four column gap in the middle: + +<pre> + <div class="container"> + <div class="span-5 border"> + The first column + </div> + <div class="span-5 append-4"> + The second column + </div> + <div class="span-5 border"> + The third column + </div> + <div class="span-5 last"> + The fourth (last) column + </div> + </div> +</pre> + +You may also nest columns to achieve the desired layout. Here's a setup where we want four rectangles with two on top and two below on the first half of the page, and one single column spanning the second half of the page: + +<pre> + <div class="container"> + <div class="span-12"> + <div class="span-6"> + Top left + </div> + <div class="span-6 last"> + Top right + </div> + <div class="span-6"> + Bottom left + </div> + <div class="span-6 last"> + Bottom right + </div> + </div> + <div class="span-12 last"> + Second half of page + </div> + </div> +</pre> + +Try this code in your browser it it's difficult to understand what it would look like. To see more examples on how to use these classes, check out @/tests/parts/grid.html@. + +h2. The Scripts + +Blueprint comes with two scripts: one for compressing and customizing the CSS, and one for validating the core CSS files, which is handy if you're making changes to these files. + +h3. The Validator + +The validator has a fairly simple job - validate the CSS in the core BP files. The script uses a bundled version of the W3C CSS validator to accomplish this. To run it, you'll need to have Ruby installed on your machine. You can then run the script like so: @$ ruby validate.rb@. + +Note that there are a few validation errors shipping with Blueprint. These are known, and comes from a few CSS hacks needed to ensure consistent rendering across the vast browser field. + +h3. The Compressor + +As the files you'll include in your HTML are the compressed versions of the core CSS files, you'll have to recompress the core if you've made any changes. This is what the compressor script is for. + +In addition this is where you customize the grid. To customize the grid, a special settings file is used, and the new CSS is generated once you run the compressor. The new compressed files will then reflect your settings file. + +To recompress, you just have to run the script. This will parse the core CSS files and output new compressed files in the blueprint folder. As with the validator, Ruby has to be installed to use this script. In the @lib@ directory, run: @$ruby compress.rb@ + +Calling this file by itself will pull files from @blueprint/src@ and concatenate them into three files; @ie.css@, @print.css@, and @screen.css@. However, argument variables can be set to change how this works. Calling @$ruby compress.rb -h@ will reveal basic arguments you can pass to the script. + +h3. Custom Settings + +To learn how to use custom settings, read through the documentation within @lib/compress.rb@ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/ie.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/ie.css new file mode 100755 index 0000000..3dddda9 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/ie.css @@ -0,0 +1,35 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* ie.css */ +body {text-align:center;} +.container {text-align:left;} +* html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {display:inline;overflow-x:hidden;} +* html legend {margin:0px -8px 16px 0;padding:0;} +sup {vertical-align:text-top;} +sub {vertical-align:text-bottom;} +html>body p code {*white-space:normal;} +hr {margin:-8px auto 11px;} +img {-ms-interpolation-mode:bicubic;} +.clearfix, .container {display:inline-block;} +* html .clearfix, * html .container {height:1%;} +fieldset {padding-top:0;} +textarea {overflow:auto;} +input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} +input.text:focus, input.title:focus {border-color:#666;} +input.text, input.title, textarea, select {margin:0.5em 0;} +input.checkbox, input.radio {position:relative;top:.25em;} +form.inline div, form.inline p {vertical-align:middle;} +form.inline label {position:relative;top:-0.25em;} +form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} +button, input.button {position:relative;top:0.25em;} \ No newline at end of file diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/cross.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/cross.png new file mode 100755 index 0000000..1514d51 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/cross.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/key.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/key.png new file mode 100755 index 0000000..a9d5e4f Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/key.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/tick.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/tick.png new file mode 100755 index 0000000..a9925a0 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/icons/tick.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/readme.txt b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/readme.txt new file mode 100755 index 0000000..aa9fe26 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/readme.txt @@ -0,0 +1,32 @@ +Buttons + +* Gives you great looking CSS buttons, for both <a> and <button>. +* Demo: particletree.com/features/rediscovering-the-button-element + + +Credits +---------------------------------------------------------------- + +* Created by Kevin Hale [particletree.com] +* Adapted for Blueprint by Olav Bjorkoy [bjorkoy.com] + + +Usage +---------------------------------------------------------------- + +1) Add this plugin to lib/settings.yml. + See compress.rb for instructions. + +2) Use the following HTML code to place the buttons on your site: + + <button type="submit" class="button positive"> + <img src="css/blueprint/plugins/buttons/icons/tick.png" alt=""/> Save + </button> + + <a class="button" href="/password/reset/"> + <img src="css/blueprint/plugins/buttons/icons/key.png" alt=""/> Change Password + </a> + + <a href="#" class="button negative"> + <img src="css/blueprint/plugins/buttons/icons/cross.png" alt=""/> Cancel + </a> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/screen.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/screen.css new file mode 100755 index 0000000..bb66b21 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/buttons/screen.css @@ -0,0 +1,97 @@ +/* -------------------------------------------------------------- + + buttons.css + * Gives you some great CSS-only buttons. + + Created by Kevin Hale [particletree.com] + * particletree.com/features/rediscovering-the-button-element + + See Readme.txt in this folder for instructions. + +-------------------------------------------------------------- */ + +a.button, button { + display:block; + float:left; + margin: 0.7em 0.5em 0.7em 0; + padding:5px 10px 5px 7px; /* Links */ + + border:1px solid #dedede; + border-top:1px solid #eee; + border-left:1px solid #eee; + + background-color:#f5f5f5; + font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; + font-size:100%; + line-height:130%; + text-decoration:none; + font-weight:bold; + color:#565656; + cursor:pointer; +} +button { + width:auto; + overflow:visible; + padding:4px 10px 3px 7px; /* IE6 */ +} +button[type] { + padding:4px 10px 4px 7px; /* Firefox */ + line-height:17px; /* Safari */ +} +*:first-child+html button[type] { + padding:4px 10px 3px 7px; /* IE7 */ +} +button img, a.button img{ + margin:0 3px -3px 0 !important; + padding:0; + border:none; + width:16px; + height:16px; + float:none; +} + + +/* Button colors +-------------------------------------------------------------- */ + +/* Standard */ +button:hover, a.button:hover{ + background-color:#dff4ff; + border:1px solid #c2e1ef; + color:#336699; +} +a.button:active{ + background-color:#6299c5; + border:1px solid #6299c5; + color:#fff; +} + +/* Positive */ +body .positive { + color:#529214; +} +a.positive:hover, button.positive:hover { + background-color:#E6EFC2; + border:1px solid #C6D880; + color:#529214; +} +a.positive:active { + background-color:#529214; + border:1px solid #529214; + color:#fff; +} + +/* Negative */ +body .negative { + color:#d12f19; +} +a.negative:hover, button.negative:hover { + background-color:#fbe3e4; + border:1px solid #fbc2c4; + color:#d12f19; +} +a.negative:active { + background-color:#d12f19; + border:1px solid #d12f19; + color:#fff; +} diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/readme.txt b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/readme.txt new file mode 100755 index 0000000..85f2491 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/readme.txt @@ -0,0 +1,14 @@ +Fancy Type + +* Gives you classes to use if you'd like some + extra fancy typography. + +Credits and instructions are specified above each class +in the fancy-type.css file in this directory. + + +Usage +---------------------------------------------------------------- + +1) Add this plugin to lib/settings.yml. + See compress.rb for instructions. diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/screen.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/screen.css new file mode 100755 index 0000000..127cf25 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/fancy-type/screen.css @@ -0,0 +1,71 @@ +/* -------------------------------------------------------------- + + fancy-type.css + * Lots of pretty advanced classes for manipulating text. + + See the Readme file in this folder for additional instructions. + +-------------------------------------------------------------- */ + +/* Indentation instead of line shifts for sibling paragraphs. */ + p + p { text-indent:2em; margin-top:-1.5em; } + form p + p { text-indent: 0; } /* Don't want this in forms. */ + + +/* For great looking type, use this code instead of asdf: + <span class="alt">asdf</span> + Best used on prepositions and ampersands. */ + +.alt { + color: #666; + font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif; + font-style: italic; + font-weight: normal; +} + + +/* For great looking quote marks in titles, replace "asdf" with: + <span class="dquo">&#8220;</span>asdf&#8221; + (That is, when the title starts with a quote mark). + (You may have to change this value depending on your font size). */ + +.dquo { margin-left: -.5em; } + + +/* Reduced size type with incremental leading + (http://www.markboulton.co.uk/journal/comments/incremental_leading/) + + This could be used for side notes. For smaller type, you don't necessarily want to + follow the 1.5x vertical rhythm -- the line-height is too much. + + Using this class, it reduces your font size and line-height so that for + every four lines of normal sized type, there is five lines of the sidenote. eg: + + New type size in em's: + 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems) + + New line-height value: + 12px x 1.5 = 18px (old line-height) + 18px x 4 = 72px + 72px / 5 = 14.4px (new line height) + 14.4px / 10px = 1.44 (new line height in em's) */ + +p.incr, .incr p { + font-size: 10px; + line-height: 1.44em; + margin-bottom: 1.5em; +} + + +/* Surround uppercase words and abbreviations with this class. + Based on work by Jørgen Arnor GÃ¥rdsø Lom [http://twistedintellect.com/] */ + +.caps { + font-variant: small-caps; + letter-spacing: 1px; + text-transform: lowercase; + font-size:1.2em; + line-height:1%; + font-weight:bold; + padding:0 2px; +} diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/doc.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/doc.png new file mode 100755 index 0000000..834cdfa Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/doc.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/email.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/email.png new file mode 100755 index 0000000..7348aed Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/email.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/external.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/external.png new file mode 100755 index 0000000..cf1cfb4 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/external.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/feed.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/feed.png new file mode 100755 index 0000000..315c4f4 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/feed.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/im.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/im.png new file mode 100755 index 0000000..79f35cc Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/im.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/pdf.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/pdf.png new file mode 100755 index 0000000..8f8095e Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/pdf.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/visited.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/visited.png new file mode 100755 index 0000000..ebf206d Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/visited.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/xls.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/xls.png new file mode 100755 index 0000000..b977d7e Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/icons/xls.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/readme.txt b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/readme.txt new file mode 100755 index 0000000..fc4dc64 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/readme.txt @@ -0,0 +1,18 @@ +Link Icons +* Icons for links based on protocol or file type. + +This is not supported in IE versions < 7. + + +Credits +---------------------------------------------------------------- + +* Marc Morgan +* Olav Bjorkoy [bjorkoy.com] + + +Usage +---------------------------------------------------------------- + +1) Add this line to your HTML: + <link rel="stylesheet" href="css/blueprint/plugins/link-icons/screen.css" type="text/css" media="screen, projection"> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/screen.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/screen.css new file mode 100755 index 0000000..7b4bef9 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/link-icons/screen.css @@ -0,0 +1,40 @@ +/* -------------------------------------------------------------- + + link-icons.css + * Icons for links based on protocol or file type. + + See the Readme file in this folder for additional instructions. + +-------------------------------------------------------------- */ + +/* Use this class if a link gets an icon when it shouldn't. */ +body a.noicon { + background:transparent none !important; + padding:0 !important; + margin:0 !important; +} + +/* Make sure the icons are not cut */ +a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, +a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], +a[href$=".rdf"], a[href^="aim:"] { + padding:2px 22px 2px 0; + margin:-2px 0; + background-repeat: no-repeat; + background-position: right center; +} + +/* External links */ +a[href^="http:"] { background-image: url(icons/external.png); } +a[href^="mailto:"] { background-image: url(icons/email.png); } +a[href^="http:"]:visited { background-image: url(icons/visited.png); } + +/* Files */ +a[href$=".pdf"] { background-image: url(icons/pdf.png); } +a[href$=".doc"] { background-image: url(icons/doc.png); } +a[href$=".xls"] { background-image: url(icons/xls.png); } + +/* Misc */ +a[href$=".rss"], +a[href$=".rdf"] { background-image: url(icons/feed.png); } +a[href^="aim:"] { background-image: url(icons/im.png); } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/readme.txt b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/readme.txt new file mode 100755 index 0000000..5564c40 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/readme.txt @@ -0,0 +1,10 @@ +RTL +* Mirrors Blueprint, so it can be used with Right-to-Left languages. + +By Ran Yaniv Hartstein, ranh.co.il + +Usage +---------------------------------------------------------------- + +1) Add this line to your HTML: + <link rel="stylesheet" href="css/blueprint/plugins/rtl/screen.css" type="text/css" media="screen, projection"> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/screen.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/screen.css new file mode 100755 index 0000000..7db7eb5 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/plugins/rtl/screen.css @@ -0,0 +1,110 @@ +/* -------------------------------------------------------------- + + rtl.css + * Mirrors Blueprint for left-to-right languages + + By Ran Yaniv Hartstein [ranh.co.il] + +-------------------------------------------------------------- */ + +body .container { direction: rtl; } +body .column, body .span-1, body .span-2, body .span-3, body .span-4, body .span-5, body .span-6, body .span-7, body .span-8, body .span-9, body .span-10, body .span-11, body .span-12, body .span-13, body .span-14, body .span-15, body .span-16, body .span-17, body .span-18, body .span-19, body .span-20, body .span-21, body .span-22, body .span-23, body .span-24 { + float: right; + margin-right: 0; + margin-left: 10px; + text-align:right; +} + +body div.last { margin-left: 0; } +body table .last { padding-left: 0; } + +body .append-1 { padding-right: 0; padding-left: 40px; } +body .append-2 { padding-right: 0; padding-left: 80px; } +body .append-3 { padding-right: 0; padding-left: 120px; } +body .append-4 { padding-right: 0; padding-left: 160px; } +body .append-5 { padding-right: 0; padding-left: 200px; } +body .append-6 { padding-right: 0; padding-left: 240px; } +body .append-7 { padding-right: 0; padding-left: 280px; } +body .append-8 { padding-right: 0; padding-left: 320px; } +body .append-9 { padding-right: 0; padding-left: 360px; } +body .append-10 { padding-right: 0; padding-left: 400px; } +body .append-11 { padding-right: 0; padding-left: 440px; } +body .append-12 { padding-right: 0; padding-left: 480px; } +body .append-13 { padding-right: 0; padding-left: 520px; } +body .append-14 { padding-right: 0; padding-left: 560px; } +body .append-15 { padding-right: 0; padding-left: 600px; } +body .append-16 { padding-right: 0; padding-left: 640px; } +body .append-17 { padding-right: 0; padding-left: 680px; } +body .append-18 { padding-right: 0; padding-left: 720px; } +body .append-19 { padding-right: 0; padding-left: 760px; } +body .append-20 { padding-right: 0; padding-left: 800px; } +body .append-21 { padding-right: 0; padding-left: 840px; } +body .append-22 { padding-right: 0; padding-left: 880px; } +body .append-23 { padding-right: 0; padding-left: 920px; } + +body .prepend-1 { padding-left: 0; padding-right: 40px; } +body .prepend-2 { padding-left: 0; padding-right: 80px; } +body .prepend-3 { padding-left: 0; padding-right: 120px; } +body .prepend-4 { padding-left: 0; padding-right: 160px; } +body .prepend-5 { padding-left: 0; padding-right: 200px; } +body .prepend-6 { padding-left: 0; padding-right: 240px; } +body .prepend-7 { padding-left: 0; padding-right: 280px; } +body .prepend-8 { padding-left: 0; padding-right: 320px; } +body .prepend-9 { padding-left: 0; padding-right: 360px; } +body .prepend-10 { padding-left: 0; padding-right: 400px; } +body .prepend-11 { padding-left: 0; padding-right: 440px; } +body .prepend-12 { padding-left: 0; padding-right: 480px; } +body .prepend-13 { padding-left: 0; padding-right: 520px; } +body .prepend-14 { padding-left: 0; padding-right: 560px; } +body .prepend-15 { padding-left: 0; padding-right: 600px; } +body .prepend-16 { padding-left: 0; padding-right: 640px; } +body .prepend-17 { padding-left: 0; padding-right: 680px; } +body .prepend-18 { padding-left: 0; padding-right: 720px; } +body .prepend-19 { padding-left: 0; padding-right: 760px; } +body .prepend-20 { padding-left: 0; padding-right: 800px; } +body .prepend-21 { padding-left: 0; padding-right: 840px; } +body .prepend-22 { padding-left: 0; padding-right: 880px; } +body .prepend-23 { padding-left: 0; padding-right: 920px; } + +body .border { + padding-right: 0; + padding-left: 4px; + margin-right: 0; + margin-left: 5px; + border-right: none; + border-left: 1px solid #eee; +} + +body .colborder { + padding-right: 0; + padding-left: 24px; + margin-right: 0; + margin-left: 25px; + border-right: none; + border-left: 1px solid #eee; +} + +body .pull-1 { margin-left: 0; margin-right: -40px; } +body .pull-2 { margin-left: 0; margin-right: -80px; } +body .pull-3 { margin-left: 0; margin-right: -120px; } +body .pull-4 { margin-left: 0; margin-right: -160px; } + +body .push-0 { margin: 0 18px 0 0; } +body .push-1 { margin: 0 18px 0 -40px; } +body .push-2 { margin: 0 18px 0 -80px; } +body .push-3 { margin: 0 18px 0 -120px; } +body .push-4 { margin: 0 18px 0 -160px; } +body .push-0, body .push-1, body .push-2, +body .push-3, body .push-4 { float: left; } + + +/* Typography with RTL support */ +body h1,body h2,body h3, +body h4,body h5,body h6 { font-family: Arial, sans-serif; } +html body { font-family: Arial, sans-serif; } +body pre,body code,body tt { font-family: monospace; } + +/* Mirror floats and margins on typographic elements */ +body p img { float: right; margin: 1.5em 0 1.5em 1.5em; } +body dd, body ul, body ol { margin-left: 0; margin-right: 1.5em;} +body td, body th { text-align:right; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/print.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/print.css new file mode 100755 index 0000000..fdb8220 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/print.css @@ -0,0 +1,29 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* print.css */ +body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;} +.container {background:none;} +hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;} +code {font:.9em "Courier New", Monaco, Courier, monospace;} +a img {border:none;} +p img.top {margin-top:0;} +blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;} +.small {font-size:.9em;} +.large {font-size:1.1em;} +.quiet {color:#999;} +.hide {display:none;} +a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;} +a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;} \ No newline at end of file diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/screen.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/screen.css new file mode 100755 index 0000000..521ced8 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/screen.css @@ -0,0 +1,262 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html {margin:0;padding:0;border:0;} +body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;background:white;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;float:none !important;} +table, th, td {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:'';} +blockquote, q {quotes:"" "";} +a img {border:none;} +:focus {outline:0;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#09f;} +a {color:#06c;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:1.5em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#e5ecf9;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;} +.notice {background:#fff6bf;color:#514721;border-color:#ffd324;} +.success {background:#e6efc2;color:#264409;border-color:#c6d880;} +.info {background:#d5edf8;color:#205791;border-color:#92cae4;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.info a {color:#205791;} + +/* grid.css */ +.container {width:950px;margin:0 auto;} +.showgrid {background:url(src/grid.png);} +.column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 {float:left;margin-right:10px;} +.last {margin-right:0;} +.span-1 {width:30px;} +.span-2 {width:70px;} +.span-3 {width:110px;} +.span-4 {width:150px;} +.span-5 {width:190px;} +.span-6 {width:230px;} +.span-7 {width:270px;} +.span-8 {width:310px;} +.span-9 {width:350px;} +.span-10 {width:390px;} +.span-11 {width:430px;} +.span-12 {width:470px;} +.span-13 {width:510px;} +.span-14 {width:550px;} +.span-15 {width:590px;} +.span-16 {width:630px;} +.span-17 {width:670px;} +.span-18 {width:710px;} +.span-19 {width:750px;} +.span-20 {width:790px;} +.span-21 {width:830px;} +.span-22 {width:870px;} +.span-23 {width:910px;} +.span-24 {width:950px;margin-right:0;} +input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {border-left-width:1px;border-right-width:1px;padding-left:5px;padding-right:5px;} +input.span-1, textarea.span-1 {width:18px;} +input.span-2, textarea.span-2 {width:58px;} +input.span-3, textarea.span-3 {width:98px;} +input.span-4, textarea.span-4 {width:138px;} +input.span-5, textarea.span-5 {width:178px;} +input.span-6, textarea.span-6 {width:218px;} +input.span-7, textarea.span-7 {width:258px;} +input.span-8, textarea.span-8 {width:298px;} +input.span-9, textarea.span-9 {width:338px;} +input.span-10, textarea.span-10 {width:378px;} +input.span-11, textarea.span-11 {width:418px;} +input.span-12, textarea.span-12 {width:458px;} +input.span-13, textarea.span-13 {width:498px;} +input.span-14, textarea.span-14 {width:538px;} +input.span-15, textarea.span-15 {width:578px;} +input.span-16, textarea.span-16 {width:618px;} +input.span-17, textarea.span-17 {width:658px;} +input.span-18, textarea.span-18 {width:698px;} +input.span-19, textarea.span-19 {width:738px;} +input.span-20, textarea.span-20 {width:778px;} +input.span-21, textarea.span-21 {width:818px;} +input.span-22, textarea.span-22 {width:858px;} +input.span-23, textarea.span-23 {width:898px;} +input.span-24, textarea.span-24 {width:938px;} +.append-1 {padding-right:40px;} +.append-2 {padding-right:80px;} +.append-3 {padding-right:120px;} +.append-4 {padding-right:160px;} +.append-5 {padding-right:200px;} +.append-6 {padding-right:240px;} +.append-7 {padding-right:280px;} +.append-8 {padding-right:320px;} +.append-9 {padding-right:360px;} +.append-10 {padding-right:400px;} +.append-11 {padding-right:440px;} +.append-12 {padding-right:480px;} +.append-13 {padding-right:520px;} +.append-14 {padding-right:560px;} +.append-15 {padding-right:600px;} +.append-16 {padding-right:640px;} +.append-17 {padding-right:680px;} +.append-18 {padding-right:720px;} +.append-19 {padding-right:760px;} +.append-20 {padding-right:800px;} +.append-21 {padding-right:840px;} +.append-22 {padding-right:880px;} +.append-23 {padding-right:920px;} +.prepend-1 {padding-left:40px;} +.prepend-2 {padding-left:80px;} +.prepend-3 {padding-left:120px;} +.prepend-4 {padding-left:160px;} +.prepend-5 {padding-left:200px;} +.prepend-6 {padding-left:240px;} +.prepend-7 {padding-left:280px;} +.prepend-8 {padding-left:320px;} +.prepend-9 {padding-left:360px;} +.prepend-10 {padding-left:400px;} +.prepend-11 {padding-left:440px;} +.prepend-12 {padding-left:480px;} +.prepend-13 {padding-left:520px;} +.prepend-14 {padding-left:560px;} +.prepend-15 {padding-left:600px;} +.prepend-16 {padding-left:640px;} +.prepend-17 {padding-left:680px;} +.prepend-18 {padding-left:720px;} +.prepend-19 {padding-left:760px;} +.prepend-20 {padding-left:800px;} +.prepend-21 {padding-left:840px;} +.prepend-22 {padding-left:880px;} +.prepend-23 {padding-left:920px;} +.border {padding-right:4px;margin-right:5px;border-right:1px solid #ddd;} +.colborder {padding-right:24px;margin-right:25px;border-right:1px solid #ddd;} +.pull-1 {margin-left:-40px;} +.pull-2 {margin-left:-80px;} +.pull-3 {margin-left:-120px;} +.pull-4 {margin-left:-160px;} +.pull-5 {margin-left:-200px;} +.pull-6 {margin-left:-240px;} +.pull-7 {margin-left:-280px;} +.pull-8 {margin-left:-320px;} +.pull-9 {margin-left:-360px;} +.pull-10 {margin-left:-400px;} +.pull-11 {margin-left:-440px;} +.pull-12 {margin-left:-480px;} +.pull-13 {margin-left:-520px;} +.pull-14 {margin-left:-560px;} +.pull-15 {margin-left:-600px;} +.pull-16 {margin-left:-640px;} +.pull-17 {margin-left:-680px;} +.pull-18 {margin-left:-720px;} +.pull-19 {margin-left:-760px;} +.pull-20 {margin-left:-800px;} +.pull-21 {margin-left:-840px;} +.pull-22 {margin-left:-880px;} +.pull-23 {margin-left:-920px;} +.pull-24 {margin-left:-960px;} +.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;} +.push-1 {margin:0 -40px 1.5em 40px;} +.push-2 {margin:0 -80px 1.5em 80px;} +.push-3 {margin:0 -120px 1.5em 120px;} +.push-4 {margin:0 -160px 1.5em 160px;} +.push-5 {margin:0 -200px 1.5em 200px;} +.push-6 {margin:0 -240px 1.5em 240px;} +.push-7 {margin:0 -280px 1.5em 280px;} +.push-8 {margin:0 -320px 1.5em 320px;} +.push-9 {margin:0 -360px 1.5em 360px;} +.push-10 {margin:0 -400px 1.5em 400px;} +.push-11 {margin:0 -440px 1.5em 440px;} +.push-12 {margin:0 -480px 1.5em 480px;} +.push-13 {margin:0 -520px 1.5em 520px;} +.push-14 {margin:0 -560px 1.5em 560px;} +.push-15 {margin:0 -600px 1.5em 600px;} +.push-16 {margin:0 -640px 1.5em 640px;} +.push-17 {margin:0 -680px 1.5em 680px;} +.push-18 {margin:0 -720px 1.5em 720px;} +.push-19 {margin:0 -760px 1.5em 760px;} +.push-20 {margin:0 -800px 1.5em 800px;} +.push-21 {margin:0 -840px 1.5em 840px;} +.push-22 {margin:0 -880px 1.5em 880px;} +.push-23 {margin:0 -920px 1.5em 920px;} +.push-24 {margin:0 -960px 1.5em 960px;} +.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:left;position:relative;} +div.prepend-top, .prepend-top {margin-top:1.5em;} +div.append-bottom, .append-bottom {margin-bottom:1.5em;} +.box {padding:1.5em;margin-bottom:1.5em;background:#e5eCf9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:1px;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} \ No newline at end of file diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/forms.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/forms.css new file mode 100755 index 0000000..8b2c8e9 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/forms.css @@ -0,0 +1,68 @@ +/* -------------------------------------------------------------- + + forms.css + * Sets up some default styling for forms + * Gives you classes to enhance your forms + + Usage: + * For text fields, use class .title or .text + * For inline forms, use .inline (even when using columns) + +-------------------------------------------------------------- */ + +label { font-weight: bold; } +fieldset { padding:1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; } +legend { font-weight: bold; font-size:1.2em; } + + +/* Form fields +-------------------------------------------------------------- */ + +input[type=text], input[type=password], +input.text, input.title, +textarea, select { + background-color:#fff; + border:1px solid #bbb; +} +input[type=text]:focus, input[type=password]:focus, +input.text:focus, input.title:focus, +textarea:focus, select:focus { + border-color:#666; +} + +input[type=text], input[type=password], +input.text, input.title, +textarea, select { + margin:0.5em 0; +} + +input.text, +input.title { width: 300px; padding:5px; } +input.title { font-size:1.5em; } +textarea { width: 390px; height: 250px; padding:5px; } + +input[type=checkbox], input[type=radio], +input.checkbox, input.radio { + position:relative; top:.25em; +} + +form.inline { line-height:3; } +form.inline p { margin-bottom:0; } + + +/* Success, notice and error boxes +-------------------------------------------------------------- */ + +.error, +.notice, +.success, +.info { padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; } + +.error { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; } +.notice { background: #fff6bf; color: #514721; border-color: #ffd324; } +.success { background: #e6efc2; color: #264409; border-color: #c6d880; } +.info { background: #d5edf8; color: #205791; border-color: #92cae4; } +.error a { color: #8a1f11; } +.notice a { color: #514721; } +.success a { color: #264409; } +.info a { color: #205791; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.css new file mode 100755 index 0000000..c102c1f --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.css @@ -0,0 +1,280 @@ +/* -------------------------------------------------------------- + + grid.css + * Sets up an easy-to-use grid of 24 columns. + + By default, the grid is 950px wide, with 24 columns + spanning 30px, and a 10px margin between columns. + + If you need fewer or more columns, namespaces or semantic + element names, use the compressor script (lib/compress.rb) + +-------------------------------------------------------------- */ + +/* A container should group all your columns. */ +.container { + width: 950px; + margin: 0 auto; +} + +/* Use this class on any .span / container to see the grid. */ +.showgrid { + background: url(src/grid.png); +} + + +/* Columns +-------------------------------------------------------------- */ + +/* Sets up basic grid floating and margin. */ +.column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 { + float: left; + margin-right: 10px; +} + +/* The last column in a row needs this class. */ +.last { margin-right: 0; } + +/* Use these classes to set the width of a column. */ +.span-1 {width: 30px;} + +.span-2 {width: 70px;} +.span-3 {width: 110px;} +.span-4 {width: 150px;} +.span-5 {width: 190px;} +.span-6 {width: 230px;} +.span-7 {width: 270px;} +.span-8 {width: 310px;} +.span-9 {width: 350px;} +.span-10 {width: 390px;} +.span-11 {width: 430px;} +.span-12 {width: 470px;} +.span-13 {width: 510px;} +.span-14 {width: 550px;} +.span-15 {width: 590px;} +.span-16 {width: 630px;} +.span-17 {width: 670px;} +.span-18 {width: 710px;} +.span-19 {width: 750px;} +.span-20 {width: 790px;} +.span-21 {width: 830px;} +.span-22 {width: 870px;} +.span-23 {width: 910px;} +.span-24 {width:950px; margin-right:0;} + +/* Use these classes to set the width of an input. */ +input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 { + border-left-width: 1px; + border-right-width: 1px; + padding-left: 5px; + padding-right: 5px; +} + +input.span-1, textarea.span-1 { width: 18px; } +input.span-2, textarea.span-2 { width: 58px; } +input.span-3, textarea.span-3 { width: 98px; } +input.span-4, textarea.span-4 { width: 138px; } +input.span-5, textarea.span-5 { width: 178px; } +input.span-6, textarea.span-6 { width: 218px; } +input.span-7, textarea.span-7 { width: 258px; } +input.span-8, textarea.span-8 { width: 298px; } +input.span-9, textarea.span-9 { width: 338px; } +input.span-10, textarea.span-10 { width: 378px; } +input.span-11, textarea.span-11 { width: 418px; } +input.span-12, textarea.span-12 { width: 458px; } +input.span-13, textarea.span-13 { width: 498px; } +input.span-14, textarea.span-14 { width: 538px; } +input.span-15, textarea.span-15 { width: 578px; } +input.span-16, textarea.span-16 { width: 618px; } +input.span-17, textarea.span-17 { width: 658px; } +input.span-18, textarea.span-18 { width: 698px; } +input.span-19, textarea.span-19 { width: 738px; } +input.span-20, textarea.span-20 { width: 778px; } +input.span-21, textarea.span-21 { width: 818px; } +input.span-22, textarea.span-22 { width: 858px; } +input.span-23, textarea.span-23 { width: 898px; } +input.span-24, textarea.span-24 { width: 938px; } + +/* Add these to a column to append empty cols. */ + +.append-1 { padding-right: 40px;} +.append-2 { padding-right: 80px;} +.append-3 { padding-right: 120px;} +.append-4 { padding-right: 160px;} +.append-5 { padding-right: 200px;} +.append-6 { padding-right: 240px;} +.append-7 { padding-right: 280px;} +.append-8 { padding-right: 320px;} +.append-9 { padding-right: 360px;} +.append-10 { padding-right: 400px;} +.append-11 { padding-right: 440px;} +.append-12 { padding-right: 480px;} +.append-13 { padding-right: 520px;} +.append-14 { padding-right: 560px;} +.append-15 { padding-right: 600px;} +.append-16 { padding-right: 640px;} +.append-17 { padding-right: 680px;} +.append-18 { padding-right: 720px;} +.append-19 { padding-right: 760px;} +.append-20 { padding-right: 800px;} +.append-21 { padding-right: 840px;} +.append-22 { padding-right: 880px;} +.append-23 { padding-right: 920px;} + +/* Add these to a column to prepend empty cols. */ + +.prepend-1 { padding-left: 40px;} +.prepend-2 { padding-left: 80px;} +.prepend-3 { padding-left: 120px;} +.prepend-4 { padding-left: 160px;} +.prepend-5 { padding-left: 200px;} +.prepend-6 { padding-left: 240px;} +.prepend-7 { padding-left: 280px;} +.prepend-8 { padding-left: 320px;} +.prepend-9 { padding-left: 360px;} +.prepend-10 { padding-left: 400px;} +.prepend-11 { padding-left: 440px;} +.prepend-12 { padding-left: 480px;} +.prepend-13 { padding-left: 520px;} +.prepend-14 { padding-left: 560px;} +.prepend-15 { padding-left: 600px;} +.prepend-16 { padding-left: 640px;} +.prepend-17 { padding-left: 680px;} +.prepend-18 { padding-left: 720px;} +.prepend-19 { padding-left: 760px;} +.prepend-20 { padding-left: 800px;} +.prepend-21 { padding-left: 840px;} +.prepend-22 { padding-left: 880px;} +.prepend-23 { padding-left: 920px;} + + +/* Border on right hand side of a column. */ +.border { + padding-right: 4px; + margin-right: 5px; + border-right: 1px solid #ddd; +} + +/* Border with more whitespace, spans one column. */ +.colborder { + padding-right: 24px; + margin-right: 25px; + border-right: 1px solid #ddd; +} + + +/* Use these classes on an element to push it into the +next column, or to pull it into the previous column. */ + + +.pull-1 { margin-left: -40px; } +.pull-2 { margin-left: -80px; } +.pull-3 { margin-left: -120px; } +.pull-4 { margin-left: -160px; } +.pull-5 { margin-left: -200px; } +.pull-6 { margin-left: -240px; } +.pull-7 { margin-left: -280px; } +.pull-8 { margin-left: -320px; } +.pull-9 { margin-left: -360px; } +.pull-10 { margin-left: -400px; } +.pull-11 { margin-left: -440px; } +.pull-12 { margin-left: -480px; } +.pull-13 { margin-left: -520px; } +.pull-14 { margin-left: -560px; } +.pull-15 { margin-left: -600px; } +.pull-16 { margin-left: -640px; } +.pull-17 { margin-left: -680px; } +.pull-18 { margin-left: -720px; } +.pull-19 { margin-left: -760px; } +.pull-20 { margin-left: -800px; } +.pull-21 { margin-left: -840px; } +.pull-22 { margin-left: -880px; } +.pull-23 { margin-left: -920px; } +.pull-24 { margin-left: -960px; } + +.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float: left; position:relative;} + + +.push-1 { margin: 0 -40px 1.5em 40px; } +.push-2 { margin: 0 -80px 1.5em 80px; } +.push-3 { margin: 0 -120px 1.5em 120px; } +.push-4 { margin: 0 -160px 1.5em 160px; } +.push-5 { margin: 0 -200px 1.5em 200px; } +.push-6 { margin: 0 -240px 1.5em 240px; } +.push-7 { margin: 0 -280px 1.5em 280px; } +.push-8 { margin: 0 -320px 1.5em 320px; } +.push-9 { margin: 0 -360px 1.5em 360px; } +.push-10 { margin: 0 -400px 1.5em 400px; } +.push-11 { margin: 0 -440px 1.5em 440px; } +.push-12 { margin: 0 -480px 1.5em 480px; } +.push-13 { margin: 0 -520px 1.5em 520px; } +.push-14 { margin: 0 -560px 1.5em 560px; } +.push-15 { margin: 0 -600px 1.5em 600px; } +.push-16 { margin: 0 -640px 1.5em 640px; } +.push-17 { margin: 0 -680px 1.5em 680px; } +.push-18 { margin: 0 -720px 1.5em 720px; } +.push-19 { margin: 0 -760px 1.5em 760px; } +.push-20 { margin: 0 -800px 1.5em 800px; } +.push-21 { margin: 0 -840px 1.5em 840px; } +.push-22 { margin: 0 -880px 1.5em 880px; } +.push-23 { margin: 0 -920px 1.5em 920px; } +.push-24 { margin: 0 -960px 1.5em 960px; } + +.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float: left; position:relative;} + + +/* Misc classes and elements +-------------------------------------------------------------- */ + +/* In case you need to add a gutter above/below an element */ +div.prepend-top, .prepend-top { + margin-top:1.5em; +} +div.append-bottom, .append-bottom { + margin-bottom:1.5em; +} + +/* Use a .box to create a padded box inside a column. */ +.box { + padding: 1.5em; + margin-bottom: 1.5em; + background: #e5eCf9; +} + +/* Use this to create a horizontal ruler across a column. */ +hr { + background: #ddd; + color: #ddd; + clear: both; + float: none; + width: 100%; + height: 1px; + margin: 0 0 1.45em; + border: none; +} + +hr.space { + background: #fff; + color: #fff; + visibility: hidden; +} + + +/* Clearing floats without extra markup + Based on How To Clear Floats Without Structural Markup by PiE + [http://www.positioniseverything.net/easyclearing.html] */ + +.clearfix:after, .container:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + visibility: hidden; + overflow:hidden; +} +.clearfix, .container {display: block;} + +/* Regular clearing + apply to column that should drop below previous ones. */ + +.clear { clear:both; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.png new file mode 100755 index 0000000..d42a6c3 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/grid.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/ie.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/ie.css new file mode 100755 index 0000000..0f458e6 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/ie.css @@ -0,0 +1,76 @@ +/* -------------------------------------------------------------- + + ie.css + + Contains every hack for Internet Explorer, + so that our core files stay sweet and nimble. + +-------------------------------------------------------------- */ + +/* Make sure the layout is centered in IE5 */ +body { text-align: center; } +.container { text-align: left; } + +/* Fixes IE margin bugs */ +* html .column, * html .span-1, * html .span-2, +* html .span-3, * html .span-4, * html .span-5, +* html .span-6, * html .span-7, * html .span-8, +* html .span-9, * html .span-10, * html .span-11, +* html .span-12, * html .span-13, * html .span-14, +* html .span-15, * html .span-16, * html .span-17, +* html .span-18, * html .span-19, * html .span-20, +* html .span-21, * html .span-22, * html .span-23, +* html .span-24 { display:inline; overflow-x: hidden; } + + +/* Elements +-------------------------------------------------------------- */ + +/* Fixes incorrect styling of legend in IE6. */ +* html legend { margin:0px -8px 16px 0; padding:0; } + +/* Fixes wrong line-height on sup/sub in IE. */ +sup { vertical-align:text-top; } +sub { vertical-align:text-bottom; } + +/* Fixes IE7 missing wrapping of code elements. */ +html>body p code { *white-space: normal; } + +/* IE 6&7 has problems with setting proper <hr> margins. */ +hr { margin:-8px auto 11px; } + +/* Explicitly set interpolation, allowing dynamically resized images to not look horrible */ +img { -ms-interpolation-mode:bicubic; } + +/* Clearing +-------------------------------------------------------------- */ + +/* Makes clearfix actually work in IE */ +.clearfix, .container { display:inline-block; } +* html .clearfix, +* html .container { height:1%; } + + +/* Forms +-------------------------------------------------------------- */ + +/* Fixes padding on fieldset */ +fieldset { padding-top:0; } + +/* Makes classic textareas in IE 6 resemble other browsers */ +textarea { overflow:auto; } + +/* Fixes rule that IE 6 ignores */ +input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; } +input.text:focus, input.title:focus { border-color:#666; } +input.text, input.title, textarea, select { margin:0.5em 0; } +input.checkbox, input.radio { position:relative; top:.25em; } + +/* Fixes alignment of inline form elements */ +form.inline div, form.inline p { vertical-align:middle; } +form.inline label { position:relative;top:-0.25em; } +form.inline input.checkbox, form.inline input.radio, +form.inline input.button, form.inline button { + margin:0.5em 0; +} +button, input.button { position:relative;top:0.25em; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/print.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/print.css new file mode 100755 index 0000000..bbc7948 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/print.css @@ -0,0 +1,85 @@ +/* -------------------------------------------------------------- + + print.css + * Gives you some sensible styles for printing pages. + * See Readme file in this directory for further instructions. + + Some additions you'll want to make, customized to your markup: + #header, #footer, #navigation { display:none; } + +-------------------------------------------------------------- */ + +body { + line-height: 1.5; + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; + color:#000; + background: none; + font-size: 10pt; +} + + +/* Layout +-------------------------------------------------------------- */ + +.container { + background: none; +} + +hr { + background:#ccc; + color:#ccc; + width:100%; + height:2px; + margin:2em 0; + padding:0; + border:none; +} +hr.space { + background: #fff; + color: #fff; + visibility: hidden; +} + + +/* Text +-------------------------------------------------------------- */ + +h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; } +code { font:.9em "Courier New", Monaco, Courier, monospace; } + +a img { border:none; } +p img.top { margin-top: 0; } + +blockquote { + margin:1.5em; + padding:1em; + font-style:italic; + font-size:.9em; +} + +.small { font-size: .9em; } +.large { font-size: 1.1em; } +.quiet { color: #999; } +.hide { display:none; } + + +/* Links +-------------------------------------------------------------- */ + +a:link, a:visited { + background: transparent; + font-weight:700; + text-decoration: underline; +} + +a:link:after, a:visited:after { + content: " (" attr(href) ")"; + font-size: 90%; +} + +/* If you're having trouble printing relative links, uncomment and customize this: + (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */ + +/* a[href^="/"]:after { + content: " (http://www.yourdomain.com" attr(href) ") "; +} */ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/reset.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/reset.css new file mode 100755 index 0000000..1417c4c --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/reset.css @@ -0,0 +1,67 @@ +/* -------------------------------------------------------------- + + reset.css + * Resets default browser CSS. + +-------------------------------------------------------------- */ + +html { + margin:0; + padding:0; + border:0; +} + +body, div, span, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, code, +del, dfn, em, img, q, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, dialog, figure, footer, header, +hgroup, nav, section { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} + +/* This helps to make newer HTML5 elements behave like DIVs in older browers */ +article, aside, dialog, figure, footer, header, +hgroup, nav, section { + display:block; +} + +/* Line-height should always be unitless! */ +body { + line-height: 1.5; + background: white; +} + +/* Tables still need 'cellspacing="0"' in the markup. */ +table { + border-collapse: separate; + border-spacing: 0; +} +/* float:none prevents the span-x classes from breaking table-cell display */ +caption, th, td { + text-align: left; + font-weight: normal; + float:none !important; +} +table, th, td { + vertical-align: middle; +} + +/* Remove possible quote marks (") from <q>, <blockquote>. */ +blockquote:before, blockquote:after, q:before, q:after { content: ''; } +blockquote, q { quotes: "" ""; } + +/* Remove annoying border on linked images. */ +a img { border: none; } + +/* Remember to define your own focus styles! */ +:focus { outline: 0; } \ No newline at end of file diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/typography.css b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/typography.css new file mode 100755 index 0000000..f46de03 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/blueprint/src/typography.css @@ -0,0 +1,106 @@ +/* -------------------------------------------------------------- + + typography.css + * Sets up some sensible default typography. + +-------------------------------------------------------------- */ + +/* Default font settings. + The font-size percentage is of 16px. (0.75 * 16px = 12px) */ +html { font-size:100.01%; } +body { + font-size: 75%; + color: #222; + background: #fff; + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; +} + + +/* Headings +-------------------------------------------------------------- */ + +h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; } + +h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; } +h2 { font-size: 2em; margin-bottom: 0.75em; } +h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; } +h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; } +h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; } +h6 { font-size: 1em; font-weight: bold; } + +h1 img, h2 img, h3 img, +h4 img, h5 img, h6 img { + margin: 0; +} + + +/* Text elements +-------------------------------------------------------------- */ + +p { margin: 0 0 1.5em; } +p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } +p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; } + +a:focus, +a:hover { color: #09f; } +a { color: #06c; text-decoration: underline; } + +blockquote { margin: 1.5em; color: #666; font-style: italic; } +strong { font-weight: bold; } +em,dfn { font-style: italic; } +dfn { font-weight: bold; } +sup, sub { line-height: 0; } + +abbr, +acronym { border-bottom: 1px dotted #666; } +address { margin: 0 0 1.5em; font-style: italic; } +del { color:#666; } + +pre { margin: 1.5em 0; white-space: pre; } +pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } + + +/* Lists +-------------------------------------------------------------- */ + +li ul, +li ol { margin: 0; } +ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; } + +ul { list-style-type: disc; } +ol { list-style-type: decimal; } + +dl { margin: 0 0 1.5em 0; } +dl dt { font-weight: bold; } +dd { margin-left: 1.5em;} + + +/* Tables +-------------------------------------------------------------- */ + +table { margin-bottom: 1.4em; width:100%; } +th { font-weight: bold; } +thead th { background: #c3d9ff; } +th,td,caption { padding: 4px 10px 4px 5px; } +tr.even td { background: #e5ecf9; } +tfoot { font-style: italic; } +caption { background: #eee; } + + +/* Misc classes +-------------------------------------------------------------- */ + +.small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; } +.large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; } +.hide { display: none; } + +.quiet { color: #666; } +.loud { color: #000; } +.highlight { background:#ff0; } +.added { background:#060; color: #fff; } +.removed { background:#900; color: #fff; } + +.first { margin-left:0; padding-left:0; } +.last { margin-right:0; padding-right:0; } +.top { margin-top:0; padding-top:0; } +.bottom { margin-bottom:0; padding-bottom:0; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/blueprint.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/blueprint.rb new file mode 100755 index 0000000..55f4274 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/blueprint.rb @@ -0,0 +1,39 @@ +require 'fileutils' +module Blueprint + # path to the root Blueprint directory + ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "../../") + # path to where the Blueprint CSS files are stored + BLUEPRINT_ROOT_PATH = File.join(Blueprint::ROOT_PATH, "blueprint") + # path to where the Blueprint CSS raw CSS files are stored + SOURCE_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, "src") + # path to where the Blueprint CSS generated test files are stored + TEST_PATH = File.join(Blueprint::ROOT_PATH, "tests") + # path to the root of the Blueprint scripts + LIB_PATH = File.join(Blueprint::ROOT_PATH, "lib", "blueprint") + # path to where Blueprint plugins are stored + PLUGINS_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, "plugins") + # settings YAML file where custom user settings are saved + SETTINGS_FILE = File.join(Blueprint::ROOT_PATH, "lib", "settings.yml") + # path to validator jar file to validate generated CSS files + VALIDATOR_FILE = File.join(Blueprint::LIB_PATH, "validate", "css-validator.jar") + # hash of compressed and source CSS files + CSS_FILES = { + "screen.css" => ["reset.css", "typography.css", "forms.css", "grid.css"], + "print.css" => ["print.css"], + "ie.css" => ["ie.css"] + } + + # default number of columns for Blueprint layout + COLUMN_COUNT = 24 + # default column width (in pixels) for Blueprint layout + COLUMN_WIDTH = 30 + # default gutter width (in pixels) for Blueprint layout + GUTTER_WIDTH = 10 + + INPUT_PADDING = 5 + INPUT_BORDER = 1 +end + +Dir["#{File.join(Blueprint::LIB_PATH)}/*"].each do |file| + require file if file =~ /\.rb$/ && file !~ /blueprint\.rb/ +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/compressor.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/compressor.rb new file mode 100755 index 0000000..7e102d8 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/compressor.rb @@ -0,0 +1,290 @@ +require "yaml" +require "optparse" +module Blueprint + class Compressor + TEST_FILES = ["index.html", + "parts/elements.html", + "parts/forms.html", + "parts/grid.html", + "parts/sample.html"] + + attr_accessor :namespace, :custom_css, :custom_layout, :semantic_classes, :project_name, :plugins + attr_reader :custom_path, :loaded_from_settings, :destination_path, :script_name + + # overridden setter method for destination_path + # also sets custom_path flag on Blueprint::Compressor instance + def destination_path=(path) + @destination_path = path + @custom_path = @destination_path != Blueprint::BLUEPRINT_ROOT_PATH + end + + # constructor + def initialize + # set up defaults + @script_name = File.basename($0) + @loaded_from_settings = false + @settings_file = Blueprint::SETTINGS_FILE + self.namespace = "" + self.destination_path = Blueprint::BLUEPRINT_ROOT_PATH + self.custom_layout = CustomLayout.new + self.project_name = nil + self.custom_css = {} + self.semantic_classes = {} + self.plugins = [] + + self.options.parse!(ARGV) + initialize_project_from_yaml(self.project_name) + end + + # generates output CSS based on any args passed in + # overwrites any existing CSS, as well as grid.png and tests + def generate! + output_header # information to the user (in the console) describing custom settings + generate_css_files # loops through Blueprint::CSS_FILES to generate output CSS + generate_tests # updates HTML with custom namespaces in order to test the generated library. TODO: have tests kick out to custom location + output_footer # informs the user that the CSS generation process is complete + end + + def options #:nodoc:# + OptionParser.new do |o| + o.set_summary_indent(" ") + o.banner = "Usage: #{@script_name} [options]" + o.define_head "Blueprint Compressor" + o.separator "" + o.separator "options" + o.on( "-fSETTINGS_FILE", "--settings_file=SETTINGS_FILE", String, + "Specify a non-default settings file path.") { |file| @settings_file = file } + o.on( "-oOUTPUT_PATH", "--output_path=OUTPUT_PATH", String, + "Define a different path to output generated CSS files to.") { |path| self.destination_path = path } + o.on( "-nBP_NAMESPACE", "--namespace=BP_NAMESPACE", String, + "Define a namespace prepended to all Blueprint classes (e.g. .your-ns-span-24)") { |ns| self.namespace = ns } + o.on( "-pPROJECT_NAME", "--project=PROJECT_NAME", String, + "If using the settings.yml file, PROJECT_NAME is the project name you want to export") {|project| @project_name = project } + o.on( "--column_width=COLUMN_WIDTH", Integer, + "Set a new column width (in pixels) for the output grid") {|cw| self.custom_layout.column_width = cw } + o.on( "--gutter_width=GUTTER_WIDTH", Integer, + "Set a new gutter width (in pixels) for the output grid") {|gw| self.custom_layout.gutter_width = gw } + o.on( "--column_count=COLUMN_COUNT", Integer, + "Set a new column count for the output grid") {|cc| self.custom_layout.column_count = cc } + #o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| } + o.on("-h", "--help", "Show this help message.") { puts o; exit } + end + end + + private + + # attempts to load output settings from settings.yml + def initialize_project_from_yaml(project_name = nil) + # ensures project_name is set and settings.yml is present + return unless (project_name && File.exist?(@settings_file)) + + # loads yaml into hash + projects = YAML::load(File.path_to_string(@settings_file)) + + if (project = projects[project_name]) # checks to see if project info is present + self.destination_path = if self.destination_path == Blueprint::BLUEPRINT_ROOT_PATH + project["path"] + else + self.destination_path + end + self.destination_path ||= Blueprint::BLUEPRINT_ROOT_PATH + self.namespace = project["namespace"] || "" + self.custom_css = project["custom_css"] || {} + self.semantic_classes = project["semantic_classes"] || {} + self.plugins = project["plugins"] || [] + + if (layout = project["custom_layout"]) + self.custom_layout = CustomLayout.new(:column_count => layout["column_count"], + :column_width => layout["column_width"], + :gutter_width => layout["gutter_width"], + :input_padding => layout["input_padding"], + :input_border => layout["input_border"]) + end + @loaded_from_settings = true + end + end + + def generate_css_files + Blueprint::CSS_FILES.each do |output_file_name, css_source_file_names| + css_output_path = File.join(destination_path, output_file_name) + puts "\n Assembling to #{custom_path ? css_output_path : "default blueprint path"}" + + # CSS file generation + css_output = css_file_header # header included on all three Blueprint-generated files + css_output += "\n\n" + + # Iterate through src/ .css files and compile to individual core compressed file + css_source_file_names.each do |css_source_file| + puts " + src/#{css_source_file}" + css_output += "/* #{css_source_file} */\n" if css_source_file_names.any? + + source_options = if self.custom_layout && css_source_file == "grid.css" + self.custom_layout.generate_grid_css + else + File.path_to_string File.join(Blueprint::SOURCE_PATH, css_source_file) + end + + css_output += Blueprint::CSSParser.new(source_options, + :namespace => namespace).to_s + css_output += "\n" + end + + #append CSS from plugins + css_output = append_plugin_css(css_output, output_file_name) + + # append CSS from custom files + css_output = append_custom_css(css_output, output_file_name) + + #save CSS to correct path, stripping out any extra whitespace at the end of the file + File.string_to_file(css_output.rstrip, css_output_path) + end + + # append semantic class names if set + append_semantic_classes + + #attempt to generate a grid.png file + if (grid_builder = GridBuilder.new(:column_width => self.custom_layout.column_width, + :gutter_width => self.custom_layout.gutter_width, + :output_path => File.join(self.destination_path, "src"))) + grid_builder.generate! + end + end + + def append_custom_css(css, current_file_name) + # check to see if a custom (non-default) location was used for output files + # if custom path is used, handle custom CSS, if any + return css unless self.custom_path and self.custom_css[current_file_name] + + self.custom_css[current_file_name].each do |custom_css| + overwrite_base = custom_css || "my-#{current_file_name}" + overwrite_path = File.join(destination_path, overwrite_base) + overwrite_css = if File.exists?(overwrite_path) + File.path_to_string(overwrite_path) + else + "" + end + + # if there's CSS present, add it to the CSS output + unless overwrite_css.blank? + puts " + custom styles (#{custom_css})\n" + css += "/* #{overwrite_base} */\n" + css += CSSParser.new(overwrite_css).to_s + "\n" + end + end + + css + end + + def append_plugin_css(css, current_file_name) + return css unless self.plugins.any? + + plugin_css = "" + + self.plugins.each do |plugin| + plugin_file_specific = File.join(Blueprint::PLUGINS_PATH, plugin, current_file_name) + plugin_file_generic = File.join(Blueprint::PLUGINS_PATH, plugin, "#{plugin}.css") + + file = if File.exists?(plugin_file_specific) + plugin_file_specific + elsif File.exists?(plugin_file_generic) && current_file_name =~ /^screen|print/ + plugin_file_generic + end + + if file + puts " + #{plugin} plugin\n" + plugin_css += "/* #{plugin} */\n" + plugin_css += CSSParser.new(File.path_to_string(file)).to_s + "\n" + + Dir.glob(File.join(File.dirname(file), "**", "**")).each do |cp| + short_path = cp.gsub(/#{File.dirname(file)}./ , "") + # make directory if it doesn't exist + directory = File.dirname(short_path) + if directory != "." + FileUtils.mkdir_p(File.join(destination_path, directory)) + end + + unless File.directory?(File.join(File.dirname(file), short_path)) || cp == file + FileUtils.cp(cp, File.join(destination_path, short_path)) + end + end + end + end + + css += plugin_css + end + + def append_semantic_classes + screen_output_path = File.join(self.destination_path, "screen.css") + semantic_classes = SemanticClassNames.new(:namespace => self.namespace, + :source_file => screen_output_path) + semantic_styles = semantic_classes.css_from_assignments(self.semantic_classes) + return if semantic_styles.blank? + + css = File.path_to_string(screen_output_path) + css += "\n\n/* semantic class names */\n" + css += semantic_styles + File.string_to_file(css.rstrip, screen_output_path) + end + + def generate_tests + puts "\n Updating namespace to \"#{namespace}\" in test files:" + test_files = Compressor::TEST_FILES.map do |file| + File.join(Blueprint::TEST_PATH, *file.split(/\//)) + end + + test_files.each do |file| + puts " + #{file}" + Namespace.new(file, namespace) + end + end + + def output_header + puts "\n" + puts " #{"*" * 100}" + puts " **" + puts " ** Blueprint CSS Compressor" + puts " **" + puts " ** Builds compressed files from the source directory." + puts " **" + puts " ** Loaded from settings.yml" if loaded_from_settings + puts " ** Namespace: '#{namespace}'" unless namespace.blank? + puts " ** Output to: #{destination_path}" + puts " ** Grid Settings:" + puts " ** - Column Count: #{self.custom_layout.column_count}" + puts " ** - Column Width: #{self.custom_layout.column_width}px" + puts " ** - Gutter Width: #{self.custom_layout.gutter_width}px" + puts " ** - Total Width : #{self.custom_layout.page_width}px" + puts " **" + puts " #{"*" * 100}" + end + + def output_footer + puts "\n\n" + puts " #{"*" * 100}" + puts " **" + puts " ** Done!" + puts " ** Your compressed files and test files are now up-to-date." + puts " **" + puts " #{"*" * 100}\n\n" + end + + def css_file_header +%(/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */) + end + + def putsv(str) + puts str if $verbose + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/core_ext.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/core_ext.rb new file mode 100755 index 0000000..ecc7544 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/core_ext.rb @@ -0,0 +1,39 @@ +class String + # see if string has any content + def blank?; self.length.zero?; end + + # strip space after :, remove newlines, replace multiple spaces with only one space, remove comments + def strip_space! + replace self.gsub(/:\s*/, ":").gsub(/\n/, "").gsub(/\s+/, " ").gsub(/(\/\*).*?(\*\/)/, "") + end + + # remove newlines, insert space after comma, replace two spaces with one space after comma + def strip_selector_space! + replace self.gsub(/\n/, "").gsub(",", ", ").gsub(", ", ", ") + end + + # remove leading whitespace, remove end whitespace + def strip_side_space! + replace self.gsub(/^\s+/, "").gsub(/\s+$/, $/) + end +end + +class NilClass + def blank? + true + end +end + +class File + # string output from file + def self.path_to_string(path) + File.new(path).read + end + + # saves a string to a specified file path + def self.string_to_file(string, path) + directory = File.dirname(path) + FileUtils.mkdir_p directory unless File.directory?(directory) + File.open(path, "w") { |f| f << string } + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/css_parser.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/css_parser.rb new file mode 100755 index 0000000..1af72e5 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/css_parser.rb @@ -0,0 +1,72 @@ +module Blueprint + # Strips out most whitespace and can return a hash or string of parsed data + class CSSParser + attr_accessor :namespace + attr_reader :css_output, :raw_data + + # ==== Options + # * <tt>css_string</tt> String of CSS data + # * <tt>options</tt> + # * <tt>:namespace</tt> -- Namespace to use when generating output + def initialize(css_string = "", options = {}) + @raw_data = css_string + @namespace = options[:namespace] || "" + compress(@raw_data) + end + + # returns string of CSS which can be saved to a file or otherwise + def to_s + @css_output + end + + # returns a hash of all CSS data passed + # + # ==== Options + # * <tt>data</tt> -- CSS string; defaults to string passed into the constructor + def parse(data = nil) + data ||= @raw_data + + # wrapper array holding hashes of css tags/rules + css_out = [] + # clear initial spaces + data.strip_side_space!.strip_space! + + # split on end of assignments + data.split('}').each_with_index do |assignments, index| + # split again to separate tags from rules + tags, styles = assignments.split('{').map{|a| a.strip_side_space!} + unless styles.blank? + # clean up tags and apply namespaces as needed + tags.strip_selector_space! + tags.gsub!(/\./, ".#{namespace}") unless namespace.blank? + + # split on semicolon to iterate through each rule + rules = [] + styles.split(";").each do |key_val_pair| + unless key_val_pair.nil? + # split by property/val and append to rules array with correct declaration + property, value = key_val_pair.split(":", 2).map {|kv| kv.strip_side_space! } + break unless property && value + rules << "#{property}:#{value};" + end + end + # now keeps track of index as hashes don't keep track of position + # (which will be fixed in Ruby 1.9) + unless tags.blank? || rules.to_s.blank? + css_out << {:tags => tags, :rules => rules.join, :idx => index} + end + end + end + css_out + end + + private + + def compress(data) + @css_output = "" + parse(data).flatten.sort_by {|i| i[:idx]}.each do |line| + @css_output += "#{line[:tags]} {#{line[:rules]}}\n" + end + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/custom_layout.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/custom_layout.rb new file mode 100755 index 0000000..ccef91d --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/custom_layout.rb @@ -0,0 +1,72 @@ +require 'erb' +module Blueprint + # Generates a custom grid file, using ERB to evaluate custom settings + class CustomLayout + # path to ERB file used for CSS template + CSS_ERB_FILE = File.join(Blueprint::LIB_PATH, 'grid.css.erb') + + attr_writer :column_count, :column_width, :gutter_width, :input_padding, + :input_border + + # Column count of generated CSS. Returns itself or Blueprint's default + def column_count + (@column_count || Blueprint::COLUMN_COUNT).to_i + end + + # Column width (in pixels) of generated CSS. Returns itself or Blueprint's default + def column_width + (@column_width || Blueprint::COLUMN_WIDTH).to_i + end + + # Gutter width (in pixels) of generated CSS. Returns itself or Blueprint's default + def gutter_width + (@gutter_width || Blueprint::GUTTER_WIDTH).to_i + end + + def input_padding + (@input_padding || Blueprint::INPUT_PADDING).to_i + end + + def input_border + (@input_border || Blueprint::INPUT_BORDER).to_i + end + + # Returns page width (in pixels) + def page_width + column_count * (column_width + gutter_width) - gutter_width + end + + # ==== Options + # * <tt>options</tt> + # * <tt>:column_count</tt> -- Sets the column count of generated CSS + # * <tt>:column_width</tt> -- Sets the column width (in pixels) of generated CSS + # * <tt>:gutter_width</tt> -- Sets the gutter width (in pixels) of generated CSS + # * <tt>:input_padding</tt> -- Sets the input padding width (in pixels) of generated CSS + # * <tt>:input_border</tt> -- Sets the border width (in pixels) of generated CSS + def initialize(options = {}) + @column_count = options[:column_count] + @column_width = options[:column_width] + @gutter_width = options[:gutter_width] + @input_padding = options[:input_padding] + @input_border = options[:input_border] + end + + # Boolean value if current settings are Blueprint's defaults + def default? + self.column_width == Blueprint::COLUMN_WIDTH && + self.column_count == Blueprint::COLUMN_COUNT && + self.gutter_width == Blueprint::GUTTER_WIDTH && + self.input_padding == Blueprint::INPUT_PADDING && + self.input_border == Blueprint::INPUT_BORDER + end + + # Loads grid.css.erb file, binds it to current instance, and returns output + def generate_grid_css + # loads up erb template to evaluate custom widths + css = ERB::new(File.path_to_string(CustomLayout::CSS_ERB_FILE)) + + # bind it to this instance + css.result(binding) + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid.css.erb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid.css.erb new file mode 100755 index 0000000..618408a --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid.css.erb @@ -0,0 +1,146 @@ +/* -------------------------------------------------------------- + + grid.css + * Sets up an easy-to-use grid of 24 columns. + + By default, the grid is 950px wide, with 24 columns + spanning 30px, and a 10px margin between columns. + + If you need fewer or more columns, namespaces or semantic + element names, use the compressor script (lib/compress.rb) + +-------------------------------------------------------------- */ + +/* A container should group all your columns. */ +.container { + width: <%= page_width %>px; + margin: 0 auto; +} + +/* Use this class on any .span-# / .container to see the grid. */ +.showgrid { + background: url(src/grid.png); +} + + +/* Columns +-------------------------------------------------------------- */ + +/* Sets up basic grid floating and margin. */ +.column, <%= (1..column_count).map {|c| ".span-#{c}" }.join(", ") %> { + float: left; + margin-right: <%= gutter_width %>px; +} + +/* The last column in a row needs this class. */ +.last { margin-right: 0; } + +/* Use these classes to set the width of a column. */ +.span-1 {width: <%= column_width %>px;} +<% (2..column_count-1).each do |column| %> +.span-<%= column %> {width: <%= (column_width + ((column - 1) * (column_width + gutter_width))).to_i %>px;<%= "margin-right: 0;" if column == column_count %>}<% end %> +.span-<%= column_count %> {width:<%= page_width %>px; margin-right:0;} + +/* Use these classes to set the width of an input. */ +<%= (1..column_count).map {|column| "input.span-#{column}, textarea.span-#{column}"}.join(", ") %> { + border-left-width: <%= input_border %>px; + border-right-width: <%= input_border %>px; + padding-left: <%= input_padding %>px; + padding-right: <%= input_padding %>px; +} +<% (1..column_count).each do |column| %> +input.span-<%= column %>, textarea.span-<%= column %> { width: <%= ((column_width + gutter_width) * (column - 1) + column_width - 2*(input_padding + input_border))%>px; }<% end %> + +/* Add these to a column to append empty cols. */ +<% (1..(column_count-1)).each do |column| %> +.append-<%= column %> { padding-right: <%= (column * (column_width + gutter_width)).to_i %>px;}<% end %> + +/* Add these to a column to prepend empty cols. */ +<% (1..(column_count-1)).each do |column| %> +.prepend-<%= column %> { padding-left: <%= (column * (column_width + gutter_width)).to_i %>px;}<% end %> + + +/* Border on right hand side of a column. */ +.border { + padding-right: <%= (gutter_width * 0.5 - 1).to_i %>px; + margin-right: <%= (gutter_width * 0.5).to_i %>px; + border-right: 1px solid #ddd; +} + +/* Border with more whitespace, spans one column. */ +.colborder { + padding-right: <%= (column_width + 2*gutter_width - 1)/2.to_i %>px; + margin-right: <%= (column_width + 2 * gutter_width)/2.to_i %>px; + border-right: 1px solid #ddd; +} + + +/* Use these classes on an element to push it into the +next column, or to pull it into the previous column. */ + +<% (1..column_count).each do |column| %> +.pull-<%= column %> { margin-left: -<%= (column * (column_width + gutter_width)).to_i %>px; }<% end %> + +<%= (1..column_count).map {|c| ".pull-#{c}" }.join(", ") %> {float: left; position:relative;} + +<% (1..(column_count)).each do |column| %> +.push-<%= column %> { margin: 0 -<%= (column * (column_width + gutter_width)).to_i %>px 1.5em <%= (column * (column_width + gutter_width)).to_i %>px; }<% end %> + +<%= (1..column_count).map {|c| ".push-#{c}" }.join(", ") %> {float: left; position:relative;} + + +/* Misc classes and elements +-------------------------------------------------------------- */ + +/* In case you need to add a gutter above/below an element */ +div.prepend-top, .prepend-top { + margin-top:1.5em; +} +div.append-bottom, .append-bottom { + margin-bottom:1.5em; +} + +/* Use a .box to create a padded box inside a column. */ +.box { + padding: 1.5em; + margin-bottom: 1.5em; + background: #e5eCf9; +} + +/* Use this to create a horizontal ruler across a column. */ +hr { + background: #ddd; + color: #ddd; + clear: both; + float: none; + width: 100%; + height: 1px; + margin: 0 0 1.45em; + border: none; +} + +hr.space { + background: #fff; + color: #fff; + visibility: hidden; +} + + +/* Clearing floats without extra markup + Based on How To Clear Floats Without Structural Markup by PiE + [http://www.positioniseverything.net/easyclearing.html] */ + +.clearfix:after, .container:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + visibility: hidden; + overflow:hidden; +} +.clearfix, .container {display: block;} + +/* Regular clearing + apply to column that should drop below previous ones. */ + +.clear { clear:both; } diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid_builder.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid_builder.rb new file mode 100755 index 0000000..b04a972 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/grid_builder.rb @@ -0,0 +1,63 @@ +begin + require "rubygems" + gem "rmagick" + require "rvg/rvg" +rescue Exception => e + puts " #{"*" * 100}" + puts " **" + puts " ** Warning:" + puts " ** Could not load the Rmagick gem. Please check your installation." + puts " ** grid.png will not be generated." + puts " **" + puts " #{"*" * 100}\n" +end + +module Blueprint + # Uses ImageMagick and RMagick to generate grid.png file + class GridBuilder + begin + include Magick + rescue Exception => e + end + + attr_reader :column_width, :gutter_width, :output_path, :able_to_generate + + # ==== Options + # * <tt>options</tt> + # * <tt>:column_width</tt> -- Width (in pixels) of current grid column + # * <tt>:gutter_width</tt> -- Width (in pixels) of current grid gutter + # * <tt>:output_path</tt> -- Output path of grid.png file + def initialize(options={}) + @able_to_generate = Magick::Long_version rescue false + return unless @able_to_generate + @column_width = options[:column_width] || Blueprint::COLUMN_WIDTH + @gutter_width = options[:gutter_width] || Blueprint::GUTTER_WIDTH + @output_path = options[:output_path] || Blueprint::SOURCE_PATH + end + + # generates (overwriting if necessary) grid.png image to be tiled in background + def generate! + return false unless self.able_to_generate + total_width = self.column_width + self.gutter_width + height = 18 + RVG::dpi = 100 + + width_in_inches = (total_width.to_f/RVG::dpi).in + height_in_inches = (height.to_f/RVG::dpi).in + rvg = RVG.new(width_in_inches, height_in_inches).viewbox(0, 0, total_width, height) do |canvas| + canvas.background_fill = "white" + + canvas.g do |column| + column.rect(self.column_width - 1, height).styles(:fill => "#e8effb") + end + + canvas.g do |baseline| + baseline.line(0, (height - 1), total_width, (height - 1)).styles(:fill => "#e9e9e9") + end + end + + FileUtils.mkdir self.output_path unless File.exists? self.output_path + rvg.draw.write(File.join(self.output_path, "grid.png")) + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/namespace.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/namespace.rb new file mode 100755 index 0000000..7f35d39 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/namespace.rb @@ -0,0 +1,38 @@ +module Blueprint + class Namespace + + # Read html to string, remove namespace if any, + # set the new namespace, and update the test file. + def initialize(path, namespace) + html = File.path_to_string(path) + remove_current_namespace(html) + add_namespace(html, namespace) + File.string_to_file(html, path) + end + + # adds namespace to BP classes in a html file + def add_namespace(html, namespace) + html.gsub!(/(class=")([a-zA-Z0-9\-_ ]*)(")/) do |m| + classes = m.to_s.split('"')[1].split(" ") + classes.map! { |c| c = namespace + c } + 'class="' + classes.join(' ') + '"' + end + html + end + + # removes a namespace from a string of html + def remove_current_namespace(html) + current = current_namespace(html) + html.gsub!(current, "") + html + end + + # returns current namespace in test files + # based on container class + def current_namespace(html) + html =~ /class="([\S]+)container/ + current_namespace = $1 if $1 + current_namespace || "" + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/semantic_class_names.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/semantic_class_names.rb new file mode 100755 index 0000000..d561e33 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/semantic_class_names.rb @@ -0,0 +1,64 @@ +module Blueprint + # parses a hash of key/value pairs, key being output CSS selectors, value + # being a list of CSS selectors to draw from + class SemanticClassNames + attr_accessor :class_assignments + attr_reader :namespace, :source_file + + # ==== Options + # * <tt>options</tt> + # * <tt>:namespace</tt> -- Namespace to be used when matching CSS selectors to draw from + # * <tt>:source_file</tt> -- Source file to use as reference of CSS selectors. Defaults to Blueprint's generated screen.css + # * <tt>:class_assignments</tt> -- Hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from + def initialize(options = {}) + @namespace = options[:namespace] || "" + @source_file = options[:source_file] || File.join(Blueprint::BLUEPRINT_ROOT_PATH, "screen.css") + self.class_assignments = options[:class_assignments] || {} + end + + # Returns a CSS string of semantic selectors and associated styles + # ==== Options + # * <tt>assignments</tt> -- Hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from; defaults to what was passed in constructor or empty hash + def css_from_assignments(assignments = {}) + assignments ||= self.class_assignments + + # define a wrapper hash to hold all the new CSS assignments + output_css = {} + + #loads full stylesheet into an array of hashes + blueprint_assignments = CSSParser.new(File.path_to_string(self.source_file)).parse + + # iterates through each class assignment ('#footer' => '.span-24', '#header' => '.span-24') + assignments.each do |semantic_class, blueprint_classes| + # gathers all BP classes we're going to be mimicing + blueprint_classes = blueprint_classes.split(/,|\s/).select {|c| !c.blank? }.flatten.map {|c| c.strip } + classes = [] + # loop through each BP class, grabbing the full hash (containing tags, index, and CSS rules) + blueprint_classes.each do |bp_class| + match = if bp_class.include?(".") + bp_class.gsub(".", ".#{self.namespace}") + else + ".#{self.namespace}#{bp_class}" + end + classes << blueprint_assignments.select do |line| + line[:tags] =~ Regexp.new(/^([\w\.\-\:]+, ?)*#{match}(, ?[\w\.\-\:]+)*$/) + end.uniq + end + + # clean up the array + classes = classes.flatten.uniq + + # set the semantic class to the rules gathered in classes, sorted by index + # this way, the styles will be applied in the correct order from top of file to bottom + output_css[semantic_class] = "#{classes.sort_by {|i| i[:idx] }.map {|i| i[:rules] }}" + end + + # return the css in proper format + css = "" + output_css.each do |tags, rules| + css += "#{tags} {#{rules}}\n" + end + css + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/COPYRIGHT.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/COPYRIGHT.html new file mode 100755 index 0000000..f9d0b6f --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/COPYRIGHT.html @@ -0,0 +1,93 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en' lang='en'> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/base.css" /> +<title>W3C IPR SOFTWARE NOTICE</title> +</head> +<body> +<h1>W3C<sup>&reg;</sup> SOFTWARE NOTICE AND LICENSE</h1> + +<h3>Copyright &copy; 1997-2002 <a href="http://www.w3.org/">World +Wide Web Consortium</a>, (<a +href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de +Recherche en Informatique et en Automatique</a>, <a +href="http://www.keio.ac.jp/">Keio University</a>). All Rights +Reserved. http://www.w3.org/Consortium/Legal/</h3> + +<p>This W3C work (including software, documents, or other related +items) is being provided by the copyright holders under the +following license. By obtaining, using and/or copying this work, +you (the licensee) agree that you have read, understood, and will +comply with the following terms and conditions:</p> + +<p>Permission to use, copy, modify, and distribute this software +and its documentation, with or without modification,&nbsp; for any +purpose and without fee or royalty is hereby granted, provided that +you include the following on ALL copies of the software and +documentation or portions thereof, including modifications, that +you make:</p> + +<ol> +<li>The full text of this NOTICE in a location viewable to users of +the redistributed or derivative work.</li> + +<li>Any pre-existing intellectual property disclaimers, notices, or +terms and conditions. If none exist, a short notice of the +following form (hypertext is preferred, text is permitted) should +be used within the body of any redistributed or derivative code: +"Copyright &copy; [$date-of-software] <a +href="http://www.w3.org/">World Wide Web Consortium</a>, (<a +href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de +Recherche en Informatique et en Automatique</a>, <a +href="http://www.keio.ac.jp/">Keio University</a>). All Rights +Reserved. http://www.w3.org/Consortium/Legal/"</li> + +<li>Notice of any changes or modifications to the W3C files, +including the date changes were made. (We recommend you provide +URIs to the location from which the code is derived.)</li> +</ol> + +<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND +COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE +USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD +PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, +SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE +SOFTWARE OR DOCUMENTATION.</p> + +<p>The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to the software without +specific, written prior permission. Title to copyright in this +software and any associated documentation will at all times remain +with copyright holders.</p> + +<p>____________________________________</p> + +<p>This formulation of W3C's notice and license became active on +August 14 1998 so as to improve compatibility with GPL. This +version ensures that W3C software licensing terms are no more +restrictive than GPL and consequently W3C software may be +distributed in GPL packages. See the <a +href="copyright-software-19980519.html">older formulation</a> for +the policy prior to this date. Please see our <a +href="IPR-FAQ.html">Copyright FAQ</a> for common questions about +using materials from our site, including specific terms and +conditions for packages like libwww, Amaya, and Jigsaw. Other +questions about this notice can be directed to <a +href="mailto:[email protected]">[email protected]</a>.<br /> +&nbsp;</p> + +<p>&nbsp;</p> + +<address><a href="http://www.w3.org/Help/Webmaster.html">webmaster</a><br /> + (last updated $Date: 2004/05/29 04:04:36 $)</address> + +</body> +</html> \ No newline at end of file diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/JIGSAW_COPYRIGHT b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/JIGSAW_COPYRIGHT new file mode 100755 index 0000000..9108b47 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/JIGSAW_COPYRIGHT @@ -0,0 +1,64 @@ +W3C IPR SOFTWARE NOTICE + +Copyright © 1995-1998 World Wide Web Consortium, (Massachusetts Institute of +Technology, Institut National de Recherche en Informatique et en +Automatique, Keio University). All Rights Reserved. +http://www.w3.org/Consortium/Legal/ + +This W3C work (including software, documents, or other related items) is +being provided by the copyright holders under the following license. By +obtaining, using and/or copying this work, you (the licensee) agree that you +have read, understood, and will comply with the following terms and +conditions: + +Permission to use, copy, and modify this software and its documentation, +with or without modification, for any purpose and without fee or royalty is +hereby granted, provided that you include the following on ALL copies of the +software and documentation or portions thereof, including modifications, +that you make: + + 1. The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. + 2. Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, a short notice of the following form + (hypertext is preferred, text is permitted) should be used within the + body of any redistributed or derivative code: "Copyright © World Wide + Web Consortium, (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio + University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" + 3. Notice of any changes or modifications to the W3C files, including the + date changes were made. (We recommend you provide URIs to the location + from which the code is derived). + +In addition, creators of derivitive works must include the full text of this +NOTICE in a location viewable to users of the derivitive work. + +THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS +MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR +PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE +ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR +DOCUMENTATION. + +The name and trademarks of copyright holders may NOT be used in advertising +or publicity pertaining to the software without specific, written prior +permission. Title to copyright in this software and any associated +documentation will at all times remain with copyright holders. + +____________________________________ + +This formulation of W3C's notice and license became active on August 14 +1998. See the older formulation for the policy prior to this date. Please +see our Copyright FAQ for common questions about using materials from our +site, including specific terms and conditions for packages like libwww, +Amaya, and Jigsaw. Other questions about this notice can be directed to [email protected] . + + + + +webmaster +(last updated 14-Aug-1998) diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/README.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/README.html new file mode 100755 index 0000000..4071e58 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/README.html @@ -0,0 +1,83 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>CSS Validator Binary Distribution - Illumit</title> + <link title="RSS Feed" type="application/rss+xml" rel="alternate" href="http://www.illumit.com/site.rss" /> + </head> + <body> + <h1>CSS Validator Binary Distribution</h1> + <p>This a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a>. + It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006. + No modifications were made.</p> + + <p>This distribution is provided <a href="#asis">as is</a> to make testing a large number of CSS files easier.</p> + + + <h2>Requirements</h2> + <p>A Java 2 Virtual Machine is required to use the validator. + You can download one from <a href="http://java.sun.com/">Sun</a> if you do not have one installed.</p> + + <h2>Usage</h2> + <h2>Summary</h2> + <p><code>java -jar <samp>~/css-validator/</samp>css-validator.jar [-options] files URLs</code></p> + <h2>Sample</h2> + <pre> + java -jar ~/css-validator/css-validator.jar f1.css http://illumit.com/ + </pre> + <h2>Options</h2> + <dl> + <dt>-e</dt><dd>Show errors only.</dd> + <dt>-html</dt><dd>Output HTML.</dd> + <dt>-css1 | -css2 | -css21 | -css3 | -svg | -svgbasic | -svgtiny</dt> + <dd>Specify CSS version. CSS2 is the default.</dd> + </dl> + + <h2>Support</h2> + + <p>If you have questions about how this distribution is built or packaged, + <a href="mailto:[email protected]">mailto:[email protected]</a>.</p> + + <p>Use the CSS Validator <a href="http://jigsaw.w3.org/css-validator/Email">Feedback</a> + page if you have any questions or problems with the validator itself.</p> + + <p class="Footnote">Updates are announced on via + <a class="RSSLink" rel="alternate" type="application/rss+xml" href="http://www.illumit.com/site.rss">RSS</a></p> + + <!-- + <h2>Contents</h2> + <ul> + <li><a href="css-validator.jar">css-validator.jar</a> Executable JAR package</li> + <li><a href="COPYRIGHT.html">COPYRIGHT.html</a> CSS Validator Copyright Notice</li> + <li><a href="css-validator-javadoc.jar">css-validator-javadoc.jar</a> CSS Validator API Docs</li> + <li>Required libraries:<ul> + <li><a href="jigsaw.jar">jigsaw.jar</a> and <a href="JIGSAW_COPYRIGHT">JIGSAW_COPYRIGHT</a></li> + <li><a href="xerces.jar">xerces.jar</a> and <a href="XERCES_COPYING.txt">XERCES_COPYING.txt</a></li> + </ul> + </li> + </ul> + --> + + <h2>Download</h2> + + <p>Download the css validator binary distribution <a href="css-validator.zip">css-validator.zip</a>. Extract the files (OS X and *ix users can use unzip).</p> + + + <h2><a name="asis">License Agreement</a></h2> + + <p>This is a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a> Version 2.0 + It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006. + No modifications were made to the source.</p> + + <p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND +ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS (W3C) MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE +USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD +PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, +SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE +SOFTWARE OR DOCUMENTATION.</p> + + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/XERCES_COPYING.txt b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/XERCES_COPYING.txt new file mode 100755 index 0000000..183b52c --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/XERCES_COPYING.txt @@ -0,0 +1,56 @@ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 1999 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact [email protected]. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator-javadoc.jar b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator-javadoc.jar new file mode 100755 index 0000000..ed3d030 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator-javadoc.jar differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator.jar b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator.jar new file mode 100755 index 0000000..592b040 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/css-validator.jar differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/jigsaw.jar b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/jigsaw.jar new file mode 100755 index 0000000..53419d6 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/jigsaw.jar differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/xerces.jar b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/xerces.jar new file mode 100755 index 0000000..f470895 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validate/xerces.jar differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validator.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validator.rb new file mode 100755 index 0000000..bc68718 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/blueprint/validator.rb @@ -0,0 +1,49 @@ +module Blueprint + # Validates generated CSS against the W3 using Java + class Validator + attr_reader :error_count + + def initialize + @error_count = 0 + end + + # Validates all three CSS files + def validate + java_path = `which java`.rstrip + raise "You do not have a Java installed, but it is required." if java_path.blank? + + output_header + + Blueprint::CSS_FILES.keys.each do |file_name| + css_output_path = File.join(Blueprint::BLUEPRINT_ROOT_PATH, file_name) + puts "\n\n Testing #{css_output_path}" + puts " Output ============================================================\n\n" + @error_count += 1 if !system("#{java_path} -jar '#{Blueprint::VALIDATOR_FILE}' -e '#{css_output_path}'") + end + + output_footer + end + + private + + def output_header + puts "\n\n" + puts " ************************************************************" + puts " **" + puts " ** Blueprint CSS Validator" + puts " ** Validates output CSS files" + puts " **" + puts " ************************************************************" + end + + def output_footer + puts "\n\n" + puts " ************************************************************" + puts " **" + puts " ** Done!" + puts " ** Your CSS files are#{" not" if error_count > 0} valid.#{" You had #{error_count} error(s) within your files" if error_count > 0}" + puts " **" + puts " ************************************************************" + end + end +end diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/compress.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/compress.rb new file mode 100755 index 0000000..34a6c16 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/compress.rb @@ -0,0 +1,167 @@ +#!/usr/bin/env ruby +require File.join(File.dirname(__FILE__), "blueprint", "blueprint") + +# **Basic +# +# Calling this file by itself will pull files from blueprint/src and +# concatenate them into three files; ie.css, print.css, and screen.css. +# +# ruby compress.rb +# +# However, argument variables can be set to change how this works. +# +# Calling +# +# ruby compress.rb -h +# +# will reveal basic arguments you can pass to the compress.rb file. +# +# **Custom Settings +# +# To use custom settings, the file need to be stored in settings.yml within +# this directory. An example YAML file has been included. +# +# Another ability is to use YAML (spec is at http://www.yaml.org/spec/1.1/) +# for project settings in a predefined structure and store all pertinent +# information there. The YAML file has multiple keys (usually a named +# project) with a set of data that defines that project. A sample structure +# can be found in settings.example.yml. +# +# The basic structure is this: +# +# Root nodes are project names. You use these when calling compress.rb as such: +# +# ruby compress.rb -p PROJECTNAME +# +# A sample YAML with only roots and output paths would look like this: +# +# project1: +# path: /path/to/my/project/stylesheets +# project2: +# path: /path/to/different/stylesheets +# project3: +# path: /path/to/another/projects/styles +# +# You can then call +# +# ruby compress.rb -p project1 +# +# or +# +# ruby compress.rb -p project3 +# +# This would compress and export Blueprints CSS to the respective directory, +# checking for my-(ie|print|screen).css and appending it if present +# +# A more advanced structure would look like this: +# +# project1: +# path: /path/to/my/project/stylesheets +# namespace: custom-namespace-1- +# custom_css: +# ie.css: +# - custom-ie.css +# print.css: +# - docs.css +# - my-print-styles.css +# screen.css: +# - subfolder-of-stylesheets/sub_css.css +# custom_layout: +# column_count: 12 +# column_width: 70 +# gutter_width: 10 +# project2: +# path: /path/to/different/stylesheets +# namespace: different-namespace- +# custom_css: +# screen.css: +# - custom_screen.css +# semantic_classes: +# "#footer, #header": column span-24 last +# "#content": column span-18 border +# "#extra-content": last span-6 column +# "div#navigation": last span-24 column +# "div.section, div.entry, .feeds": span-6 column +# plugins: +# - fancy-type +# - buttons +# - validations +# project3: +# path: /path/to/another/projects/styles +# +# In a structure like this, a lot more assignment is occurring. Custom +# namespaces are being set for two projects, while the third (project3) +# is just a simple path setting. +# +# Also, custom CSS is being used that is appended at the end of its respective +# file. So, in project1, print.css will have docs.css and my-print-styles.css +# instead of the default my-print.css. Note that these files are relative +# to the path that you defined above; you can use subdirectories from the +# default path if you would like. +# +# Another thing to note here is the custom_layout; if not defined, your +# generated CSS will default to the 24 column, 950px wide grid that has been +# standard with Blueprint for quite some time. However, you can specify a +# custom grid setup if you would like. The three options are column_count +# (the number of columns you want your grid to have), column width (the +# width in pixels that you want your columns to be), and gutter_width (the +# width in pixels you want your gutters - space between columns - to be). +# To use the Blueprint default, do not define this in your settings file. +# +# Semantic classes are still in the works within Blueprint, but a simple +# implementation has been created. +# +# Defining semantic_classes, with nodes underneath, will generate a class +# for each node which has rules of each class assigned to it. For example, +# in project2 above, for '#footer, #header', elements with id's of footer +# and header will be assigned all the rules from the classes 'span-24, +# column, and last', while divs with classes either entry or section, as +# well as any element with class of feed, is assigned all the rules from +# 'span-6 and column'. Although it is a crude way do accomplish this, it +# keeps the generated CSS separate from the core BP CSS. +# +# Also supported is plugins. The compressor looks withinBLUEPRINT_DIR/blueprint/plugins +# to match against what's passed. If the plugin name matches, it will append +# PLUGIN/(screen|print|ie).css to the corresponding CSS file. It will append +# the plugin CSS to all three CSS files if there is a CSS file present named +# as the plugin (e.g. the fancy-type plugin with a fancy-type.css file found +# within the plugin directory) +# +# In Ruby, the structure would look like this: +# +# { +# 'project1' => { +# 'path' => '/path/to/my/project/stylesheets', +# 'namespace' => 'custom-namespace-1-', +# 'custom_css' => { +# 'ie.css' => ['custom-ie.css'], +# 'print.css' => ['docs.css', 'my-print-styles.css'], +# 'screen.css' => ['subfolder-of-stylesheets/sub_css.css'] +# }, +# 'custom_layout' => { +# 'column_count' => 12, +# 'column_width' => 70, +# 'gutter_width' => 10 +# } +# }, +# 'project2' => { +# 'path' => '/path/to/different/stylesheets', +# 'namespace' => 'different-namespace-', +# 'custom_css' => { +# 'screen.css' => ['custom_screen.css'] +# }, +# 'semantic_classes' => { +# '#footer, #header' => 'column span-24 last', +# '#content' => 'column span-18 border', +# '#extra-content' => 'last span-6 column', +# 'div#navigation' => 'last span-24 column', +# 'div.section, div.entry, .feeds' => 'span-6 column' +# }, +# 'plugins' => ['fancy-type', 'buttons', 'validations'] +# }, +# 'project3' => { +# 'path' => '/path/to/another/projects/styles' +# } +# } + +Blueprint::Compressor.new.generate! diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/settings.example.yml b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/settings.example.yml new file mode 100755 index 0000000..6cb2028 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/settings.example.yml @@ -0,0 +1,33 @@ +# refer to http://www.yaml.org/spec/1.1/ for clarification on YAML collections +project1: + path: /path/to/my/project/stylesheets + namespace: custom-namespace-1- + custom_css: + ie.css: + - custom-ie.css + print.css: + - docs.css + - my-print-styles.css + screen.css: + - subfolder-of-stylesheets/sub_css.css + custom_layout: + column_count: 12 + column_width: 70 + gutter_width: 10 + plugins: + - fancy-type + - buttons +project2: + path: /path/to/different/stylesheets + namespace: different-namespace- + custom_css: + screen.css: + - custom_screen.css + semantic_classes: + "#footer, #header": ".span-24" + "#content": ".span-17, .colborder" + "#extra-content": ".span-6" + "div#navigation": ".span_24" + "div.section, div.entry, .feeds": ".span-6" +project3: + path: /path/to/another/projects/styles diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/validate.rb b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/validate.rb new file mode 100755 index 0000000..bb1ae08 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/lib/validate.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +require "blueprint/blueprint" +require "blueprint/validator" + +# This script will validate the core Blueprint files. +# +# The files are not completely valid. This has to do +# with a small number of CSS hacks needed to ensure +# consistent rendering across browsers. +# +# To add your own CSS files for validation, see +# /lib/blueprint/validator.rb + +Blueprint::Validator.new.validate diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/templates/psd/fixed-width.psd b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/templates/psd/fixed-width.psd new file mode 100755 index 0000000..57e4445 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/templates/psd/fixed-width.psd differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/index.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/index.html new file mode 100755 index 0000000..cbcb195 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/index.html @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Blueprint test pages</title> + + <!-- Framework CSS --> + <link rel="stylesheet" href="../blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="../blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]><link rel="stylesheet" href="../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + <style type="text/css" media="screen"> + p, table, hr, .box { margin-bottom:25px; } + .box p { margin-bottom:10px; } + </style> + </head> + <body> + + <div class="container"> + <h1>Blueprint test pages</h1> + <hr> + + <p>Welcome to the Blueprint test pages. The HTML files below test most HTML elements, as well as most classes provided by Blueprint.</p> + + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <th class="span-6">Test page</th> + <th class="span-8">Main files tested</th> + <th class="span-10">Description</th> + </tr> + <tr> + <td><a href="parts/sample.html">Sample page</a></td> + <td> + <a href="../blueprint/src/grid.css">grid.css</a>, + <a href="../blueprint/src/typography.css">typography.css</a> + </td> + <td>A simple sample page, with common elements.</td> + </tr> + <tr class="even"> + <td><a href="parts/grid.html">Grid</a></td> + <td> + <a href="../blueprint/src/grid.css">grid.css</a> + </td> + <td>Tests classes provided by grid.css.</td> + </tr> + <tr> + <td><a href="parts/elements.html">Typography</a></td> + <td> + <a href="../blueprint/src/typography.css">typography.css</a> + </td> + <td>Tests HTML elements which gets set in typography.css.</td> + </tr> + <tr class="even"> + <td><a href="parts/forms.html">Forms</a></td> + <td> + <a href="../blueprint/src/forms.css">forms.css</a> + </td> + <td>Tests classes and default look provided by forms.css.</td> + </tr> + </table> + + <p><em><strong>Note about the compressed versions:</strong></em> + These test files utilize the compressed files. In other words, if you change any of the source files, + you'll have to re-compress them with the ruby script in the scripts folder to see any&nbsp;changes.</p> + + <div class="box"> + <p>For more information and help, try these resources:</p> + <ul class="bottom"> + <li><a href="http://blueprintcss.org">The Blueprint home page</a></li> + <li><a href="http://github.com/joshuaclayton/blueprint-css/wikis/home">The Blueprint Wiki</a></li> + <li><a href="http://groups.google.com/group/blueprintcss">The Blueprint mailing list</a></li> + </ul> + </div> + + <p><a href="http://validator.w3.org/check?uri=referer"> + <img src="parts/valid.png" alt="Valid HTML 4.01 Strict" height="31" width="88" class="top"></a></p> + + </div> + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/elements.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/elements.html new file mode 100755 index 0000000..28202d0 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/elements.html @@ -0,0 +1,247 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Blueprint HTML Elements Tests</title> + + <!-- Framework CSS --> + <link rel="stylesheet" href="../../blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="../../blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]><link rel="stylesheet" href="../../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + + </head> + <body> + + <div class="container showgrid"> + <h2>Tests for common HTML elements</h2> + <hr> + <h5>PARAGRAPHS <span class="alt">&amp;</span> BOXES</h5> + <div class="span-8"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor <sub>sub text</sub> ut labore et <sup>sup text</sup> magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + </div> + + <div class="span-8"> + <p class="small">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + <p class="large">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + + <div class="span-8 last"> + + <div class="box"> + <p class="last">Aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + </div> + <blockquote> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> + </blockquote> + + </div> + <hr> + + <h5>LISTS</h5> + + <div class="span-8"> + <ul> + <li>Unordered list test</li> + <li>Another list element. Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li> + <li>Yet another element in the list</li> + <li>Some long text. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li> + </ul> + <ol> + <li>Ordered list test</li> + <li>Another list element</li> + <li>Yet another element in the list</li> + </ol> + </div> + + <div class="span-8"> + <ol> + <li>Ordered list</li> + <li>Here's a nested unordered list + <ul> + <li>Nested Unordered list</li> + <li>Nested ordered list + <ol> + <li>The first</li> + <li>And the second</li> + </ol> + </li> + </ul> + </li> + <li>Ordered List item</li> + <li>Nested Ordered list + <ol> + <li>Some point</li> + <li>Nested Unordered list + <ul> + <li>The first</li> + <li>And the second</li> + </ul> + </li> + </ol> + </li> + </ol> + </div> + + <div class="span-8 last"> + <dl> + <dt>definition list dt</dt> + <dd>definition list dd</dd> + <dt>definition list dt</dt> + <dd>definition list dd</dd> + <dt>Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</dt> + <dd>Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</dd> + <dt>Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</dt> + <dd>Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</dd> + </dl> + </div> + <hr> + + <h5>HEADINGS</h5> + + <div class="span-8"> + <h1>H1: Lorem ipsum dolor sit amet</h1> + <h2>H2: Lorem ipsum dolor sit amet, consectetur elit</h2> + <h3>H3: Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3> + <h4>H4: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipis</h4> + <h5>H5: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</h5> + <h6>H6: Lorem ipsum dolor sit amet, consectetur adipisicing elit adipisicing elit adipisicing elit</h6> + </div> + + <div class="span-8"> + <h1>Heading 1</h1><hr> + <h2>Heading 2</h2><hr> + <h3>Heading 3</h3><hr> + <h4>Heading 4</h4><hr> + <h5>Heading 5</h5><hr> + <h6>Heading 6</h6> + </div> + + <div class="span-8 last"> + <h1>Heading 1</h1> + <h2>Heading 2</h2> + <h3>Heading 3</h3> + <h4>Heading 4</h4> + <h5>Heading 5</h5> + <h6>Heading 6</h6> + </div> + <hr> + + <h5>MISC ELEMENTS</h5> + + <div class="span-8"> + <p> + <strong>&lt;strong&gt;</strong><br> + <del>&lt;del&gt; deleted</del><br> + <dfn>&lt;dfn&gt; dfn</dfn><br> + <em>&lt;em&gt; emphasis</em> + </p> + <p> + <a>&lt;a&gt; anchor</a><br> + <a href="#">&lt;a&gt; a + href</a> + </p> + <p> + <abbr title="extended abbr text should show when mouse over">&lt;abbr&gt; abbr - extended text when mouseover.</abbr><br> + <acronym title="extended acronym text should show when mouse over">&lt;acronym&gt; acronym - extended text when mouseover.</acronym> + </p> + <address> + &lt;address&gt;<br> + Donald Duck<br> + Box 555<br> + Disneyland + </address> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore dolore.</p> + </div> + + <div class="span-8"> + <table summary="This is the summary text for this table." border="0" cellspacing="0" cellpadding="0"> + <caption><em>A standard test table with a caption, tr, td elements</em></caption> + <tr> + <th class="span-4">Table Header One</th> + <th class="span-4 last">Table Header Two</th> + </tr> + <tr> + <td>TD One</td> + <td>TD Two</td> + </tr> + <tr> + <td colspan="2">TD colspan 2</td> + </tr> + </table> + + <table summary="This is the summary text for this table." border="0" cellspacing="0" cellpadding="0"> + <caption><em>A test table with a thead, tfoot, and tbody elements</em></caption> + <thead> + <tr> + <th class="span-4">Table Header One</th> + <th class="span-4 last">Table Header Two</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2">tfoot footer</td> + </tr> + </tfoot> + <tbody> + <tr> + <td>TD One</td> + <td>TD Two</td> + </tr> + <tr> + <td>TD One</td> + <td>TD Two</td> + </tr> + </tbody> + <tbody> + <tr> + <td>TD One</td> + <td>TD Two</td> + </tr> + <tr> + <td>TD One</td> + <td>TD Two</td> + </tr> + </tbody> + </table> + </div> + + <div class="span-8 last"> + +<pre>&lt;pre&gt; +pre space1 +pre space1 +pre space2 +pre space2 +pre tab +pre tab</pre> + + <code>&lt;code&gt; + Not indented + indent1 + indent1 + indent2 + indent3</code> + + <tt>&lt;tt&gt; + This tt text should be monospaced + and + wrap as if + one line of text + even though the code has newlines, spaces, and tabs. + It should be the same size as &lt;p&gt; text. + </tt> + </div> + <hr> + + <p> + <a href="http://validator.w3.org/check?uri=referer"> + <img src="valid.png" alt="Valid HTML 4.01 Strict" height="31" width="88" class="top"> + </a> + </p> + + </div> + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/forms.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/forms.html new file mode 100755 index 0000000..1c18ce3 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/forms.html @@ -0,0 +1,194 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" +"http://www.w3.org/TR/html4/strict.dtd"> + +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Blueprint Forms Tests</title> + + <!-- Framework CSS --> + <link rel="stylesheet" href="../../blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="../../blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]><link rel="stylesheet" href="../../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + </head> + <body> + <div class="container showgrid"> + <h1>Forms</h1> + <hr> + + <div class="span-12"> + + <form id="dummy" action="" method="post"> + + <fieldset> + <legend>Simple sample form</legend> + <p> + <label for="dummy0">Text input (title)</label><br> + <input type="text" class="title" name="dummy0" id="dummy0" value="Field with class .title"> + </p> + + <p> + <label for="dummy1">Another field</label><br> + <input type="text" class="text" id="dummy1" name="dummy1" value="Field with class .text"> + </p> + + <p> + <label for="dummy2">Textarea</label><br> + <textarea name="dummy2" id="dummy2" rows="5" cols="20"></textarea> + </p> + + <p> + <label for="dummy3">A password field</label><br> + <input type="password" class="text" id="dummy3" name="dummy3" value="Password field with class .text"> + </p> + + <p> + <input type="submit" value="Submit"> + <input type="reset" value="Reset"> + </p> + + </fieldset> + </form> + + </div> + <div class="span-12 last"> + + <div class="error"> + This is a &lt;div&gt; with the class <strong>.error</strong>. <a href="#">Link</a>. + </div> + <div class="notice"> + This is a &lt;div&gt; with the class <strong>.notice</strong>. <a href="#">Link</a>. + </div> + <div class="info"> + This is a &lt;div&gt; with the class <strong>.info</strong>. <a href="#">Link</a>. + </div> + <div class="success"> + This is a &lt;div&gt; with the class <strong>.success</strong>. <a href="#">Link</a>. + </div> + + <fieldset> + <legend>Select, checkboxes, lists</legend> + + <p> + <label for="dummy3">Select field</label><br> + <select id="dummy3" name="dummy3"> + <option value="1">Ottawa</option> + <option value="2">Calgary</option> + <option value="3">Moosejaw</option> + </select> + </p> + + <p> + <label for="dummy4">Select with groups</label><br> + <select id="dummy4" name="dummy4"> + <option>Favorite pet</option> + <optgroup label="mammals"> + <option>dog</option> + <option>cat</option> + <option>rabbit</option> + <option>horse</option> + </optgroup> + <optgroup label="reptiles"> + <option>iguana</option> + <option>snake</option> + </optgroup> + </select> + </p> + + <p><label>Radio buttons</label><br> + <input type="radio" name="example"> Radio one<br> + <input type="radio" name="example"> Radio two<br> + <input type="radio" name="example"> Radio three<br> + </p> + + <p><label>Checkboxes</label><br> + <input type="checkbox"> Check one<br> + <input type="checkbox"> Check two<br> + <input type="checkbox"> Check three<br> + </p> + + </fieldset> + + </div> + + <div class="span-24 last"> + + <fieldset> + <legend>Alignment</legend> + + <p> + <label for="dummy5">Select field</label> + <select id="dummy5" name="dummy5"> + <option value="1">Ottawa</option> + <option value="2">Calgary</option> + <option value="3">Moosejaw</option> + </select> + </p> + + <p> + <label for="dummy6">Text input (title)</label> + <input type="text" class="title" name="dummy6" id="dummy6" value="Field with class .title"> + </p> + + <p> + <label for="dummy7">Select field</label> + <select id="dummy7" name="dummy7"> + <option value="1">Ottawa</option> + <option value="2">Calgary</option> + <option value="3">Moosejaw</option> + </select> + <label for="dummy8">Another field</label> + <input type="text" class="text" id="dummy8" name="dummy8" value="Field with class .text"> + </p> + + </fieldset> + + </div> + + <div class="span-24 last"> + <form action="" method="post" class="inline"> + <fieldset> + <legend>A form with class "inline"</legend> + <div class="span-3"> + <label for="a">Label A:</label> + <select id="a" name="a" > + <option value="0">All</option> + </select> + </div> + <div class="span-2"> + some text + </div> + <div class="span-3"> + <input type="checkbox" id="o" name="o" value="true" checked="checked" class="checkbox">checkbox one + </div> + <div class="span-3"> + <label for="b">Label B:</label> + <select id="b" name="b" > + <option value="0">All</option> + </select> + </div> + <div class="span-2"> + <a href="#">A Hyperlink</a> + </div> + <div class="span-8"> + <input type="text" class="text" id="q" name="q" value="Field with class .text"> + </div> + <div class="span-2 last"> + <input type="submit" value="submit" class="button"> + </div> + </fieldset> + + </form> + + </div> + + <hr> + + <p> + <a href="http://validator.w3.org/check?uri=referer"> + <img src="valid.png" alt="Valid HTML 4.01 Strict" height="31" width="88" class="top"></a> + </p> + + </div> + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/grid.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/grid.html new file mode 100755 index 0000000..a0c9a7d --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/grid.html @@ -0,0 +1,163 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Blueprint Grid Tests</title> + + <!-- Framework CSS --> + <link rel="stylesheet" href="../../blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="../../blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]><link rel="stylesheet" href="../../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + </head> + <body> + + <div class="container showgrid"> + <h1>Blueprint Tests: grid.css</h1> + <div class="span-8"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-8"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-8 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 append-1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 append-2"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 append-3 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 prepend-1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 prepend-2"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <div class="span-6 prepend-3 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> + </div> + <hr> + <div class="span-12 border"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + </div> + <div class="span-12 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + </div> + <hr> + <div class="span-1 prepend-1"><p>1</p></div> + <div class="span-1 prepend-2"><p>2</p></div> + <div class="span-1 prepend-3"><p>3</p></div> + <div class="span-1 prepend-4"><p>4</p></div> + <div class="span-1 prepend-5"><p>5</p></div> + <div class="span-1 prepend-3 last"><p>3</p></div> + <div class="span-1 append-1"><p>1</p></div> + <div class="span-1 append-2"><p>2</p></div> + <div class="span-1 append-3"><p>3</p></div> + <div class="span-1 append-4"><p>4</p></div> + <div class="span-1 append-5"><p>5</p></div> + <div class="span-1 append-3 last"><p>3</p></div> + <div class="span-1 border"><p>1</p></div> + <div class="span-1 border"><p>2</p></div> + <div class="span-1 border"><p>3</p></div> + <div class="span-1 border"><p>4</p></div> + <div class="span-1 border"><p>5</p></div> + <div class="span-1 border"><p>6</p></div> + <div class="span-1 border"><p>7</p></div> + <div class="span-1 border"><p>8</p></div> + <div class="span-1 border"><p>9</p></div> + <div class="span-1 border"><p>10</p></div> + <div class="span-1 border"><p>11</p></div> + <div class="span-1 border"><p>12</p></div> + <div class="span-1 border"><p>13</p></div> + <div class="span-1 border"><p>14</p></div> + <div class="span-1 border"><p>15</p></div> + <div class="span-1 border"><p>16</p></div> + <div class="span-1 border"><p>17</p></div> + <div class="span-1 border"><p>18</p></div> + <div class="span-1 border"><p>19</p></div> + <div class="span-1 border"><p>20</p></div> + <div class="span-1 border"><p>21</p></div> + <div class="span-1 border"><p>22</p></div> + <div class="span-1 border"><p>23</p></div> + <div class="span-1 last"><p>24</p></div> + <div class="span-4"><p>1</p></div> + <div class="span-4"><p>2</p></div> + <div class="span-4"><p>3</p></div> + <div class="span-4"><p>4</p></div> + <div class="span-4"><p>5</p></div> + <div class="span-4 last"><p>6</p></div> + <div class="prepend-23 span-1 last"><p>24</p></div> + <div class="prepend-1 span-1"><p>2</p></div> + <div class="prepend-20 span-1 append-1 last"><p>23</p></div> + <hr> + <div class="span-24"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> + </div> + <div class="span-12"> + <div class="span-6"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.</p> + </div> + <div class="span-6 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + <div class="span-12 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + </div> + <div class="span-12 last"> + <div class="span-6"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.</p> + </div> + <div class="span-6 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + <div class="span-12 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + </div> + <div class="span-14 prepend-5 append-5 last"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> + </div> + <hr> + <div class="span-12"> + <h5>TESTING .PUSH-1 TO .PUSH-5</h5> + <div class="span-2"><img src="test-small.jpg" class="push-1"></div> + <div class="span-10 last"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2"><img src="test-small.jpg" class="push-2"></div> + <div class="span-10 last"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2"><img src="test-small.jpg" class="push-3"></div> + <div class="span-10 last"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2"><img src="test-small.jpg" class="push-4"></div> + <div class="span-10 last"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2"><img src="test-small.jpg" class="push-5"></div> + <div class="span-10 last"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + </div> + <div class="span-12 last"> + <h5>TESTING .PULL-1 TO .PULL-5</h5> + <div class="span-10"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2 last"><img src="test-small.jpg" class="top pull-1"></div> + <div class="span-10"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2 last"><img src="test-small.jpg" class="top pull-2"></div> + <div class="span-10"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2 last"><img src="test-small.jpg" class="top pull-3"></div> + <div class="span-10"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2 last"><img src="test-small.jpg" class="top pull-4"></div> + <div class="span-10"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div> + <div class="span-2 last"><img src="test-small.jpg" class="top pull-5"></div> + </div> + <div class="span-24"> + <p> + <a href="http://validator.w3.org/check?uri=referer"> + <img src="valid.png" alt="Valid HTML 4.01 Strict" height="31" width="88" class="bottom"> + </a> + </p> + </div> + </div> + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/sample.html b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/sample.html new file mode 100755 index 0000000..d1d0f39 --- /dev/null +++ b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/sample.html @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Blueprint Sample Page</title> + + <!-- Framework CSS --> + <link rel="stylesheet" href="../../blueprint/screen.css" type="text/css" media="screen, projection"> + <link rel="stylesheet" href="../../blueprint/print.css" type="text/css" media="print"> + <!--[if lt IE 8]><link rel="stylesheet" href="../../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + + <!-- Import fancy-type plugin for the sample page. --> + <link rel="stylesheet" href="../../blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection"> + </head> + <body> + <div class="container"> + <h1>A simple sample page</h1> + <hr> + <h2 class="alt">This sample page demonstrates a tiny fraction of what you get with Blueprint.</h2> + <hr> + <div class="span-7 colborder"> + <h6>Here's a box</h6> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.</p> + </div> + <div class="span-8 colborder"> + <h6>And another box</h6> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat laboris nisi ut aliquip.</p> + </div> + <div class="span-7 last"> + <h6>This box is aligned with the sidebar</h6> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.</p> + </div> + <hr> + <hr class="space"> + <div class="span-15 prepend-1 colborder"> + <p><img src="test.jpg" class="top pull-1 left" alt="test">Lorem ipsum dolor sit amet, <em>consectetuer adipiscing elit</em>. Nunc congue ipsum vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.</p> + <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. <a href="#">Morbi et risus</a>. Aliquam nisl. Nulla facilisi. Cras accumsan vestibulum ante. Vestibulum sed tortor. Praesent <span class="caps">SMALL CAPS</span> tempus fringilla elit. Ut elit diam, sagittis in, nonummy in, gravida non, nunc. Ut orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam egestas, orci eu imperdiet malesuada, nisl purus fringilla odio, quis commodo est orci vitae justo. Aliquam placerat odio tincidunt nulla. Cras in libero. Aenean rutrum, magna non tristique posuere, erat odio eleifend nisl, non convallis est tortor blandit ligula. Nulla id augue.</p> + <p>Nullam mattis, odio ut tempus facilisis, metus nisl facilisis metus, auctor consectetuer felis ligula nec mauris. Vestibulum odio erat, fermentum at, commodo vitae, ultrices et, urna. Mauris vulputate, mi pulvinar sagittis condimentum, sem nulla aliquam velit, sed imperdiet mi purus eu magna. Nulla varius metus ut eros. Aenean aliquet magna eget orci. Class aptent taciti sociosqu ad litora.</p> + <p>Vivamus euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse vel nibh ut turpis dictum sagittis. Aliquam vel velit a elit auctor sollicitudin. Nam vel dui vel neque lacinia pretium. Quisque nunc erat, venenatis id, volutpat ut, scelerisque sed, diam. Mauris ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec mattis. Morbi dignissim sollicitudin libero. Nulla lorem.</p> + <blockquote> + <p>Integer cursus ornare mauris. Praesent nisl arcu, imperdiet eu, ornare id, scelerisque ut, nunc. Praesent sagittis erat sed velit tempus imperdiet. Ut tristique, ante in interdum hendrerit, erat enim faucibus felis, quis rutrum mauris lorem quis sem. Vestibulum ligula nisi, mattis nec, posuere et, blandit eu, ligula. Nam suscipit placerat odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Pellentesque tortor libero, venenatis vitae, rhoncus eu, placerat ut, mi. Nulla nulla.</p> + </blockquote> + <p>Maecenas vel metus quis magna pharetra fermentum. <em>Integer sit amet tortor</em>. Maecenas porttitor, pede sed gravida auctor, nulla augue aliquet elit, at pretium urna orci ut metus. Aliquam in dolor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, tellus id ornare posuere, quam nunc accumsan turpis, at convallis tellus orci et nisl. Phasellus congue neque a lorem.</p> + <hr> + <div class="span-7 colborder"> + <h6>This is a nested column</h6> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p> + </div> + <div class="span-7 last"> + <h6>This is another nested column</h6> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p> + </div> + </div> + <div class="span-7 last"> + <h3>A <span class="alt">Simple</span> Sidebar</h3> + <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.</p> + <p>Mauris a lectus. Aliquam erat volutpat. Phasellus ultrices mi a sapien. Nunc rutrum egestas lorem. Duis ac sem sagittis elit tincidunt gravida. Mauris a lectus. Aliquam erat volutpat. Phasellus ultrices mi a sapien. Nunc rutrum egestas lorem. Duis ac sem sagittis elit tincidunt gravida.</p> + <p class="quiet">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.</p> + <h5>Incremental leading</h5> + <p class="incr">Vestibulum ante ipsum primis in faucibus orci luctus vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus.</p> + <p class="incr">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras ornare mattis nunc. Mauris venenatis, pede sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue. sed aliquet vehicula, lectus tellus pulvinar neque, non cursus sem nisi vel augue.</p> + </div> + <hr> + <h2 class="alt">You may pick and choose amongst these and many more features, so be bold.</h2> + <hr> + <p> + <a href="http://validator.w3.org/check?uri=referer"> + <img src="valid.png" alt="Valid HTML 4.01 Strict" height="31" width="88" class="top"> + </a> + </p> + </div> + </body> +</html> diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test-small.jpg b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test-small.jpg new file mode 100755 index 0000000..aa599d9 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test-small.jpg differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test.jpg b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test.jpg new file mode 100755 index 0000000..0107be2 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/test.jpg differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/valid.png b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/valid.png new file mode 100755 index 0000000..dd20e49 Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-b97245e/tests/parts/valid.png differ diff --git a/public/stylesheets/joshuaclayton-blueprint-css-v1.0RC2-lw-2-gb97245e.zip b/public/stylesheets/joshuaclayton-blueprint-css-v1.0RC2-lw-2-gb97245e.zip new file mode 100644 index 0000000..54ff68b Binary files /dev/null and b/public/stylesheets/joshuaclayton-blueprint-css-v1.0RC2-lw-2-gb97245e.zip differ diff --git a/sample_app.tmproj b/sample_app.tmproj new file mode 100644 index 0000000..9498f6d --- /dev/null +++ b/sample_app.tmproj @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>documents</key> + <array> + <dict> + <key>expanded</key> + <true/> + <key>name</key> + <string>sample_app</string> + <key>regexFolderFilter</key> + <string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string> + <key>sourceDirectory</key> + <string></string> + </dict> + </array> + <key>fileHierarchyDrawerWidth</key> + <integer>200</integer> + <key>metaData</key> + <dict/> + <key>showFileHierarchyDrawer</key> + <true/> + <key>windowFrame</key> + <string>{{220, 140}, {870, 812}}</string> +</dict> +</plist> diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb new file mode 100644 index 0000000..80de3f0 --- /dev/null +++ b/spec/controllers/users_controller_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe UsersController do + render_views + + describe "GET 'new'" do + it "should be successful" do + get 'new' + response.should be_success + end + + it "should have the right title" do + get 'new' + response.should have_selector("title", :content => "Sign up") + end + end +end diff --git a/spec/requests/layout_links_spec.rb b/spec/requests/layout_links_spec.rb new file mode 100644 index 0000000..48ec215 --- /dev/null +++ b/spec/requests/layout_links_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe "LayoutLinks" do + + it "should have a Home page at '/'" do + get '/' + response.should have_selector('title', :content => "Home") + end + + it "should have a Contact page at '/contact'" do + get '/contact' + response.should have_selector('title', :content => "Contact") + end + + it "should have an About page at '/about'" do + get '/about' + response.should have_selector('title', :content => "About") + end + + it "should have a Help page at '/help'" do + get '/help' + response.should have_selector('title', :content => "Help") + end + + it "should have a signup page at '/signup'" do + get '/signup' + response.should have_selector('title', :content => "Sign up") + end + end
gpapini/sample_app
2561c6301dbedabf17c7c56420ef0c2e665f5387
Removed default Rails page
diff --git a/.DS_Store b/.DS_Store index 39c90b7..6b6238a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..8165d9f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,12 @@ module ApplicationHelper + + # Return a title on a per-page basis. + def title + base_title = "Ruby on Rails Tutorial Sample App" + if @title.nil? + base_title + else + "RoR Tutorial | #{@title}" + end + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7e57fc2..6f1c049 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,10 +1,17 @@ <!DOCTYPE html> <html> <head> - <title>RoR Tutorial | <%= @title %></title> + <title><%= title %></title> <%= csrf_meta_tag %> + <%= render 'layouts/stylesheets' %> </head> <body> - <%= yield %> + <div class="container"> + <%= render 'layouts/header' %> + <section> + <%= yield %> + </section> + <%= render 'layouts/footer' %> + </div> </body> -</html> +</html> \ No newline at end of file diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 827bb92..c574df1 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,6 +1,9 @@ <h1>Sample App</h1> + <p> This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application. -</p> \ No newline at end of file +</p> + +<%= link_to "Sign up now!", '#', :class => "signup_button round" %> diff --git a/config/routes.rb b/config/routes.rb index 0a56350..a826902 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,66 +1,73 @@ SampleApp::Application.routes.draw do - get "pages/home" + match '/contact', :to => 'pages#contact' + match '/about', :to => 'pages#about' + match '/help', :to => 'pages#help' + + root :to => 'pages#home' + + + # get "pages/home" - get "pages/contact" + # get "pages/contact" - get "pages/about" + # get "pages/about" # get "pages/help" # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get 'recent', :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. # root :to => "welcome#index" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that's not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match ':controller(/:action(/:id(.:format)))' end diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 75d5edd..0000000 --- a/public/index.html +++ /dev/null @@ -1,239 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Ruby on Rails: Welcome aboard</title> - <style type="text/css" media="screen"> - body { - margin: 0; - margin-bottom: 25px; - padding: 0; - background-color: #f0f0f0; - font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana"; - font-size: 13px; - color: #333; - } - - h1 { - font-size: 28px; - color: #000; - } - - a {color: #03c} - a:hover { - background-color: #03c; - color: white; - text-decoration: none; - } - - - #page { - background-color: #f0f0f0; - width: 750px; - margin: 0; - margin-left: auto; - margin-right: auto; - } - - #content { - float: left; - background-color: white; - border: 3px solid #aaa; - border-top: none; - padding: 25px; - width: 500px; - } - - #sidebar { - float: right; - width: 175px; - } - - #footer { - clear: both; - } - - - #header, #about, #getting-started { - padding-left: 75px; - padding-right: 30px; - } - - - #header { - background-image: url("images/rails.png"); - background-repeat: no-repeat; - background-position: top left; - height: 64px; - } - #header h1, #header h2 {margin: 0} - #header h2 { - color: #888; - font-weight: normal; - font-size: 16px; - } - - - #about h3 { - margin: 0; - margin-bottom: 10px; - font-size: 14px; - } - - #about-content { - background-color: #ffd; - border: 1px solid #fc0; - margin-left: -55px; - margin-right: -10px; - } - #about-content table { - margin-top: 10px; - margin-bottom: 10px; - font-size: 11px; - border-collapse: collapse; - } - #about-content td { - padding: 10px; - padding-top: 3px; - padding-bottom: 3px; - } - #about-content td.name {color: #555} - #about-content td.value {color: #000} - - #about-content ul { - padding: 0; - list-style-type: none; - } - - #about-content.failure { - background-color: #fcc; - border: 1px solid #f00; - } - #about-content.failure p { - margin: 0; - padding: 10px; - } - - - #getting-started { - border-top: 1px solid #ccc; - margin-top: 25px; - padding-top: 15px; - } - #getting-started h1 { - margin: 0; - font-size: 20px; - } - #getting-started h2 { - margin: 0; - font-size: 14px; - font-weight: normal; - color: #333; - margin-bottom: 25px; - } - #getting-started ol { - margin-left: 0; - padding-left: 0; - } - #getting-started li { - font-size: 18px; - color: #888; - margin-bottom: 25px; - } - #getting-started li h2 { - margin: 0; - font-weight: normal; - font-size: 18px; - color: #333; - } - #getting-started li p { - color: #555; - font-size: 13px; - } - - - #sidebar ul { - margin-left: 0; - padding-left: 0; - } - #sidebar ul h3 { - margin-top: 25px; - font-size: 16px; - padding-bottom: 10px; - border-bottom: 1px solid #ccc; - } - #sidebar li { - list-style-type: none; - } - #sidebar ul.links li { - margin-bottom: 5px; - } - - </style> - <script type="text/javascript"> - function about() { - info = document.getElementById('about-content'); - if (window.XMLHttpRequest) - { xhr = new XMLHttpRequest(); } - else - { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } - xhr.open("GET","rails/info/properties",false); - xhr.send(""); - info.innerHTML = xhr.responseText; - info.style.display = 'block' - } - </script> - </head> - <body> - <div id="page"> - <div id="sidebar"> - <ul id="sidebar-items"> - <li> - <h3>Browse the documentation</h3> - <ul class="links"> - <li><a href="http://api.rubyonrails.org/">Rails API</a></li> - <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li> - <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li> - <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li> - </ul> - </li> - </ul> - </div> - - <div id="content"> - <div id="header"> - <h1>Welcome aboard</h1> - <h2>You&rsquo;re riding Ruby on Rails!</h2> - </div> - - <div id="about"> - <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3> - <div id="about-content" style="display: none"></div> - </div> - - <div id="getting-started"> - <h1>Getting started</h1> - <h2>Here&rsquo;s how to get rolling:</h2> - - <ol> - <li> - <h2>Use <code>rails generate</code> to create your models and controllers</h2> - <p>To see all available options, run it without parameters.</p> - </li> - - <li> - <h2>Set up a default route and remove or rename this file</h2> - <p>Routes are set up in config/routes.rb.</p> - </li> - - <li> - <h2>Create your database</h2> - <p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p> - </li> - </ol> - </div> - </div> - - <div id="footer">&nbsp;</div> - </div> - </body> -</html> diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index 75178fc..79a39ba 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -1,46 +1,63 @@ require 'spec_helper' describe PagesController do render_views + before(:each) do + @base_title = "RoR Tutorial | " + end + + describe "GET 'home'" do it "should be successful" do get 'home' response.should be_success end it "should have the right title" do get 'home' response.should have_selector("title", - :content => "RoR Tutorial | Home") + :content => @base_title + "Home") end end describe "GET 'contact'" do it "should be successful" do get 'contact' response.should be_success end it "should have the right title" do get 'contact' response.should have_selector("title", - :content => - "RoR Tutorial | Contact") + :content => @base_title + "Contact") end end describe "GET 'about'" do it "should be successful" do get 'about' response.should be_success end it "should have the right title" do get 'about' response.should have_selector("title", - :content => - "RoR Tutorial | About") + :content => @base_title + "About") + end + end + + describe "GET 'help'" do + it "should be successful" do + get 'help' + response.should be_success + end + + it "should have the right title" do + get 'help' + response.should have_selector("title", + :content => @base_title + "Help") end end + end
gpapini/sample_app
b8aab99987c2de8060bbb270762f5d19e92cfdd5
Done with static pages
diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..39c90b7 Binary files /dev/null and b/.DS_Store differ diff --git a/.rspec b/.rspec index 53607ea..32c26c2 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --colour +--drb \ No newline at end of file diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000..2b4b344 Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 5635120..b5dee2a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,8 +1,18 @@ class PagesController < ApplicationController def home + @title = "Home" end def contact + @title = "Contact" end + def about + @title = "About" + end + + def help + @title = "Help" + end + end diff --git a/app/views/.DS_Store b/app/views/.DS_Store new file mode 100644 index 0000000..80e8837 Binary files /dev/null and b/app/views/.DS_Store differ diff --git a/app/views/layouts/.DS_Store b/app/views/layouts/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/app/views/layouts/.DS_Store differ diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7d43f58..7e57fc2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,10 @@ <!DOCTYPE html> <html> -<head> - <title>SampleApp</title> - <%= stylesheet_link_tag :all %> - <%= javascript_include_tag :defaults %> - <%= csrf_meta_tag %> -</head> -<body> - -<%= yield %> - -</body> + <head> + <title>RoR Tutorial | <%= @title %></title> + <%= csrf_meta_tag %> + </head> + <body> + <%= yield %> + </body> </html> diff --git a/app/views/pages/about.html.erb b/app/views/pages/about.html.erb new file mode 100644 index 0000000..2f42557 --- /dev/null +++ b/app/views/pages/about.html.erb @@ -0,0 +1,7 @@ +<h1>About Us</h1> +<p> + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> + is a project to make a book and screencasts to teach web development + with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This + is the sample application for the tutorial. +</p> diff --git a/app/views/pages/contact.html.erb b/app/views/pages/contact.html.erb index 6c6359a..9c3c793 100644 --- a/app/views/pages/contact.html.erb +++ b/app/views/pages/contact.html.erb @@ -1,2 +1,5 @@ -<h1>Pages#contact</h1> -<p>Find me in app/views/pages/contact.html.erb</p> +<h1>Contact</h1> +<p> + Contact Ruby on Rails Tutorial about the sample app at the + <a href="http://railstutorial.org/feedback">feedback page</a>. +</p> diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 3453cf2..827bb92 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,2 +1,6 @@ -<h1>Pages#home</h1> -<p>Find me in app/views/pages/home.html.erb</p> +<h1>Sample App</h1> +<p> + This is the home page for the + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> + sample application. +</p> \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 0682943..f866c9f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,42 +1,20 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module SampleApp class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # JavaScript files you want as :defaults (application.js is always included). - # config.action_view.javascript_expansions[:defaults] = %w(jquery rails) - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] + ### Part of a Spork hack. See http://bit.ly/arY19y + if Rails.env.test? + initializer :after => :initialize_dependency_mechanism do + # Work around initializer in railties/lib/rails/application/bootstrap.rb + ActiveSupport::Dependencies.mechanism = :load + end + end end end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index 4f9be83..75178fc 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -1,19 +1,46 @@ require 'spec_helper' describe PagesController do + render_views describe "GET 'home'" do it "should be successful" do get 'home' response.should be_success end + + it "should have the right title" do + get 'home' + response.should have_selector("title", + :content => "RoR Tutorial | Home") + end end describe "GET 'contact'" do it "should be successful" do get 'contact' response.should be_success end + + it "should have the right title" do + get 'contact' + response.should have_selector("title", + :content => + "RoR Tutorial | Contact") + end end + describe "GET 'about'" do + it "should be successful" do + get 'about' + response.should be_success + end + + it "should have the right title" do + get 'about' + response.should have_selector("title", + :content => + "RoR Tutorial | About") + end + end end diff --git a/spec/helpers/pages_helper_spec.rb b/spec/helpers/pages_helper_spec.rb deleted file mode 100644 index 4f75448..0000000 --- a/spec/helpers/pages_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the PagesHelper. For example: -# -# describe PagesHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe PagesHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 34d2c1b..447111a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,27 +1,43 @@ -# This file is copied to ~/spec when you run 'ruby script/generate rspec' -# from the project root directory. -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' +require 'rubygems' +require 'spork' -# Requires supporting files with custom matchers and macros, etc, -# in ./support/ and its subdirectories. -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} +Spork.prefork do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. + ENV["RAILS_ENV"] ||= 'test' + unless defined?(Rails) + require File.dirname(__FILE__) + "/../config/environment" + end + require 'rspec/rails' -RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec + # Requires supporting files with custom matchers and macros, etc, + # in ./support/ and its subdirectories. + Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} - config.fixture_path = "#{::Rails.root}/spec/fixtures" + Rspec.configure do |config| + # == Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + config.mock_with :rspec - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, comment the following line or assign false - # instead of true. - config.use_transactional_fixtures = true + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, comment the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + ### Part of a Spork hack. See http://bit.ly/arY19y + # Emulate initializer set_clear_dependencies_hook in + # railties/lib/rails/application/bootstrap.rb + ActiveSupport::Dependencies.clear + end +end + +Spork.each_run do end diff --git a/spec/views/pages/contact.html.erb_spec.rb b/spec/views/pages/contact.html.erb_spec.rb deleted file mode 100644 index ba5b0d1..0000000 --- a/spec/views/pages/contact.html.erb_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe "pages/contact.html.erb" do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/views/pages/home.html.erb_spec.rb b/spec/views/pages/home.html.erb_spec.rb deleted file mode 100644 index b5fdff5..0000000 --- a/spec/views/pages/home.html.erb_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe "pages/home.html.erb" do - pending "add some examples to (or delete) #{__FILE__}" -end
gpapini/sample_app
c9b3e0290f218e386c50cb87c5c148a17dc20ba1
Added Pages controller
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb new file mode 100644 index 0000000..5635120 --- /dev/null +++ b/app/controllers/pages_controller.rb @@ -0,0 +1,8 @@ +class PagesController < ApplicationController + def home + end + + def contact + end + +end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb new file mode 100644 index 0000000..2c057fd --- /dev/null +++ b/app/helpers/pages_helper.rb @@ -0,0 +1,2 @@ +module PagesHelper +end diff --git a/app/views/pages/contact.html.erb b/app/views/pages/contact.html.erb new file mode 100644 index 0000000..6c6359a --- /dev/null +++ b/app/views/pages/contact.html.erb @@ -0,0 +1,2 @@ +<h1>Pages#contact</h1> +<p>Find me in app/views/pages/contact.html.erb</p> diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb new file mode 100644 index 0000000..3453cf2 --- /dev/null +++ b/app/views/pages/home.html.erb @@ -0,0 +1,2 @@ +<h1>Pages#home</h1> +<p>Find me in app/views/pages/home.html.erb</p> diff --git a/config/database.yml b/config/database.yml index 434c667..5f2a4d0 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,39 +1,39 @@ # MySQL. Versions 4.1 and 5.0 are recommended. # # Install the MySQL driver: -# gem install mysql2 +# gem install mysql # # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: - adapter: mysql2 + adapter: mysql encoding: utf8 reconnect: false database: sample_app_development pool: 5 username: root - password: + password: mshell1 socket: /tmp/mysql.sock # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: - adapter: mysql2 + adapter: mysql encoding: utf8 reconnect: false database: sample_app_test pool: 5 username: root - password: + password: mshell1 socket: /tmp/mysql.sock production: - adapter: mysql2 + adapter: mysql encoding: utf8 reconnect: false database: sample_app_production pool: 5 username: root - password: + password: mshell1 socket: /tmp/mysql.sock diff --git a/config/routes.rb b/config/routes.rb index f6e7918..0a56350 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,58 +1,66 @@ SampleApp::Application.routes.draw do + get "pages/home" + + get "pages/contact" + + get "pages/about" + + # get "pages/help" + # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products # Sample resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end # Sample resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Sample resource route with more complex sub-resources # resources :products do # resources :comments # resources :sales do # get 'recent', :on => :collection # end # end # Sample resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end # You can have the root of your site routed with "root" # just remember to delete public/index.html. # root :to => "welcome#index" # See how all your routes lay out with "rake routes" # This is a legacy wild controller route that's not recommended for RESTful applications. # Note: This route will make all actions in every controller accessible via GET requests. # match ':controller(/:action(/:id(.:format)))' end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..671c0da --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,15 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 0) do + +end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb new file mode 100644 index 0000000..4f9be83 --- /dev/null +++ b/spec/controllers/pages_controller_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe PagesController do + + describe "GET 'home'" do + it "should be successful" do + get 'home' + response.should be_success + end + end + + describe "GET 'contact'" do + it "should be successful" do + get 'contact' + response.should be_success + end + end + +end diff --git a/spec/helpers/pages_helper_spec.rb b/spec/helpers/pages_helper_spec.rb new file mode 100644 index 0000000..4f75448 --- /dev/null +++ b/spec/helpers/pages_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PagesHelper. For example: +# +# describe PagesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe PagesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/pages/contact.html.erb_spec.rb b/spec/views/pages/contact.html.erb_spec.rb new file mode 100644 index 0000000..ba5b0d1 --- /dev/null +++ b/spec/views/pages/contact.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "pages/contact.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/pages/home.html.erb_spec.rb b/spec/views/pages/home.html.erb_spec.rb new file mode 100644 index 0000000..b5fdff5 --- /dev/null +++ b/spec/views/pages/home.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "pages/home.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end
gpapini/sample_app
34f52c2e0ecdc0037ffbc0fa8e3c4ff7ddc3bd59
Improved the README
diff --git a/README b/README deleted file mode 100644 index 6966fe9..0000000 --- a/README +++ /dev/null @@ -1,256 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name) - -2. Change directory to <tt>myapp</tt> and start the web server: - <tt>cd myapp; rails server</tt> (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#<Post:0x14a6be8 - @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>, - #<Post:0x14a6620 - @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run <tt>rails console</tt> from the application -directory. - -Options: - -* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: <tt>rails console production</tt>. - -To reload your controllers and models after launching the console run -<tt>reload!</tt> - -More information about irb can be found at: -link:http://www.rubycentral.com/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through <tt>rails -dbconsole</tt>. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like <tt>rails dbconsole production</tt>. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- controllers - | |-- helpers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - | |-- images - | |-- javascripts - | `-- stylesheets - |-- script - | `-- performance - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the <tt>layout :default</tt> and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using <tt>rake doc:app</tt> - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Contains subdirectories for - images, stylesheets, and javascripts. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9aeab62 --- /dev/null +++ b/README.markdown @@ -0,0 +1,5 @@ +# Ruby on Rails Tutorial: sample application + +This is the sample application for +[*Ruby on Rails Tutorial: Learn Rails by Example*](http://railstutorial.org/) +by [Michael Hartl](http://michaelhartl.com/).
gmosx/sizzle
662ad2611fba7e9cebbe375ae9fd4956b1d9d741
Improved API.
diff --git a/README.md b/README.md index a16c771..f21f5ec 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,23 @@ Sizzle ====== [Sizzle](http://wiki.github.com/jeresig/sizzle) packaged for [CommonJS](http://www.commonjs.org). Usage ----- - var SIZZLE = require("sizzle"), - $ = SIZZLE.init(document); + var html = '<html>...</html>', + document = require("htmlparser").parse(html), + $ = require("sizzle").sizzle(document); $(".test").forEach(function(el) { print(el.innerHTML); }); Credits ------- Copyright (c) John Resig. Copyright (c) Dojo Foundation. diff --git a/lib/sizzle.js b/lib/sizzle.js index dd30188..2f11ce2 100644 --- a/lib/sizzle.js +++ b/lib/sizzle.js @@ -1,513 +1,513 @@ -exports.init = function(document) { +exports.sizzle = function(document) { /*! * Sizzle CSS Selector Engine - v1.0 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function(){ baseHasDuplicate = false; return 0; }); var Sizzle = function(selector, context, results, seed) { results = results || []; var origContext = context = context || document; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), soFar = selector; // Reset the position of the chunker regexp (start from head) while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) selector += parts.shift(); set = posProcess( selector, set ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { var ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { var ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray(set); } else { prune = false; } while ( parts.length ) { var cur = parts.pop(), pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { throw "Syntax error, unrecognized expression: " + (cur || selector); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function(results){ if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort(sortOrder); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[i-1] ) { results.splice(i--, 1); } } } } return results; }; Sizzle.matches = function(expr, set){ return Sizzle(expr, null, null, set); }; Sizzle.find = function(expr, context, isXML){ var set, match; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var type = Expr.order[i], match; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { var left = match[1]; match.splice(1,1); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = context.getElementsByTagName("*"); } return {set: set, expr: expr}; }; Sizzle.filter = function(expr, set, inplace, not){ var old = expr, result = [], curLoop = set, match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.match[ type ].exec( expr )) != null ) { var filter = Expr.filter[ type ], found, item; anyFound = false; if ( curLoop == result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr == old ) { if ( anyFound == null ) { throw "Syntax error, unrecognized expression: " + expr; } else { break; } } old = expr; } return curLoop; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(elem){ return elem.getAttribute("href"); } }, relative: { "+": function(checkSet, part, isXML){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test(part), isPartStrNotTag = isPartStr && !isTag; if ( isTag && !isXML ) { part = part.toUpperCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function(checkSet, part, isXML){ var isPartStr = typeof part === "string"; if ( isPartStr && !/\W/.test(part) ) { part = isXML ? part : part.toUpperCase(); for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName === part ? parent : false; } } } else { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( !/\W/.test(part) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); }, "~": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); } }, find: { ID: function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? [m] : []; } }, NAME: function(match, context, isXML){ if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName(match[1]); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function(match, context){ return context.getElementsByTagName(match[1]); } }, preFilter: { CLASS: function(match, curLoop, inplace, result, not, isXML){ match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { if ( !inplace ) result.push( elem ); } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function(match){ return match[1].replace(/\\/g, ""); }, TAG: function(match, curLoop){ for ( var i = 0; curLoop[i] === false; i++ ){} return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); }, CHILD: function(match){ if ( match[1] == "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function(match, curLoop, inplace, result, not, isXML){ var name = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function(match){ match.unshift( true ); return match; } }, filters: { enabled: function(elem){ return elem.disabled === false && elem.type !== "hidden"; }, disabled: function(elem){ return elem.disabled === true; }, checked: function(elem){ return elem.checked === true; }, selected: function(elem){ // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function(elem){ return !!elem.firstChild; }, empty: function(elem){ return !elem.firstChild; }, has: function(elem, i, match){ return !!Sizzle( match[3], elem ).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); }, text: function(elem){ return "text" === elem.type; }, radio: function(elem){ return "radio" === elem.type; }, checkbox: function(elem){ return "checkbox" === elem.type; }, file: function(elem){
gmosx/sizzle
fbdedabd6e956ad08ef3de87187c4b49323e51f9
Pass document to initialize (safer). The api needs improvement though.
diff --git a/README.md b/README.md index ffbcc55..a16c771 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ Sizzle ====== -Sizzle (http://wiki.github.com/jeresig/sizzle) packaged for CommonJS. +[Sizzle](http://wiki.github.com/jeresig/sizzle) packaged for [CommonJS](http://www.commonjs.org). + + +Usage +----- + + var SIZZLE = require("sizzle"), + $ = SIZZLE.init(document); + + $(".test").forEach(function(el) { + print(el.innerHTML); + }); Credits ------- Copyright (c) John Resig. Copyright (c) Dojo Foundation. diff --git a/lib/sizzle.js b/lib/sizzle.js index b3cef31..dd30188 100644 --- a/lib/sizzle.js +++ b/lib/sizzle.js @@ -1,1016 +1,1024 @@ +exports.init = function(document) { + + /*! * Sizzle CSS Selector Engine - v1.0 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function(){ baseHasDuplicate = false; return 0; }); var Sizzle = function(selector, context, results, seed) { results = results || []; var origContext = context = context || document; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), soFar = selector; // Reset the position of the chunker regexp (start from head) while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) selector += parts.shift(); set = posProcess( selector, set ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { var ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { var ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray(set); } else { prune = false; } while ( parts.length ) { var cur = parts.pop(), pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { throw "Syntax error, unrecognized expression: " + (cur || selector); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function(results){ if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort(sortOrder); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[i-1] ) { results.splice(i--, 1); } } } } return results; }; Sizzle.matches = function(expr, set){ return Sizzle(expr, null, null, set); }; Sizzle.find = function(expr, context, isXML){ var set, match; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var type = Expr.order[i], match; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { var left = match[1]; match.splice(1,1); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = context.getElementsByTagName("*"); } return {set: set, expr: expr}; }; Sizzle.filter = function(expr, set, inplace, not){ var old = expr, result = [], curLoop = set, match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.match[ type ].exec( expr )) != null ) { var filter = Expr.filter[ type ], found, item; anyFound = false; if ( curLoop == result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr == old ) { if ( anyFound == null ) { throw "Syntax error, unrecognized expression: " + expr; } else { break; } } old = expr; } return curLoop; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(elem){ return elem.getAttribute("href"); } }, relative: { "+": function(checkSet, part, isXML){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test(part), isPartStrNotTag = isPartStr && !isTag; if ( isTag && !isXML ) { part = part.toUpperCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function(checkSet, part, isXML){ var isPartStr = typeof part === "string"; if ( isPartStr && !/\W/.test(part) ) { part = isXML ? part : part.toUpperCase(); for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName === part ? parent : false; } } } else { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( !/\W/.test(part) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); }, "~": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); } }, find: { ID: function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? [m] : []; } }, NAME: function(match, context, isXML){ if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName(match[1]); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function(match, context){ return context.getElementsByTagName(match[1]); } }, preFilter: { CLASS: function(match, curLoop, inplace, result, not, isXML){ match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { if ( !inplace ) result.push( elem ); } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function(match){ return match[1].replace(/\\/g, ""); }, TAG: function(match, curLoop){ for ( var i = 0; curLoop[i] === false; i++ ){} return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); }, CHILD: function(match){ if ( match[1] == "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function(match, curLoop, inplace, result, not, isXML){ var name = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function(match){ match.unshift( true ); return match; } }, filters: { enabled: function(elem){ return elem.disabled === false && elem.type !== "hidden"; }, disabled: function(elem){ return elem.disabled === true; }, checked: function(elem){ return elem.checked === true; }, selected: function(elem){ // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function(elem){ return !!elem.firstChild; }, empty: function(elem){ return !elem.firstChild; }, has: function(elem, i, match){ return !!Sizzle( match[3], elem ).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); }, text: function(elem){ return "text" === elem.type; }, radio: function(elem){ return "radio" === elem.type; }, checkbox: function(elem){ return "checkbox" === elem.type; }, file: function(elem){ return "file" === elem.type; }, password: function(elem){ return "password" === elem.type; }, submit: function(elem){ return "submit" === elem.type; }, image: function(elem){ return "image" === elem.type; }, reset: function(elem){ return "reset" === elem.type; }, button: function(elem){ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; }, input: function(elem){ return /input|select|textarea|button/i.test(elem.nodeName); } }, setFilters: { first: function(elem, i){ return i === 0; }, last: function(elem, i, match, array){ return i === array.length - 1; }, even: function(elem, i){ return i % 2 === 0; }, odd: function(elem, i){ return i % 2 === 1; }, lt: function(elem, i, match){ return i < match[3] - 0; }, gt: function(elem, i, match){ return i > match[3] - 0; }, nth: function(elem, i, match){ return match[3] - 0 == i; }, eq: function(elem, i, match){ return match[3] - 0 == i; } }, filter: { PSEUDO: function(elem, match, i, array){ var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } } return true; } }, CHILD: function(elem, match){ var type = match[1], node = elem; switch (type) { case 'only': case 'first': while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) return false; } if ( type == 'first') return true; node = elem; case 'last': while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) return false; } return true; case 'nth': var first = match[2], last = match[3]; if ( first == 1 && last == 0 ) { return true; } var doneName = match[0], parent = elem.parentNode; if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent.sizcache = doneName; } var diff = elem.nodeIndex - last; if ( first == 0 ) { return diff == 0; } else { return ( diff % first == 0 && diff / first >= 0 ); } } }, ID: function(elem, match){ return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function(elem, match){ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; }, CLASS: function(elem, match){ return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function(elem, match){ var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value != check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function(elem, match, i, array){ var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS; for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); } var makeArray = function(array, results) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. try { Array.prototype.slice.call( document.documentElement.childNodes, 0 ); // Provide a fallback method if it does not work } catch(e){ makeArray = function(array, results) { var ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var i = 0, l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( var i = 0; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { if ( a == b ) { hasDuplicate = true; } return 0; } var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( "sourceIndex" in document.documentElement ) { sortOrder = function( a, b ) { if ( !a.sourceIndex || !b.sourceIndex ) { if ( a == b ) { hasDuplicate = true; } return 0; } var ret = a.sourceIndex - b.sourceIndex; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( document.createRange ) { sortOrder = function( a, b ) { if ( !a.ownerDocument || !b.ownerDocument ) { if ( a == b ) { hasDuplicate = true; } return 0; } var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.setStart(a, 0); aRange.setEnd(a, 0); bRange.setStart(b, 0); bRange.setEnd(b, 0); var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), id = "script" + (new Date).getTime(); form.innerHTML = "<a name='" + id + "'/>"; // Inject it into the root element, check its status, and remove it quickly var root = document.documentElement; root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( !!document.getElementById( id ) ) { Expr.find.ID = function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function(elem, match){ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); root = form = null; // release memory in IE })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function(match, context){ var results = context.getElementsByTagName(match[1]); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = "<a href='#'></a>"; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { + if (false) { +// if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && +// div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function(elem){ return elem.getAttribute("href", 2); }; } div = null; // release memory in IE })(); if ( document.querySelectorAll ) (function(){ var oldSizzle = Sizzle, div = document.createElement("div"); div.innerHTML = "<p class='TEST'></p>"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function(query, context, extra, seed){ context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && context.nodeType === 9 && !isXML(context) ) { try { return makeArray( context.querySelectorAll(query), extra ); } catch(e){} } return oldSizzle(query, context, extra, seed); }; for ( var prop in oldSizzle ) { Sizzle[ prop ] = oldSizzle[ prop ]; } div = null; // release memory in IE })(); if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ var div = document.createElement("div"); div.innerHTML = "<div class='test e'></div><div class='test'></div>"; // Opera can't find a second classname (in 9.6) if ( div.getElementsByClassName("e").length === 0 ) return; // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) return; Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function(match, context, isXML) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; div = null; // release memory in IE })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ){ elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem.sizcache = doneName; elem.sizset = i; } if ( elem.nodeName === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ) { elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem.sizcache = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } var contains = document.compareDocumentPosition ? function(a, b){ return a.compareDocumentPosition(b) & 16; } : function(a, b){ return a !== b && (a.contains ? a.contains(b) : true); }; var isXML = function(elem){ + return elem.nodeType === 9; return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; }; var posProcess = function(selector, context){ var tmpSet = [], later = "", match, root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE - // window.Sizzle = Sizzle; exports.Sizzle = Sizzle; })(); + + + return exports.Sizzle; +}
gmosx/sizzle
350febf5fec34245ad79c279108dcfaa2dc1716a
Minor.
diff --git a/package.json b/package.json index efab021..4f9cc13 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "sizzle", "description": "A sizzlin' hot selector engine", "keywords": ["sizzle", "selector", "dom"], - "author": "John Resig", - "contributors": [ - "George Moschovitis" + "author": "John Resig (http://ejohn.org)", + "maintainer": [ + "George Moschovitis (http://gmosx.com)" ], "dependencies": [], "lib": ["lib"], "lean": ["lib"] }
gmosx/sizzle
ee03f7c1b9750c90f44edf80a6e9672220d2673f
Created repo.
diff --git a/README.md b/README.md new file mode 100644 index 0000000..ffbcc55 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +Sizzle +====== + +Sizzle (http://wiki.github.com/jeresig/sizzle) packaged for CommonJS. + + +Credits +------- + +Copyright (c) John Resig. +Copyright (c) Dojo Foundation. diff --git a/lib/sizzle.js b/lib/sizzle.js new file mode 100644 index 0000000..b3cef31 --- /dev/null +++ b/lib/sizzle.js @@ -0,0 +1,1016 @@ +/*! + * Sizzle CSS Selector Engine - v1.0 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function(){ + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function(selector, context, results, seed) { + results = results || []; + var origContext = context = context || document; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) + selector += parts.shift(); + + set = posProcess( selector, set ); + } + } + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + var ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; + } + + if ( context ) { + var ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray(set); + } else { + prune = false; + } + + while ( parts.length ) { + var cur = parts.pop(), pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + throw "Syntax error, unrecognized expression: " + (cur || selector); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + } else if ( context && context.nodeType === 1 ) { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + } else { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function(results){ + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort(sortOrder); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[i-1] ) { + results.splice(i--, 1); + } + } + } + } + + return results; +}; + +Sizzle.matches = function(expr, set){ + return Sizzle(expr, null, null, set); +}; + +Sizzle.find = function(expr, context, isXML){ + var set, match; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var type = Expr.order[i], match; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + var left = match[1]; + match.splice(1,1); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace(/\\/g, ""); + set = Expr.find[ type ]( match, context, isXML ); + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = context.getElementsByTagName("*"); + } + + return {set: set, expr: expr}; +}; + +Sizzle.filter = function(expr, set, inplace, not){ + var old = expr, result = [], curLoop = set, match, anyFound, + isXMLFilter = set && set[0] && isXML(set[0]); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.match[ type ].exec( expr )) != null ) { + var filter = Expr.filter[ type ], found, item; + anyFound = false; + + if ( curLoop == result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + } else { + curLoop[i] = false; + } + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr == old ) { + if ( anyFound == null ) { + throw "Syntax error, unrecognized expression: " + expr; + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + match: { + ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ + }, + leftMatch: {}, + attrMap: { + "class": "className", + "for": "htmlFor" + }, + attrHandle: { + href: function(elem){ + return elem.getAttribute("href"); + } + }, + relative: { + "+": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !/\W/.test(part), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag && !isXML ) { + part = part.toUpperCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + ">": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string"; + + if ( isPartStr && !/\W/.test(part) ) { + part = isXML ? part : part.toUpperCase(); + + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName === part ? parent : false; + } + } + } else { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + "": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( !/\W/.test(part) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); + }, + "~": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( typeof part === "string" && !/\W/.test(part) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); + } + }, + find: { + ID: function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? [m] : []; + } + }, + NAME: function(match, context, isXML){ + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], results = context.getElementsByName(match[1]); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + TAG: function(match, context){ + return context.getElementsByTagName(match[1]); + } + }, + preFilter: { + CLASS: function(match, curLoop, inplace, result, not, isXML){ + match = " " + match[1].replace(/\\/g, "") + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { + if ( !inplace ) + result.push( elem ); + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + ID: function(match){ + return match[1].replace(/\\/g, ""); + }, + TAG: function(match, curLoop){ + for ( var i = 0; curLoop[i] === false; i++ ){} + return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); + }, + CHILD: function(match){ + if ( match[1] == "nth" ) { + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + ATTR: function(match, curLoop, inplace, result, not, isXML){ + var name = match[1].replace(/\\/g, ""); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + PSEUDO: function(match, curLoop, inplace, result, not){ + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + if ( !inplace ) { + result.push.apply( result, ret ); + } + return false; + } + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + POS: function(match){ + match.unshift( true ); + return match; + } + }, + filters: { + enabled: function(elem){ + return elem.disabled === false && elem.type !== "hidden"; + }, + disabled: function(elem){ + return elem.disabled === true; + }, + checked: function(elem){ + return elem.checked === true; + }, + selected: function(elem){ + // Accessing this property makes selected-by-default + // options in Safari work properly + elem.parentNode.selectedIndex; + return elem.selected === true; + }, + parent: function(elem){ + return !!elem.firstChild; + }, + empty: function(elem){ + return !elem.firstChild; + }, + has: function(elem, i, match){ + return !!Sizzle( match[3], elem ).length; + }, + header: function(elem){ + return /h\d/i.test( elem.nodeName ); + }, + text: function(elem){ + return "text" === elem.type; + }, + radio: function(elem){ + return "radio" === elem.type; + }, + checkbox: function(elem){ + return "checkbox" === elem.type; + }, + file: function(elem){ + return "file" === elem.type; + }, + password: function(elem){ + return "password" === elem.type; + }, + submit: function(elem){ + return "submit" === elem.type; + }, + image: function(elem){ + return "image" === elem.type; + }, + reset: function(elem){ + return "reset" === elem.type; + }, + button: function(elem){ + return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; + }, + input: function(elem){ + return /input|select|textarea|button/i.test(elem.nodeName); + } + }, + setFilters: { + first: function(elem, i){ + return i === 0; + }, + last: function(elem, i, match, array){ + return i === array.length - 1; + }, + even: function(elem, i){ + return i % 2 === 0; + }, + odd: function(elem, i){ + return i % 2 === 1; + }, + lt: function(elem, i, match){ + return i < match[3] - 0; + }, + gt: function(elem, i, match){ + return i > match[3] - 0; + }, + nth: function(elem, i, match){ + return match[3] - 0 == i; + }, + eq: function(elem, i, match){ + return match[3] - 0 == i; + } + }, + filter: { + PSEUDO: function(elem, match, i, array){ + var name = match[1], filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; + } else if ( name === "not" ) { + var not = match[3]; + + for ( var i = 0, l = not.length; i < l; i++ ) { + if ( not[i] === elem ) { + return false; + } + } + + return true; + } + }, + CHILD: function(elem, match){ + var type = match[1], node = elem; + switch (type) { + case 'only': + case 'first': + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) return false; + } + if ( type == 'first') return true; + node = elem; + case 'last': + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) return false; + } + return true; + case 'nth': + var first = match[2], last = match[3]; + + if ( first == 1 && last == 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + if ( first == 0 ) { + return diff == 0; + } else { + return ( diff % first == 0 && diff / first >= 0 ); + } + } + }, + ID: function(elem, match){ + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + TAG: function(elem, match){ + return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; + }, + CLASS: function(elem, match){ + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + ATTR: function(elem, match){ + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value != check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + POS: function(elem, match, i, array){ + var name = match[2], filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); +} + +var makeArray = function(array, results) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 ); + +// Provide a fallback method if it does not work +} catch(e){ + makeArray = function(array, results) { + var ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + } else { + if ( typeof array.length === "number" ) { + for ( var i = 0, l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + } else { + for ( var i = 0; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( "sourceIndex" in document.documentElement ) { + sortOrder = function( a, b ) { + if ( !a.sourceIndex || !b.sourceIndex ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var ret = a.sourceIndex - b.sourceIndex; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( document.createRange ) { + sortOrder = function( a, b ) { + if ( !a.ownerDocument || !b.ownerDocument ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); + aRange.setStart(a, 0); + aRange.setEnd(a, 0); + bRange.setStart(b, 0); + bRange.setEnd(b, 0); + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date).getTime(); + form.innerHTML = "<a name='" + id + "'/>"; + + // Inject it into the root element, check its status, and remove it quickly + var root = document.documentElement; + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( !!document.getElementById( id ) ) { + Expr.find.ID = function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; + } + }; + + Expr.filter.ID = function(elem, match){ + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + root = form = null; // release memory in IE +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function(match, context){ + var results = context.getElementsByTagName(match[1]); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = "<a href='#'></a>"; + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + Expr.attrHandle.href = function(elem){ + return elem.getAttribute("href", 2); + }; + } + + div = null; // release memory in IE +})(); + +if ( document.querySelectorAll ) (function(){ + var oldSizzle = Sizzle, div = document.createElement("div"); + div.innerHTML = "<p class='TEST'></p>"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function(query, context, extra, seed){ + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && context.nodeType === 9 && !isXML(context) ) { + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(e){} + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + div = null; // release memory in IE +})(); + +if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ + var div = document.createElement("div"); + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; + + // Opera can't find a second classname (in 9.6) + if ( div.getElementsByClassName("e").length === 0 ) + return; + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) + return; + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function(match, context, isXML) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + div = null; // release memory in IE +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ){ + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ) { + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +var contains = document.compareDocumentPosition ? function(a, b){ + return a.compareDocumentPosition(b) & 16; +} : function(a, b){ + return a !== b && (a.contains ? a.contains(b) : true); +}; + +var isXML = function(elem){ + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; +}; + +var posProcess = function(selector, context){ + var tmpSet = [], later = "", match, + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE + +// window.Sizzle = Sizzle; +exports.Sizzle = Sizzle; + +})(); diff --git a/package.json b/package.json new file mode 100644 index 0000000..efab021 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "sizzle", + "description": "A sizzlin' hot selector engine", + "keywords": ["sizzle", "selector", "dom"], + "author": "John Resig", + "contributors": [ + "George Moschovitis" + ], + "dependencies": [], + "lib": ["lib"], + "lean": ["lib"] +} +
davec/localized_language_select
d88527a62eb3854ac42a6602d28342f531a82f12
Additional German entries
diff --git a/locale/de.yml b/locale/de.yml index e528818..269fac6 100644 --- a/locale/de.yml +++ b/locale/de.yml @@ -1,6 +1,69 @@ de: languages: + af: "Afrikaans" + ar: "Arabisch" + bn: "Bengali" + bo: "Tibetisch" + br: "Bretonische" + cs: "Tschechisch" + cy: "Walisisch" + da: "Dänisch" de: "Deutsch" - fr: "Französisch" + el: "Griechisch" en: "Englisch" + es: "Spanisch" + et: "Estnisch" + eu: "Baskisch" + fa: "Persisch" + fi: "Finnisch" + fr: "Französisch" + he: "Hebräisch" + hi: "Hindi" + hr: "Kroatisch" + hu: "Ungarisch" + is: "Isländisch" it: "Italienisch" + ja: "Japanisch" + jv: "Javanisch" + ka: "Georgisch" + ko: "Koreanisch" + kw: "Kornisch" + la: "Lateinisch" + lo: "Laotisch" + lt: "Litauische" + lv: "Lettisch" + mg: "Madagassisch" + mk: "Mazedonisch" + mn: "Mongolisch" + mo: "Moldauisch" + ms: "Malaiisch" + mt: "Maltesisch" + my: "Birmanisch" + nl: "Niederländisch" + "nl-BE": "Flämisch" + no: "Norwegisch" + pa: "Pundschabi" + pl: "Polnisch" + pt: "Portugiesisch" + ro: "Rumänisch" + ru: "Russisch" + sc: "Sardisch" + scn: "Sizilisch" + sco: "Schottisch" + sh: "Serbokroatisch" + sk: "Slowakisch" + sl: "Slowenisch" + sm: "Samoanisch" + sq: "Albanisch" + sr: "Serbisch" + su: "Sudanisch" + sux: "Sumerisch" + sv: "Schwedisch" + syr: "Syrisch" + ta: "Tamulisch" + tr: "Türkisch" + tt: "Tatarisch" + uk: "Ukrainisch" + uz: "Usbekisch" + yi: "Jiddisch" + zh: "Chinesisch"
davec/localized_language_select
f8e4048f714269fdf05de3ce06a8b586b48959f7
Accept symbols and strings in #priority_languages_array
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index e9a017b..47784ce 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,117 +1,117 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # # require 'localized_language_select/i18n' module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| res << [value, key.to_s] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) - language_codes.map { |code| [languages[code], code.to_s] } + language_codes.map { |code| [languages[code.to_sym], code.to_s] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/test/localized_language_select_test.rb b/test/localized_language_select_test.rb index b63c9fd..7b2c6a1 100644 --- a/test/localized_language_select_test.rb +++ b/test/localized_language_select_test.rb @@ -1,109 +1,111 @@ # -*- coding: utf-8 -*- require 'test/unit' require 'rubygems' require 'active_support' require 'action_controller' # require 'action_controller/test_process' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/tag_helper' require 'i18n' require 'localized_language_select' class LocalizedLanguageSelectTest < Test::Unit::TestCase include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::TagHelper def test_action_view_should_include_helper_for_object assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select') assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select') end def test_action_view_should_include_helper_tag assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag') end def test_should_return_select_tag_with_proper_name_for_object assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')), "Should have proper name for object" end def test_should_return_select_tag_with_proper_name assert localized_language_select_tag( "competition_submission[data][language]", nil) =~ Regexp.new( Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ), "Should have proper name" end def test_should_return_option_tags assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>')) end def test_should_return_localized_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>')) end def test_should_return_localized_country_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es-ES">espagnol ibérique</option>')) end def test_should_return_priority_languages_first - assert localized_language_options_for_select(nil, [:es, :fr, :"nl-BE"]) =~ Regexp.new( - Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option>\n<option value=\"nl-BE\">Flemish</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) + # Once with symbols, and once with strings + [ [ :es, :fr, :"nl-BE" ], [ "es", "fr", "nl-BE" ] ].each do |langs| + assert localized_language_options_for_select(nil, langs) =~ Regexp.new( + Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option>\n<option value=\"nl-BE\">Flemish</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) + end end def test_i18n_should_know_about_languages assert_equal 'Spanish', I18n.t('es', :scope => 'languages') I18n.locale = 'fr' assert_equal 'espagnol', I18n.t('es', :scope => 'languages') end def test_localized_languages_array_returns_correctly assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() } I18n.locale = 'en' assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'Abkhazian', LocalizedLanguageSelect::localized_languages_array.first[0] I18n.locale = 'fr' assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'abkhaze', LocalizedLanguageSelect::localized_languages_array.first[0] end def test_priority_languages_returns_correctly_and_in_correct_order assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) } I18n.locale = 'en' assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) end def test_include_country_rejects_on_except_option assert !LocalizedLanguageSelect::include_language?('af', :except => ['af']) assert LocalizedLanguageSelect::include_language?('ad', :except => ['af']) end def test_include_country_accept_on_only_option assert LocalizedLanguageSelect::include_language?('af', :only => ['af']) assert !LocalizedLanguageSelect::include_language?('af', :only => ['ad']) end def test_localized_countries_array_rejects_on_except_option list = LocalizedLanguageSelect::localized_languages_array(:except => ['af']) assert !list.include?(['Afrikaans', 'af']) end - # private def setup ['fr', 'en'].each do |locale| # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :) I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.{rb,yml}") ] end I18n.locale = 'en' end end
davec/localized_language_select
253d2cc67698bb9a0a0e569725b9ec3bb7fdbffe
Don't downcase language code for priority languages
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index 74ac31a..e9a017b 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,117 +1,117 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # # require 'localized_language_select/i18n' module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| res << [value, key.to_s] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) - language_codes.map { |code| [languages[code], code.to_s.downcase] } + language_codes.map { |code| [languages[code], code.to_s] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/test/localized_language_select_test.rb b/test/localized_language_select_test.rb index 4b3be41..b63c9fd 100644 --- a/test/localized_language_select_test.rb +++ b/test/localized_language_select_test.rb @@ -1,109 +1,109 @@ # -*- coding: utf-8 -*- require 'test/unit' require 'rubygems' require 'active_support' require 'action_controller' # require 'action_controller/test_process' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/tag_helper' require 'i18n' require 'localized_language_select' class LocalizedLanguageSelectTest < Test::Unit::TestCase include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::TagHelper def test_action_view_should_include_helper_for_object assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select') assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select') end def test_action_view_should_include_helper_tag assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag') end def test_should_return_select_tag_with_proper_name_for_object assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')), "Should have proper name for object" end def test_should_return_select_tag_with_proper_name assert localized_language_select_tag( "competition_submission[data][language]", nil) =~ Regexp.new( Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ), "Should have proper name" end def test_should_return_option_tags assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>')) end def test_should_return_localized_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>')) end def test_should_return_localized_country_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es-ES">espagnol ibérique</option>')) end def test_should_return_priority_languages_first - assert localized_language_options_for_select(nil, [:es, :fr]) =~ Regexp.new( - Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) + assert localized_language_options_for_select(nil, [:es, :fr, :"nl-BE"]) =~ Regexp.new( + Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option>\n<option value=\"nl-BE\">Flemish</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) end def test_i18n_should_know_about_languages assert_equal 'Spanish', I18n.t('es', :scope => 'languages') I18n.locale = 'fr' assert_equal 'espagnol', I18n.t('es', :scope => 'languages') end def test_localized_languages_array_returns_correctly assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() } I18n.locale = 'en' assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'Abkhazian', LocalizedLanguageSelect::localized_languages_array.first[0] I18n.locale = 'fr' assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'abkhaze', LocalizedLanguageSelect::localized_languages_array.first[0] end def test_priority_languages_returns_correctly_and_in_correct_order assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) } I18n.locale = 'en' assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) end def test_include_country_rejects_on_except_option assert !LocalizedLanguageSelect::include_language?('af', :except => ['af']) assert LocalizedLanguageSelect::include_language?('ad', :except => ['af']) end def test_include_country_accept_on_only_option assert LocalizedLanguageSelect::include_language?('af', :only => ['af']) assert !LocalizedLanguageSelect::include_language?('af', :only => ['ad']) end def test_localized_countries_array_rejects_on_except_option list = LocalizedLanguageSelect::localized_languages_array(:except => ['af']) assert !list.include?(['Afrikaans', 'af']) end # private def setup ['fr', 'en'].each do |locale| # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :) I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.{rb,yml}") ] end I18n.locale = 'en' end end
davec/localized_language_select
303345685f9f02eb77b42cf27fdc6287dd556f6c
Don't upcase language tags. Closes #5
diff --git a/Gemfile b/Gemfile index eb41536..60810d0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,15 @@ source "http://rubygems.org" # Add dependencies required to use your gem here. # Example: # gem "activesupport", ">= 2.3.5" gem "rails", ">= 2.3.5" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do - gem "rspec", ">= 2.3.0" gem "bundler", "~> 1.0.0" gem "jeweler", "~> 1.5.2" - gem "rcov", ">= 0" + # gem "rspec", ">= 2.3.0" + # gem "rcov", ">= 0" end diff --git a/Gemfile.lock b/Gemfile.lock index 60b7adf..d0b142e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,90 +1,78 @@ GEM remote: http://rubygems.org/ specs: abstract (1.0.0) - actionmailer (3.0.3) - actionpack (= 3.0.3) - mail (~> 2.2.9) - actionpack (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) + actionmailer (3.0.6) + actionpack (= 3.0.6) + mail (~> 2.2.15) + actionpack (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) builder (~> 2.1.2) erubis (~> 2.6.6) - i18n (~> 0.4) + i18n (~> 0.5.0) rack (~> 1.2.1) - rack-mount (~> 0.6.13) - rack-test (~> 0.5.6) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) tzinfo (~> 0.3.23) - activemodel (3.0.3) - activesupport (= 3.0.3) + activemodel (3.0.6) + activesupport (= 3.0.6) builder (~> 2.1.2) - i18n (~> 0.4) - activerecord (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) + i18n (~> 0.5.0) + activerecord (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) arel (~> 2.0.2) tzinfo (~> 0.3.23) - activeresource (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) - activesupport (3.0.3) - arel (2.0.6) + activeresource (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + activesupport (3.0.6) + arel (2.0.9) builder (2.1.2) - diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) git (1.2.5) i18n (0.5.0) jeweler (1.5.2) bundler (~> 1.0.0) git (>= 1.2.5) rake - mail (2.2.14) + mail (2.2.15) activesupport (>= 2.3.6) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) polyglot (0.3.1) - rack (1.2.1) - rack-mount (0.6.13) + rack (1.2.2) + rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) rack (>= 1.0) - rails (3.0.3) - actionmailer (= 3.0.3) - actionpack (= 3.0.3) - activerecord (= 3.0.3) - activeresource (= 3.0.3) - activesupport (= 3.0.3) + rails (3.0.6) + actionmailer (= 3.0.6) + actionpack (= 3.0.6) + activerecord (= 3.0.6) + activeresource (= 3.0.6) + activesupport (= 3.0.6) bundler (~> 1.0) - railties (= 3.0.3) - railties (3.0.3) - actionpack (= 3.0.3) - activesupport (= 3.0.3) + railties (= 3.0.6) + railties (3.0.6) + actionpack (= 3.0.6) + activesupport (= 3.0.6) rake (>= 0.8.7) thor (~> 0.14.4) rake (0.8.7) - rcov (0.9.9) - rspec (2.4.0) - rspec-core (~> 2.4.0) - rspec-expectations (~> 2.4.0) - rspec-mocks (~> 2.4.0) - rspec-core (2.4.0) - rspec-expectations (2.4.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.4.0) thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) - tzinfo (0.3.23) + tzinfo (0.3.26) PLATFORMS ruby DEPENDENCIES bundler (~> 1.0.0) jeweler (~> 1.5.2) rails (>= 2.3.5) - rcov - rspec (>= 2.3.0) diff --git a/Rakefile b/Rakefile index b32c382..0b96622 100644 --- a/Rakefile +++ b/Rakefile @@ -1,50 +1,60 @@ require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options gem.name = "localized_language_select" gem.homepage = "http://github.com/kristianmandrup/localized_language_select" gem.license = "MIT" gem.summary = %Q{Localized language select for Rails 2.3+} gem.description = %Q{Localized language select for Rails 2.3+ with options to control languages to display} gem.email = "[email protected]" gem.authors = ["Kristian Mandrup"] # Include your dependencies below. Runtime dependencies are required when using your gem, # and development dependencies are only needed for development (ie running rake tasks, tests, etc) gem.add_runtime_dependency 'rails', '>= 2.3.5' end Jeweler::RubygemsDotOrgTasks.new -require 'rspec/core' -require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList['spec/**/*_spec.rb'] -end +require 'rake/testtask' -RSpec::Core::RakeTask.new(:rcov) do |spec| - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true +Rake::TestTask.new(:test) do |t| + t.libs += ['test'] + t.pattern = 'test/**/*_test.rb' + t.verbose = false end -task :default => :spec +task :default => :test + +# require 'rspec/core' +# require 'rspec/core/rake_task' +# RSpec::Core::RakeTask.new(:spec) do |spec| +# spec.pattern = FileList['spec/**/*_spec.rb'] +# end + +# RSpec::Core::RakeTask.new(:rcov) do |spec| +# spec.pattern = 'spec/**/*_spec.rb' +# spec.rcov = true +# end + +# task :default => :spec require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" rdoc.rdoc_dir = 'rdoc' rdoc.title = "localized_language_select #{version}" rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') -end \ No newline at end of file +end diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index bc4c263..74ac31a 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,117 +1,117 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # # require 'localized_language_select/i18n' module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| - res << [value, key.to_s.upcase] if include_language?(key.to_s, options) + res << [value, key.to_s] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/test/localized_language_select_test.rb b/test/localized_language_select_test.rb index b820851..4b3be41 100644 --- a/test/localized_language_select_test.rb +++ b/test/localized_language_select_test.rb @@ -1,113 +1,109 @@ # -*- coding: utf-8 -*- require 'test/unit' require 'rubygems' require 'active_support' require 'action_controller' # require 'action_controller/test_process' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/tag_helper' require 'i18n' require 'localized_language_select' class LocalizedLanguageSelectTest < Test::Unit::TestCase include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::TagHelper def test_action_view_should_include_helper_for_object assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select') assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select') end def test_action_view_should_include_helper_tag assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag') end def test_should_return_select_tag_with_proper_name_for_object assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')), "Should have proper name for object" end def test_should_return_select_tag_with_proper_name assert localized_language_select_tag( "competition_submission[data][language]", nil) =~ Regexp.new( Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ), "Should have proper name" end def test_should_return_option_tags assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>')) end def test_should_return_localized_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>')) end def test_should_return_localized_country_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es-ES">espagnol ibérique</option>')) end def test_should_return_priority_languages_first assert localized_language_options_for_select(nil, [:es, :fr]) =~ Regexp.new( Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) end def test_i18n_should_know_about_languages assert_equal 'Spanish', I18n.t('es', :scope => 'languages') I18n.locale = 'fr' assert_equal 'espagnol', I18n.t('es', :scope => 'languages') end def test_localized_languages_array_returns_correctly assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() } I18n.locale = 'en' assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'Abkhazian', LocalizedLanguageSelect::localized_languages_array.first[0] I18n.locale = 'fr' assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'abkhaze', LocalizedLanguageSelect::localized_languages_array.first[0] end def test_priority_languages_returns_correctly_and_in_correct_order assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) } I18n.locale = 'en' assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) end def test_include_country_rejects_on_except_option - res = !LocalizedLanguageSelect::include_language?('af', except: ['af']) - puts "should not include_language? '' except af : #{res}" + assert !LocalizedLanguageSelect::include_language?('af', :except => ['af']) + assert LocalizedLanguageSelect::include_language?('ad', :except => ['af']) end def test_include_country_accept_on_only_option - res = LocalizedLanguageSelect::include_language?('af', only: ['af']) - puts "should include_language? 'af' : #{res}" - - res = !LocalizedLanguageSelect::include_language?('af', only: ['ad']) - puts "should not include_language? 'af' : #{res}" + assert LocalizedLanguageSelect::include_language?('af', :only => ['af']) + assert !LocalizedLanguageSelect::include_language?('af', :only => ['ad']) end def test_localized_countries_array_rejects_on_except_option list = LocalizedLanguageSelect::localized_languages_array(:except => ['af']) - res = !list.include?(['Afrikaans', 'af']) - puts "rejected 'af' from array? #{res}" + assert !list.include?(['Afrikaans', 'af']) end # private def setup ['fr', 'en'].each do |locale| # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :) - I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ] + I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.{rb,yml}") ] end I18n.locale = 'en' end end
davec/localized_language_select
d0a9345fa5d805e06dcec4b3d0372207053a4340
Danish code is da, not en
diff --git a/locale/da.yml b/locale/da.yml index 25a8069..2163bc9 100644 --- a/locale/da.yml +++ b/locale/da.yml @@ -1,508 +1,508 @@ # TODO !!! -en: +da: languages: ab: "Abkhaziansk" ace: "Achinesisk" ach: "Acoli" ada: "Adangme" ady: "Adyghe" ae: "Avestan" af: "Afrikaan" afa: "Afro-Asiatisk Sprog" afh: "Afrihili" ain: "Ainu" ak: "Akan" akk: "Akkadiansk" ale: "Aleut" alg: "Algonquian Sprog" alt: "Syd Altai" am: "Amharisk" an: "Aragonese" ang: "Gammelt Engelsk" anp: "Angika" apa: "Apache Sprog" ar: "Arabisk" arc: "Aramaic" arn: "Araucanian" arp: "Arapaho" art: "Kunstigt Sprog" arw: "Arawak" as: "Assamesisk" ast: "Asturiansk" ath: "Athapascan Sprog" aus: "Australian Sprog" av: "Avaric" awa: "Awadhi" ay: "Aymara" az: "Azerbaijani" ba: "Bashkir" bad: "Banda" bai: "Bamileke Sprog" bal: "Baluchi" ban: "Balinesisk" bas: "Basa" bat: "Baltisk Sprog" be: "Hvide Russisk" bej: "Beja" bem: "Bemba" ber: "Berber" bg: "Bulgarsk" bh: "Bihari" bho: "Bhojpuri" bi: "Bislama" bik: "Bikol" bin: "Bini" bla: "Siksika" bm: "Bambara" bn: "Bengali" bnt: "Bantu" bo: "Tibetansk" br: "Breton" bra: "Braj" bs: "Bosnisk" btk: "Batak" bua: "Buriat" bug: "Buginesisk" byn: "Blin" ca: "Katalansk" cad: "Caddo" cai: "Central Amerikansk Indiansk Sprog" car: "Karibisk" cau: "Kaukasisk Sprog" cch: "Atsam" ce: "Chechen" ceb: "Cebuano" cel: "Keltisk Sprog" ch: "Chamorro" chb: "Chibcha" chg: "Chagatai" chk: "Chuukese" chm: "Mari" chn: "Chinook Jargon" cho: "Choctaw" chp: "Chipewyan" chr: "Cherokee" chy: "Cheyenne" cmc: "Chamisk Sprog" co: "Korsikansk" cop: "Coptic" cpe: "Engelsk-baseret Kreolsk eller Pidgin" cpf: "Fransk-baseret Kreolsk eller Pidgin" cpp: "Portugisisk-baseret Kreolsk eller Pidgin" cr: "Cree" crh: "Crimean Tyrkisk" crp: "Kreolsk eller Pidgin" cs: "Tjekkisk" csb: "Kashubian" cu: "Church Slavisk" cus: "Cushitisk Sprog" cv: "Chuvash" cy: "Walisisk" da: "Dansk" dak: "Dakota" dar: "Dargwa" day: "Dayak" de: "Tysk" "de-AT": "Østrisk Tysk" "de-CH": "Schweizisk Høj Tysk" del: "Delaware" den: "Slave" dgr: "Dogrib" din: "Dinka" doi: "Dogri" dra: "Dravidian Sprog" dsb: "Nedre Sorbiansk" dua: "Duala" dum: "Mellem Hollandsk" dv: "Divehi" dyu: "Dyula" dz: "Dzongkha" ee: "Ewe" efi: "Efik" egy: "Gammelt Egyptisk" eka: "Ekajuk" el: "Græsk" elx: "Elamite" en: "Engelsk" en-AU: "Australsk Engelsk" en-CA: "Canada Engelsk" en-GB: "British Engelsk" en-US: "Amerikansk Engelsk" enm: "Middle Engelsk" eo: "Esperanto" es: "Spansk" es-ES: "Iberisk Spansk" et: "Estisk" eu: "Basque" ewo: "Ewondo" fa: "Persisk" fan: "Fang" fat: "Fanti" ff: "Fulah" fi: "Finsk" fil: "Filipinsk" fiu: "Finsk-Ugrian Sprog" fj: "Fiji" fo: "Færøsk" fon: "Fon" fr: "Fransk" fr-CA: "Canadisk Fransk" fr-CH: "Schweitzer Fransk" frm: "Mellem Fransk" fro: "Gammelt Fransk" frr: "Northern Frisian" frs: "Eastern Frisian" fur: "Friulian" fy: "Vest Frisisk" ga: "Irsk" gaa: "Ga" gay: "Gayo" gba: "Gbaya" gd: "Scottisk Gaelic" gem: "Tyskic Sprog" gez: "Geez" gil: "Gilbertesisk" gl: "Galicisk" gmh: "Middle High Tysk" gn: "Guarani" goh: "Gammelt Høj Tysk" gon: "Gondi" gor: "Gorontalo" got: "Gotisk" grb: "Grebo" grc: "Gammelt Græsk" gsw: "Swiss Tysk" gu: "Gujarati" gv: "Manx" gwi: "Gwichʼin" ha: "Hausa" hai: "Haida" haw: "Hawaii" he: "Hebræisk" hi: "Hindi" hil: "Hiligaynon" him: "Himachali" hit: "Hittite" hmn: "Hmong" ho: "Hiri Motu" hr: "Kroatisk" hsb: "Øvre Sorbiansk" ht: "Haitiansk" hu: "Ungarsk" hup: "Hupa" hy: "Armensk" hz: "Herero" ia: "Interlingua" iba: "Iban" id: "Indonesisk" ie: "Interlingue" ig: "Igbo" ii: "Sichuan Yi" ijo: "Ijo" ik: "Inupiaq" ilo: "Iloko" inc: "Indisk Sprog" ine: "Indo-Europæisk Sprog" inh: "Ingush" io: "Ido" ira: "Iransk Sprog" iro: "Iroquoisk Sprog" is: "Icelandic" it: "Italian" iu: "Inuktitut" ja: "Japanese" jbo: "Lojban" jpr: "Judeo-Persisk" jrb: "Judeo-Arabisk" jv: "Javanesisk" ka: "Georgisk" kaa: "Kara-Kalpak" kab: "Kabyle" kac: "Kachin" kaj: "Jju" kam: "Kamba" kar: "Karen" kaw: "Kawi" kbd: "Kabardian" kcg: "Tyap" kfo: "Koro" kg: "Kongo" kha: "Khasi" khi: "Khoisan Sprog" kho: "Khotanesisk" ki: "Kikuyu" kj: "Kuanyama" kk: "Kazakh" kl: "Kalaallisut" km: "Khmer" kmb: "Kimbundu" kn: "Kannada" ko: "Koreansk" kok: "Konkani" kos: "Kosraean" kpe: "Kpelle" kr: "Kanuri" krc: "Karachay-Balkar" krl: "Karelian" kro: "Kru" kru: "Kurukh" ks: "Kashmiri" ku: "Kurdisk" kum: "Kumyk" kut: "Kutenai" kv: "Komi" kw: "Cornish" ky: "Kirghiz" la: "Latinsk" lad: "Ladino" lah: "Lahnda" lam: "Lamba" lb: "Luxemborgsk" lez: "Lezghisisk" lg: "Ganda" li: "Limburgisk" ln: "Lingala" lo: "Lao" lol: "Mongo" loz: "Lozi" lt: "Litauisk" lu: "Luba-Katanga" lua: "Luba-Lulua" lui: "Luiseno" lun: "Lunda" luo: "Luo" lus: "Lushai" lv: "Letisk" mad: "Madurese" mag: "Magahi" mai: "Maithili" mak: "Makasar" man: "Mandingo" map: "Austronesiansk Sprog" mas: "Masai" mdf: "Moksha" mdr: "Mandar" men: "Mende" mg: "Malagasy" mga: "Mellem Irsk" mh: "Marshallesisk" mi: "Maori" mic: "Micmac" min: "Minangkabau" mis: "Diverse Sprog" mk: "Makedoniansk" mkh: "Mon-Khmer Sprog" ml: "Malayalam" mn: "Mongolian" mnc: "Manchu" mni: "Manipuri" mno: "Manobo Sprog" mo: "Moldaviansk" moh: "Mohawk" mos: "Mossi" mr: "Marathi" ms: "Malaysisk" mt: "Maltesisk" mul: "Flere Sprogs" mun: "Munda Sprog" mus: "Creek" mwl: "Mirandese" mwr: "Marwari" my: "Burmese" myn: "Mayan Sprog" myv: "Erzya" na: "Nauru" nah: "Nahuatl" nai: "Nord Amerikansk Indiansk Sprog" nap: "Neapolitan" nb: "Norsk Bokmål" nd: "Nord Ndebele" nds: "Neder Tysk" ne: "Nepalesisk" new: "Newari" ng: "Ndonga" nia: "Nias" nic: "Niger-Kordofaniansk Sprog" niu: "Niuean" nl: "Hollandsk" nl-BE: "Flamsk" nn: "Norsk Nynorsk" no: "Norsk" nog: "Nogai" non: "Gammelt Norse" nqo: "N’Ko" nr: "Syd Ndebele" nso: "Nordisk Sotho" nub: "Nubiansk Sprog" nv: "Navajo" nwc: "Klassisk Newari" ny: "Nyanja" nym: "Nyamwezi" nyn: "Nyankole" nyo: "Nyoro" nzi: "Nzima" oc: "Occitan" oj: "Ojibwa" om: "Oromo" or: "Oriya" os: "Ossetisk" osa: "Osage" ota: "Ottoman Turkish" oto: "Otomansk Sprog" pa: "Punjabi" paa: "Papuan Sprog" pag: "Pangasinan" pal: "Pahlavi" pam: "Pampanga" pap: "Papiamento" pau: "Palauan" peo: "Gammelt Persisk" phi: "Philippisk Sprog" phn: "Phoeniciansk" pi: "Pali" pl: "Polsk" pon: "Pohnpeian" pra: "Prakrit Sprog" pro: "Gammelt Provençal" ps: "Pashto" pt: "Portugisisk" pt-BR: "Braziliansk Portugisisk" pt-PT: "Iberian Portugisisk" qu: "Quechua" raj: "Rajasthani" rap: "Rapanui" rar: "Rarotongan" rm: "Rhaeto-Romance" rn: "Rundi" ro: "Rumansk" roa: "Romance Sprog" rom: "Romany" ru: "Russisk" rup: "Aromaniansk" rw: "Kinyarwanda" sa: "Sanskrit" sad: "Sandawe" sah: "Yakut" sai: "Syd American Indian Sprog" sal: "Salishan Sprog" sam: "Samaritansk Aramaic" sas: "Sasak" sat: "Santali" sc: "Sardinsk" scn: "Sicilian" sco: "Scots" sd: "Sindhi" se: "Nordisk Sami" sel: "Selkup" sem: "Semitisk Sprog" sg: "Sango" sga: "Gammel Irsk" sgn: "Sign Sprog" sh: "Serbo-Croatian" shn: "Shan" si: "Sinhala" sid: "Sidamo" sio: "Siouan Sprog" sit: "Sino-Tibetansk Sprog" sk: "Slovakisk" sl: "Slovensk" sla: "Slavisk Sprog" sm: "Samoan" sma: "Syd Sami" smi: "Sami Sprog" smj: "Lule Sami" smn: "Inari Sami" sms: "Skolt Sami" sn: "Shona" snk: "Soninke" so: "Somali" sog: "Sogdien" son: "Songhai" sq: "Albansk" sr: "Serbian" srn: "Sranan Tongo" srr: "Serer" ss: "Swati" ssa: "Nil-Sahara Sprog" st: "Syd Sotho" su: "Sundanesisk" suk: "Sukuma" sus: "Susu" sux: "Sumerisk" sv: "Svensk" sw: "Swahili" syc: "Klassisk Syrisk" syr: "Syrisk" ta: "Tamil" tai: "Tai Sprog" te: "Telugu" tem: "Timne" ter: "Tereno" tet: "Tetum" tg: "Tajik" th: "Thai" ti: "Tigrinya" tig: "Tigre" tiv: "Tiv" tk: "Turkmen" tkl: "Tokelau" tl: "Tagalog" tlh: "Klingon" tli: "Tlingit" tmh: "Tamashek" tn: "Tswana" to: "Tonga" tog: "Nyasa Tonga" tpi: "Tok Pisin" tr: "Tyrkisk" trv: "Taroko" ts: "Tsonga" tsi: "Tsimshian" tt: "Tatar" tum: "Tumbuka" tup: "Tupi Sprog" tut: "Altaic Sprog" tvl: "Tuvalu" tw: "Twi" ty: "Tahitian" tyv: "Tuvinian" udm: "Udmurt" ug: "Uighur" uga: "Ugaritic" uk: "Ukrainsk" umb: "Umbundu" und: "Ukendt eller Invalidt Sprog" ur: "Urdu" uz: "Uzbek" vai: "Vai" ve: "Venda" vi: "Vietnamesisk" vo: "Volapyk" vot: "Votic" wa: "Walloon" wak: "Wakashan Sprog" wal: "Walamo" war: "Waray" was: "Washo" wen: "Sorbian Sprog" wo: "Wolof" xal: "Kalmyk" xh: "Xhosa" yao: "Yao" yap: "Yapese" yi: "Yiddish" yo: "Yoruba" ypk: "Yupik Sprog" za: "Zhuang" zap: "Zapotec" zbl: "Blissymbolsk" zen: "Zenaga" zh: "Kinesisk" zh-Hans: "Simplificeret Kinesisk" zh-Hant: "Traditionelt Kinesisk" znd: "Zande" zu: "Zulu" zun: "Zuni" zxx: "Intet linguistisk indhold" zza: "Zaza"
davec/localized_language_select
eeba2c551770c6c06f4d033d4b63ecc6ac5a468f
Fixed gemspec.
diff --git a/localized_language_select.gemspec b/localized_language_select.gemspec index 945debf..a3052a5 100644 --- a/localized_language_select.gemspec +++ b/localized_language_select.gemspec @@ -1,82 +1,82 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{localized_language_select} s.version = "0.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Kristian Mandrup"] s.date = %q{2011-01-18} s.description = %q{Localized language select for Rails 2.3+ with options to control languages to display} s.email = %q{[email protected]} s.extra_rdoc_files = [ "README.textile" ] s.files = [ "Gemfile", "Gemfile.lock", "MIT-LICENSE", "README.textile", "Rakefile", "VERSION", "init.rb", "install.rb", "lib/generators/localized_language_select/import/content_helper.rb", - "lib/generators/localized_language_select/import/import_generator.rb", + "lib/generators/localized_language_select/import_generator.rb", "lib/generators/localized_language_select/import/parse_helper.rb", - "lib/generators/localized_language_select/locales/locales_generator.rb", + "lib/generators/localized_language_select/locales_generator.rb", "lib/localized_language_select.rb", "lib/localized_language_select/i18n.rb", "lib/tasks/localized_language_select_tasks.rake", "lib/tasks/yaml_locales_tasks.rake", "locale/da.yml", "locale/de.yml", "locale/en.yml", "locale/fr.yml", "locale/nl.yml", "localized_language_select.gemspec", "tasks/localized_language_select_tasks.rake", "test/localized_language_select_test.rb", "uninstall.rb" ] s.homepage = %q{http://github.com/kristianmandrup/localized_language_select} s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} s.summary = %q{Localized language select for Rails 2.3+} s.test_files = [ "test/localized_language_select_test.rb" ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) s.add_development_dependency(%q<rspec>, [">= 2.3.0"]) s.add_development_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_development_dependency(%q<rcov>, [">= 0"]) s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) else s.add_dependency(%q<rails>, [">= 2.3.5"]) s.add_dependency(%q<rspec>, [">= 2.3.0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_dependency(%q<rcov>, [">= 0"]) s.add_dependency(%q<rails>, [">= 2.3.5"]) end else s.add_dependency(%q<rails>, [">= 2.3.5"]) s.add_dependency(%q<rspec>, [">= 2.3.0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_dependency(%q<rcov>, [">= 0"]) s.add_dependency(%q<rails>, [">= 2.3.5"]) end end
davec/localized_language_select
b11d125990d98a539fcc38ba1be2ce68ab2cf737
Small bug fix.
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index 189b3d0..d7453bd 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,141 +1,141 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # # require 'localized_language_select/i18n' module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| res << [value, key.to_s.upcase] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end module Formtastic #:nodoc: class SemanticFormBuilder < ActionView::Helpers::FormBuilder protected def language_input(method, options) html_options = options.delete(:input_html) || {} - priority_languages = options.delete(:priority_languages) || self.priority_languages + priority_languages = options.delete(:priority_languages) || [] field_id = generate_html_id(method, "") html_options[:id] ||= field_id label_options = options_for_label(options) label_options[:for] ||= html_options[:id] label(method, label_options) << localized_language_select(method, priority_languages, strip_formtastic_options(options), html_options) end end end
davec/localized_language_select
5f9eabf414f15b8b175d533fd2e786b4484e3740
Added formtastic helper as advertised in README.
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index bc4c263..189b3d0 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,117 +1,141 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # # require 'localized_language_select/i18n' module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| res << [value, key.to_s.upcase] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end + + +module Formtastic #:nodoc: + + class SemanticFormBuilder < ActionView::Helpers::FormBuilder + + protected + + def language_input(method, options) + html_options = options.delete(:input_html) || {} + priority_languages = options.delete(:priority_languages) || self.priority_languages + + field_id = generate_html_id(method, "") + html_options[:id] ||= field_id + label_options = options_for_label(options) + label_options[:for] ||= html_options[:id] + + label(method, label_options) << + localized_language_select(method, priority_languages, strip_formtastic_options(options), html_options) + end + + end +end +
davec/localized_language_select
4b89020ed7ae44fce56ee8ecb1dac55a5fd3d52e
Corrected german translations.
diff --git a/locale/de.yml b/locale/de.yml index 123c9d1..e528818 100644 --- a/locale/de.yml +++ b/locale/de.yml @@ -1,6 +1,6 @@ de: languages: - de: "Deutch" - fr: "Französish" + de: "Deutsch" + fr: "Französisch" en: "Englisch" - it: "Italienish" + it: "Italienisch"
davec/localized_language_select
cf6c03ec0778f64b0f71099dd8cf3cd74422b7d1
Small bug fixes.
diff --git a/lib/generators/localized_language_select/locales_generator.rb b/lib/generators/localized_language_select/locales_generator.rb index 426a3e8..83c3400 100644 --- a/lib/generators/localized_language_select/locales_generator.rb +++ b/lib/generators/localized_language_select/locales_generator.rb @@ -1,49 +1,49 @@ # require 'rake' module LocalizedLanguageSelect module Generators class LocalesGenerator < Rails::Generators::Base desc "Copy language locale files" class_option :locales, :type => :array, :default => ['all'], :desc => 'locales to generate for' class_option :file_ext, :type => :string, :default => 'rb', :desc => 'file extension for locale files to copy' source_root File.dirname(__FILE__) def main_flow copy_locales end protected def file_ext options[:file_ext] end def locales return Dir.glob("#{locale_dir}/**.#{file_ext}") if options[:locales].include? 'all' options[:locales].map(&:to_sym) end def locale_dir - File.expand_path(locale_ref, File.dirname __FILE__) + File.expand_path(locale_ref, File.dirname(__FILE__)) end def locale_ref "../../../locale" end def locale_name :languages end def copy_locales locales.each do |locale| locale_file = "#{locale}.#{file_ext}" file = File.join(locale_dir, locale_file) - copy_file File.join(locale_ref, locale_file), "config/locales/#{locale_name}.#{locale}.#{file_ext}" if file.exist? + copy_file File.join(locale_ref, locale_file), "config/locales/#{locale_name}.#{locale}.#{file_ext}" if File.exist?(file) end end end end end
davec/localized_language_select
86401eb8f99552dd5b4ef7d9e265518d376c4882
removed tabs from output
diff --git a/lib/generators/localized_language_select/import/content_helper.rb b/lib/generators/localized_language_select/import/content_helper.rb index baf7477..9236ef7 100644 --- a/lib/generators/localized_language_select/import/content_helper.rb +++ b/lib/generators/localized_language_select/import/content_helper.rb @@ -1,41 +1,41 @@ module Import module ContentHelper def languages_yaml_content languages.inject([]) do |output, language| - output << "\t\t#{language[:code]}: \"#{language[:name]}\"" + output << " #{language[:code]}: \"#{language[:name]}\"" output end.join("\n") end def languages_hash_content languages.inject([]) do |output, language| - output << "\t\t:#{language[:code]} => \"#{language[:name]}\"," + output << " :#{language[:code]} => \"#{language[:name]}\"," output end.join("\n") end def get_output send :"#{file_ext}_output" end def yaml_output %Q{#{locale}: -\tlanguages: + languages: #{languages_yaml_content} } end alias_method :yml_output, :yaml_output def hash_output output = <<HASH { -\t:#{lang} => { -\t\t:languages => { + :#{lang} => { + :languages => { #{languages_hash_content} -\t\t\t} -\t} + } + } } HASH end end end
davec/localized_language_select
3ccb12ab87e88a74078ba36373990de889a36f27
added Rails 3 generator
diff --git a/README.textile b/README.textile index 53ade93..8a23516 100644 --- a/README.textile +++ b/README.textile @@ -1,111 +1,121 @@ h1. LocalizedLanguageSelect Rails plugin to provide support for localized <tt><select></tt> menu with language names and for storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database. Uses the Rails internationalization framework ("I18n":http://rails-i18n.org) for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value. You can easily translate language codes in your application like this: <pre> <%= I18n.t @user.language, :scope => 'languages' %> </pre> -h2. Locale file generation +h2. Generating language locale files + +The project comes with both rake tasks and a generator to generate and import locale files for languages: + +h3. Rails 3 generator + +The project now comes with a Rails 3 generator to import locale files and place them in config/locales in your Rails 3 app. + +@rails g localized_language_select:import de ru --file-ext yml@ + +h3. Rake import tasks The following Rake tasks can be used for importing language names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) * <tt>rake import:language_select locale=de</tt> * <tt>rake yaml_locales:language_select locale=de</tt> The _import_ one generates ruby files, the _yaml_locales_ task generates yml files. Don't forget to restart the application when you add new locale. The code borrows heavily from the LocalizedCountrySelect plugin - "localized_country_select":http://github.com/karmi/localized_country_select h2. Install & Usage Install as plugin: <pre>$ rails plugin install https://github.com/kristianmandrup/localized_language_select.git</pre> Install as gem: Insert in Gemfile <pre>gem 'localized_language_select'</pre> Then to instal it, run: <pre>$ bundle install</pre> Then to install the locale files, run: <pre>$ rails g localized_language_select:locales</pre> This will copy the locale files to your Rails config/locales dir. The files will be called 'language.en.yml' and so on... Note: you can specify which locales using the @--locales@ option, which takes a list of locales. <pre>$ rails g localized_language_select:locales --locales da en fr</pre> h2. Usage example <pre> <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %> </pre> will become: <pre> <select name="user[language]" id="user_language"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="aa">Afar</option> ... <option value="zza">ZaZa</option> </select> </pre> for the <tt>en</tt> locale. h2. Options @:exclude@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :exclude => ['Afrikaans']) %> </pre> @:only@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> </pre> h2. Important! Add translations for your language requirements using the rake tasks supplied, then use the generator to copy them into the Rails locales folder. h2. Framework usage This plugin should also integrate nicely with various formbuilders, including Formtastic Formtastic example: <pre> <%= semantic_form_for @user do |form| %> ... <%= form.input :lang, :as => :language, :priority_languages => ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> ... <% end %> </pre> h2. Copyright Copyright (c) 2009 David Cato, released under the MIT license diff --git a/lib/generators/localized_language_select/import/content_helper.rb b/lib/generators/localized_language_select/import/content_helper.rb new file mode 100644 index 0000000..baf7477 --- /dev/null +++ b/lib/generators/localized_language_select/import/content_helper.rb @@ -0,0 +1,41 @@ +module Import + module ContentHelper + def languages_yaml_content + languages.inject([]) do |output, language| + output << "\t\t#{language[:code]}: \"#{language[:name]}\"" + output + end.join("\n") + end + + def languages_hash_content + languages.inject([]) do |output, language| + output << "\t\t:#{language[:code]} => \"#{language[:name]}\"," + output + end.join("\n") + end + + def get_output + send :"#{file_ext}_output" + end + + def yaml_output + %Q{#{locale}: +\tlanguages: +#{languages_yaml_content} +} + end + alias_method :yml_output, :yaml_output + + def hash_output + output = <<HASH +{ +\t:#{lang} => { +\t\t:languages => { +#{languages_hash_content} +\t\t\t} +\t} +} +HASH + end + end +end diff --git a/lib/generators/localized_language_select/import/import_generator.rb b/lib/generators/localized_language_select/import/import_generator.rb index cc94e88..3f23762 100644 --- a/lib/generators/localized_language_select/import/import_generator.rb +++ b/lib/generators/localized_language_select/import/import_generator.rb @@ -1,151 +1,96 @@ +require 'generators/localized_language_select/import/parse_helper' +require 'generators/localized_language_select/import/content_helper' + module LocalizedLanguageSelect module Generators class ImportGenerator < Rails::Generators::Base desc "Import language locale files" argument :locales, :type => :array, :default => [], :desc => 'locales to generate for' class_option :file_ext, :type => :string, :default => 'yml', :desc => 'file extension for locale files to import' source_root File.dirname(__FILE__) def main_flow raise ArgumentError, "File extension must be yml or rb" if ![:rb, :yml, :yaml].include?(file_ext.to_sym) check_hpricot import_languages end protected - def file_ext - options[:file_ext] - end - - def languages_yaml_content - languages.inject([]) do |output, language| - output << "\t\t\t#{language[:code]}: \"#{language[:name]}\"" - output - end.join("\n") - end + include Import::ParseHelper + include Import::ContentHelper - def languages_hash_content - languages.inject([]) do |output, language| - output << "\t\t\t:#{language[:code]} => \"#{language[:name]}\"," - output - end.join("\n") - end + attr_accessor :languages, :locale, :doc - def get_output lang, file_ext - send :"#{file_ext}_output", lang - end - - def yaml_output lang - %Q{ -#{lang}: - languages: - #{languages_yaml_content} -} - end - - def hash_output - output = <<HASH -{ - :#{lang} => { - :languages => { - #{languages_hash_content} - } - } -} -HASH + def file_ext + options[:file_ext] end - def check_hpricot - begin - require 'hpricot' - rescue LoadError - puts "Error: Hpricot library required to use this task (localized_language_select:import)" - exit - end - end - def import_languages # Check lang variable - locales.each do |lang| - import_language lang - end - end - - def valid_lang? lang - if lang == 'lang' || (/\A[a-z]{2}\z/).match(lang) == nil - puts "\n[!] Usage: rails g localized_language_select:import de ru --file-ext yml\n\n" - exit 0 + locales.each do |locale| + @locale = locale + import_for_locale end end - def import_language lang - valid_lang? lang + def import_for_locale + valid_locale? # ----- Get the CLDR HTML -------------------------------------------------- begin puts "... getting the HTML file for locale '#{locale}'" - doc = Hpricot( open("http://www.unicode.org/cldr/data/charts/summary/#{locale}.html") ) + @doc = Hpricot( open("http://www.unicode.org/cldr/data/charts/summary/#{locale}.html") ) rescue => e puts "[!] Invalid locale name '#{locale}'! Not found in CLDR (#{e})" exit 0 end # require 'ruby-debug' - parse_languages doc + parse_html_file end - def parse_languages doc + def parse_html_file # ----- Parse the HTML with Hpricot ---------------------------------------- puts "... parsing the HTML file" - languages = [] + + @languages = [] doc.search("//tr").each do |row| next if !language_row?(row) languages << { :code => get_code(row).to_sym, :name => get_name(row).to_s } end - generate_language_locales languages + write_locale_file end - def get_code row - row.search("td[@class='g']").inner_text.sub('_','-') - end - - def get_name row - row.search("td[@class='v']").first.inner_text - end - - def language_row? row - row.search("td[@class='n']") && n_row?(row) && g_row?(row) - end - - def n_row? row - row.search("td[@class='n']").inner_html =~ /^nameslanguage$/ - end - - def g_row? row - row.search("td[@class='g']").inner_html =~ /^[a-z]{2,3}(?:_([A-Z][a-z]{3}))?(?:_([A-Z]{2}))?$/ - end - - def generate_language_locales languages - # ----- Prepare the output format ------------------------------------------ - languages.each do |lang| - write_locale_file lang - end - end - - def write_locale_file locale + def write_locale_file # ----- Write the parsed values into file --------------------------------- puts "\n... writing the output" - write_file locale + + filename = File.join(Rails.root, 'config', 'locales', "languages.#{locale}.#{file_ext}") + filename += '.NEW' if File.exists?(filename) # Append 'NEW' if file exists + File.open(filename, 'w+') { |f| f << get_output } + puts "\n---\nWritten values for the '#{locale}' into file: #{filename}\n" # ------------------------------------------------------------------------------ end - - def write_file locale - filename = File.join(File.dirname(__FILE__), '..', 'locale', "languages.#{locale}.rb") - filename += '.NEW' if File.exists?(filename) # Append 'NEW' if file exists - File.open(filename, 'w+') { |f| f << get_output(lang) } + + private + + def valid_locale? + if (/\A[a-z]{2}\z/).match(locale) == nil + puts "\n[!] Usage: rails g localized_language_select:import de ru --file-ext yml\n\n" + exit 0 + end end + + def check_hpricot + begin + require 'hpricot' + rescue LoadError + puts "Error: Hpricot library required to use this task (localized_language_select:import)" + exit + end + end end end end \ No newline at end of file diff --git a/lib/generators/localized_language_select/import/parse_helper.rb b/lib/generators/localized_language_select/import/parse_helper.rb new file mode 100644 index 0000000..30b77e1 --- /dev/null +++ b/lib/generators/localized_language_select/import/parse_helper.rb @@ -0,0 +1,23 @@ +module Import + module ParseHelper + def get_code row + row.search("td[@class='g']").inner_text.sub('_','-') + end + + def get_name row + row.search("td[@class='v']").first.inner_text + end + + def language_row? row + row.search("td[@class='n']") && n_row?(row) && g_row?(row) + end + + def n_row? row + row.search("td[@class='n']").inner_html =~ /^nameslanguage$/ + end + + def g_row? row + row.search("td[@class='g']").inner_html =~ /^[a-z]{2,3}(?:_([A-Z][a-z]{3}))?(?:_([A-Z]{2}))?$/ + end + end +end \ No newline at end of file
davec/localized_language_select
26a280d34aff98975e58af6fba5a40d6b9421181
import locale languages Rails 3 generator
diff --git a/lib/generators/localized_language_select/import/import_generator.rb b/lib/generators/localized_language_select/import/import_generator.rb new file mode 100644 index 0000000..cc94e88 --- /dev/null +++ b/lib/generators/localized_language_select/import/import_generator.rb @@ -0,0 +1,151 @@ +module LocalizedLanguageSelect + module Generators + class ImportGenerator < Rails::Generators::Base + desc "Import language locale files" + + argument :locales, :type => :array, :default => [], :desc => 'locales to generate for' + class_option :file_ext, :type => :string, :default => 'yml', :desc => 'file extension for locale files to import' + + source_root File.dirname(__FILE__) + + def main_flow + raise ArgumentError, "File extension must be yml or rb" if ![:rb, :yml, :yaml].include?(file_ext.to_sym) + check_hpricot + import_languages + end + + protected + + def file_ext + options[:file_ext] + end + + def languages_yaml_content + languages.inject([]) do |output, language| + output << "\t\t\t#{language[:code]}: \"#{language[:name]}\"" + output + end.join("\n") + end + + def languages_hash_content + languages.inject([]) do |output, language| + output << "\t\t\t:#{language[:code]} => \"#{language[:name]}\"," + output + end.join("\n") + end + + def get_output lang, file_ext + send :"#{file_ext}_output", lang + end + + def yaml_output lang + %Q{ +#{lang}: + languages: + #{languages_yaml_content} +} + end + + def hash_output + output = <<HASH +{ + :#{lang} => { + :languages => { + #{languages_hash_content} + } + } +} +HASH + end + + def check_hpricot + begin + require 'hpricot' + rescue LoadError + puts "Error: Hpricot library required to use this task (localized_language_select:import)" + exit + end + end + + def import_languages + # Check lang variable + locales.each do |lang| + import_language lang + end + end + + def valid_lang? lang + if lang == 'lang' || (/\A[a-z]{2}\z/).match(lang) == nil + puts "\n[!] Usage: rails g localized_language_select:import de ru --file-ext yml\n\n" + exit 0 + end + end + + def import_language lang + valid_lang? lang + # ----- Get the CLDR HTML -------------------------------------------------- + begin + puts "... getting the HTML file for locale '#{locale}'" + doc = Hpricot( open("http://www.unicode.org/cldr/data/charts/summary/#{locale}.html") ) + rescue => e + puts "[!] Invalid locale name '#{locale}'! Not found in CLDR (#{e})" + exit 0 + end + # require 'ruby-debug' + parse_languages doc + end + + def parse_languages doc + # ----- Parse the HTML with Hpricot ---------------------------------------- + puts "... parsing the HTML file" + languages = [] + doc.search("//tr").each do |row| + next if !language_row?(row) + languages << { :code => get_code(row).to_sym, :name => get_name(row).to_s } + end + generate_language_locales languages + end + + def get_code row + row.search("td[@class='g']").inner_text.sub('_','-') + end + + def get_name row + row.search("td[@class='v']").first.inner_text + end + + def language_row? row + row.search("td[@class='n']") && n_row?(row) && g_row?(row) + end + + def n_row? row + row.search("td[@class='n']").inner_html =~ /^nameslanguage$/ + end + + def g_row? row + row.search("td[@class='g']").inner_html =~ /^[a-z]{2,3}(?:_([A-Z][a-z]{3}))?(?:_([A-Z]{2}))?$/ + end + + def generate_language_locales languages + # ----- Prepare the output format ------------------------------------------ + languages.each do |lang| + write_locale_file lang + end + end + + def write_locale_file locale + # ----- Write the parsed values into file --------------------------------- + puts "\n... writing the output" + write_file locale + puts "\n---\nWritten values for the '#{locale}' into file: #{filename}\n" + # ------------------------------------------------------------------------------ + end + + def write_file locale + filename = File.join(File.dirname(__FILE__), '..', 'locale', "languages.#{locale}.rb") + filename += '.NEW' if File.exists?(filename) # Append 'NEW' if file exists + File.open(filename, 'w+') { |f| f << get_output(lang) } + end + end + end +end \ No newline at end of file
davec/localized_language_select
59874133a05e13c6721ef10f7258256ddeee2b7d
dont commit Gemfile lock
diff --git a/.gitignore b/.gitignore index 6ff956b..e7f043c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,48 @@ # rcov generated coverage # rdoc generated rdoc # yard generated doc .yardoc # bundler .bundle # jeweler generated pkg pkg/*.gem +Gemfile.lock + # custom sandbox # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: # # * Create a file at ~/.gitignore # * Include files you want ignored # * Run: git config --global core.excludesfile ~/.gitignore # # After doing this, these files will be ignored in all your git projects, # saving you from having to 'pollute' every project you touch with them # # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) # # For MacOS: # .DS_Store # # For TextMate *.tmproj tmtags # # For emacs: #*~ #\#* #.\#* # # For vim: #*.swp
davec/localized_language_select
860ab704b076cc6226b2d762bf8d0ce5efd2fdba
Regenerate gemspec for version 0.2.0
diff --git a/localized_language_select.gemspec b/localized_language_select.gemspec index 7343100..d10b887 100644 --- a/localized_language_select.gemspec +++ b/localized_language_select.gemspec @@ -1,73 +1,77 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{localized_language_select} - s.version = "0.1.0" + s.version = "0.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Kristian Mandrup"] s.date = %q{2011-01-14} s.description = %q{Localized language select for Rails 2.3+ with options to control languages to display} s.email = %q{[email protected]} s.extra_rdoc_files = [ "README.textile" ] s.files = [ "Gemfile", "Gemfile.lock", "MIT-LICENSE", "README.textile", "Rakefile", "VERSION", "init.rb", "install.rb", + "lib/generators/localized_language_select/locales/locales_generator.rb", "lib/localized_language_select.rb", - "locale/en.rb", - "locale/fr.rb", - "locale/nl.rb", - "pkg/localized_language_select-0.1.0.gem", + "lib/localized_language_select/i18n.rb", + "locale/da.yml", + "locale/de.yml", + "locale/en.yml", + "locale/fr.yml", + "locale/nl.yml", + "localized_language_select.gemspec", "tasks/localized_language_select_tasks.rake", "test/localized_language_select_test.rb", "uninstall.rb" ] s.homepage = %q{http://github.com/kristianmandrup/localized_language_select} s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} s.summary = %q{Localized language select for Rails 2.3+} s.test_files = [ "test/localized_language_select_test.rb" ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) s.add_development_dependency(%q<rspec>, [">= 2.3.0"]) s.add_development_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_development_dependency(%q<rcov>, [">= 0"]) s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) else s.add_dependency(%q<rails>, [">= 2.3.5"]) s.add_dependency(%q<rspec>, [">= 2.3.0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_dependency(%q<rcov>, [">= 0"]) s.add_dependency(%q<rails>, [">= 2.3.5"]) end else s.add_dependency(%q<rails>, [">= 2.3.5"]) s.add_dependency(%q<rspec>, [">= 2.3.0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) s.add_dependency(%q<rcov>, [">= 0"]) s.add_dependency(%q<rails>, [">= 2.3.5"]) end end
davec/localized_language_select
b4212d21b112c4cb9d7ec3b09b9cefa7790f230b
bumped version
diff --git a/VERSION b/VERSION index 6c6aa7c..341cf11 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.2.0 \ No newline at end of file
davec/localized_language_select
55a7d7e943839e5f87649b25e04d0f3f123b1bb4
added danish translation and updated README
diff --git a/README.textile b/README.textile index 5e85851..57f4264 100644 --- a/README.textile +++ b/README.textile @@ -1,99 +1,107 @@ h1. LocalizedLanguageSelect Rails plugin to provide support for localized <tt><select></tt> menu with language names and for storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database. Uses the Rails internationalization framework ("I18n":http://rails-i18n.org) for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value. You can easily translate language codes in your application like this: <pre> <%= I18n.t @user.language, :scope => 'languages' %> </pre> Comes with a Rake task <tt>rake import:language_select locale=de</tt> for importing language names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) Don't forget to restart the application when you add new locale. The code borrows heavily from the LocalizedCountrySelect plugin. See "localized_country_select":http://github.com/karmi/localized_country_select h2. Install & Usage Install as plugin: <pre>$ rails plugin install https://github.com/kristianmandrup/localized_language_select.git</pre> Install as gem: Insert in Gemfile <pre>gem 'localized_language_select'</pre> -Then run: +Then to instal it, run: <pre>$ bundle install</pre> -Then run: +Then to install the locale files, run: <pre>$ rails g localized_language_select:locales</pre> -In order to copy locale files to your Rails config/locales dir. Note: you can specify which locales using the @--locales@ option, which takes a list of locales. +This will copy the locale files to your Rails config/locales dir. The files will be called 'language.en.yml' and so on... + +Note: you can specify which locales using the @--locales@ option, which takes a list of locales. <pre>$ rails g localized_language_select:locales --locales da en fr</pre> h2. Usage example <pre> <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %> </pre> will become: <pre> <select name="user[language]" id="user_language"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="aa">Afar</option> ... <option value="zza">ZaZa</option> </select> </pre> for the <tt>en</tt> locale. h2. Options @:exclude@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :exclude => ['Afrikaans']) %> </pre> @:only@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> </pre> +h2. Todo - Request + +Please add translations for your language! + +Would be nice to have at least: German, Spanish, Chinese, Japanese, Russian, Indian and Arabic (Persian?) in there as well... + h2. Framework usage This plugin should also integrate nicely with various formbuilders, including Formtastic Formtastic example: <pre> <%= semantic_form_for @user do |form| %> ... <%= form.input :lang, :as => :language, :priority_languages => ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> ... <% end %> </pre> h2. Copyright Copyright (c) 2009 David Cato, released under the MIT license diff --git a/install.rb b/install.rb index c9f6ab6..94cdc38 100644 --- a/install.rb +++ b/install.rb @@ -1,4 +1,4 @@ # Show the README text file puts "\n\n" -puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +puts IO.read(File.join(File.dirname(__FILE__), 'README.textile')) puts "\n" \ No newline at end of file diff --git a/lib/localized_language_select/i18n.rb b/lib/localized_language_select/i18n.rb index f9ba2e5..0801b71 100644 --- a/lib/localized_language_select/i18n.rb +++ b/lib/localized_language_select/i18n.rb @@ -1,19 +1,21 @@ # encoding: utf-8 +# TODO !!! ("stolen" from Formtastic, but can't seem to make it work... waiting for engines to do this magic OOTB !) + # module LocalizedLanguageSelect # module I18n # DEFAULT_SCOPE = [:languages].freeze # DEFAULT_VALUES = YAML.load_file(File.expand_path("../../../locale/en.yml", __FILE__))["en"]["languages"].freeze # # class << self # def translate(*args) # key = args.shift.to_sym # options = args.extract_options! # options.reverse_merge!(:default => DEFAULT_VALUES[key]) # options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact # ::I18n.translate(key, *(args << options)) # end # alias :t :translate # end # end # end diff --git a/locale/da.yml b/locale/da.yml index 6c66b1c..25a8069 100644 --- a/locale/da.yml +++ b/locale/da.yml @@ -1,508 +1,508 @@ # TODO !!! en: languages: - ab: "Abkhazian" - ace: "Achinese" + ab: "Abkhaziansk" + ace: "Achinesisk" ach: "Acoli" ada: "Adangme" ady: "Adyghe" ae: "Avestan" - af: "Afrikaans" - afa: "Afro-Asiatic Sprog" + af: "Afrikaan" + afa: "Afro-Asiatisk Sprog" afh: "Afrihili" ain: "Ainu" ak: "Akan" - akk: "Akkadian" + akk: "Akkadiansk" ale: "Aleut" alg: "Algonquian Sprog" - alt: "Southern Altai" - am: "Amharic" + alt: "Syd Altai" + am: "Amharisk" an: "Aragonese" ang: "Gammelt Engelsk" anp: "Angika" apa: "Apache Sprog" - ar: "Arabic" + ar: "Arabisk" arc: "Aramaic" arn: "Araucanian" arp: "Arapaho" art: "Kunstigt Sprog" arw: "Arawak" - as: "Assamese" - ast: "Asturian" + as: "Assamesisk" + ast: "Asturiansk" ath: "Athapascan Sprog" aus: "Australian Sprog" av: "Avaric" awa: "Awadhi" ay: "Aymara" az: "Azerbaijani" ba: "Bashkir" bad: "Banda" bai: "Bamileke Sprog" bal: "Baluchi" - ban: "Balinese" + ban: "Balinesisk" bas: "Basa" - bat: "Baltic Sprog" - be: "Belarusian" + bat: "Baltisk Sprog" + be: "Hvide Russisk" bej: "Beja" bem: "Bemba" ber: "Berber" - bg: "Bulgarian" + bg: "Bulgarsk" bh: "Bihari" bho: "Bhojpuri" bi: "Bislama" bik: "Bikol" bin: "Bini" bla: "Siksika" bm: "Bambara" bn: "Bengali" bnt: "Bantu" - bo: "Tibetan" + bo: "Tibetansk" br: "Breton" bra: "Braj" - bs: "Bosnian" + bs: "Bosnisk" btk: "Batak" bua: "Buriat" - bug: "Buginese" + bug: "Buginesisk" byn: "Blin" - ca: "Catalan" + ca: "Katalansk" cad: "Caddo" - cai: "Central American Indian Sprog" - car: "Carib" - cau: "Caucasian Sprog" + cai: "Central Amerikansk Indiansk Sprog" + car: "Karibisk" + cau: "Kaukasisk Sprog" cch: "Atsam" ce: "Chechen" ceb: "Cebuano" - cel: "Celtic Sprog" + cel: "Keltisk Sprog" ch: "Chamorro" chb: "Chibcha" chg: "Chagatai" chk: "Chuukese" chm: "Mari" chn: "Chinook Jargon" cho: "Choctaw" chp: "Chipewyan" chr: "Cherokee" chy: "Cheyenne" - cmc: "Chamic Sprog" - co: "Corsican" + cmc: "Chamisk Sprog" + co: "Korsikansk" cop: "Coptic" - cpe: "English-based Creole or Pidgin" - cpf: "French-based Creole or Pidgin" - cpp: "Portuguese-based Creole or Pidgin" + cpe: "Engelsk-baseret Kreolsk eller Pidgin" + cpf: "Fransk-baseret Kreolsk eller Pidgin" + cpp: "Portugisisk-baseret Kreolsk eller Pidgin" cr: "Cree" - crh: "Crimean Turkish" - crp: "Creole or Pidgin" - cs: "Czech" + crh: "Crimean Tyrkisk" + crp: "Kreolsk eller Pidgin" + cs: "Tjekkisk" csb: "Kashubian" - cu: "Church Slavic" - cus: "Cushitic Sprog" + cu: "Church Slavisk" + cus: "Cushitisk Sprog" cv: "Chuvash" - cy: "Welsh" - da: "Danish" + cy: "Walisisk" + da: "Dansk" dak: "Dakota" dar: "Dargwa" day: "Dayak" - de: "German" - "de-AT": "Austrian German" - "de-CH": "Swiss High German" + de: "Tysk" + "de-AT": "Østrisk Tysk" + "de-CH": "Schweizisk Høj Tysk" del: "Delaware" den: "Slave" dgr: "Dogrib" din: "Dinka" doi: "Dogri" dra: "Dravidian Sprog" - dsb: "Lower Sorbian" + dsb: "Nedre Sorbiansk" dua: "Duala" - dum: "Middle Dutch" + dum: "Mellem Hollandsk" dv: "Divehi" dyu: "Dyula" dz: "Dzongkha" ee: "Ewe" efi: "Efik" - egy: "Ancient Egyptian" + egy: "Gammelt Egyptisk" eka: "Ekajuk" - el: "Greek" + el: "Græsk" elx: "Elamite" - en: "English" - "en-AU": "Australian English" - "en-CA": "Canadian English" - "en-GB": "British English" - "en-US": "U.S. English" - enm: "Middle English" + en: "Engelsk" + en-AU: "Australsk Engelsk" + en-CA: "Canada Engelsk" + en-GB: "British Engelsk" + en-US: "Amerikansk Engelsk" + enm: "Middle Engelsk" eo: "Esperanto" - es: "Spanish" - "es-ES": "Iberian Spanish" - et: "Estonian" + es: "Spansk" + es-ES: "Iberisk Spansk" + et: "Estisk" eu: "Basque" ewo: "Ewondo" - fa: "Persian" + fa: "Persisk" fan: "Fang" fat: "Fanti" ff: "Fulah" - fi: "Finnish" - fil: "Filipino" - fiu: "Finno-Ugrian Sprog" - fj: "Fijian" - fo: "Faroese" + fi: "Finsk" + fil: "Filipinsk" + fiu: "Finsk-Ugrian Sprog" + fj: "Fiji" + fo: "Færøsk" fon: "Fon" - fr: "French" - "fr-CA": "Canadian French" - "fr-CH": "Swiss French" - frm: "Middle French" - fro: "Old French" + fr: "Fransk" + fr-CA: "Canadisk Fransk" + fr-CH: "Schweitzer Fransk" + frm: "Mellem Fransk" + fro: "Gammelt Fransk" frr: "Northern Frisian" frs: "Eastern Frisian" fur: "Friulian" - fy: "Western Frisian" - ga: "Irish" + fy: "Vest Frisisk" + ga: "Irsk" gaa: "Ga" gay: "Gayo" gba: "Gbaya" - gd: "Scottish Gaelic" - gem: "Germanic Sprog" + gd: "Scottisk Gaelic" + gem: "Tyskic Sprog" gez: "Geez" - gil: "Gilbertese" - gl: "Galician" - gmh: "Middle High German" + gil: "Gilbertesisk" + gl: "Galicisk" + gmh: "Middle High Tysk" gn: "Guarani" - goh: "Old High German" + goh: "Gammelt Høj Tysk" gon: "Gondi" gor: "Gorontalo" - got: "Gothic" + got: "Gotisk" grb: "Grebo" - grc: "Ancient Greek" - gsw: "Swiss German" + grc: "Gammelt Græsk" + gsw: "Swiss Tysk" gu: "Gujarati" gv: "Manx" gwi: "Gwichʼin" ha: "Hausa" hai: "Haida" - haw: "Hawaiian" - he: "Hebrew" + haw: "Hawaii" + he: "Hebræisk" hi: "Hindi" hil: "Hiligaynon" him: "Himachali" hit: "Hittite" hmn: "Hmong" ho: "Hiri Motu" - hr: "Croatian" - hsb: "Upper Sorbian" - ht: "Haitian" - hu: "Hungarian" + hr: "Kroatisk" + hsb: "Øvre Sorbiansk" + ht: "Haitiansk" + hu: "Ungarsk" hup: "Hupa" - hy: "Armenian" + hy: "Armensk" hz: "Herero" ia: "Interlingua" iba: "Iban" - id: "Indonesian" + id: "Indonesisk" ie: "Interlingue" ig: "Igbo" ii: "Sichuan Yi" ijo: "Ijo" ik: "Inupiaq" ilo: "Iloko" - inc: "Indic Sprog" - ine: "Indo-European Sprog" + inc: "Indisk Sprog" + ine: "Indo-Europæisk Sprog" inh: "Ingush" io: "Ido" - ira: "Iranian Sprog" - iro: "Iroquoian Sprog" + ira: "Iransk Sprog" + iro: "Iroquoisk Sprog" is: "Icelandic" it: "Italian" iu: "Inuktitut" ja: "Japanese" jbo: "Lojban" - jpr: "Judeo-Persian" - jrb: "Judeo-Arabic" - jv: "Javanese" - ka: "Georgian" + jpr: "Judeo-Persisk" + jrb: "Judeo-Arabisk" + jv: "Javanesisk" + ka: "Georgisk" kaa: "Kara-Kalpak" kab: "Kabyle" kac: "Kachin" kaj: "Jju" kam: "Kamba" kar: "Karen" kaw: "Kawi" kbd: "Kabardian" kcg: "Tyap" kfo: "Koro" kg: "Kongo" kha: "Khasi" khi: "Khoisan Sprog" - kho: "Khotanese" + kho: "Khotanesisk" ki: "Kikuyu" kj: "Kuanyama" kk: "Kazakh" kl: "Kalaallisut" km: "Khmer" kmb: "Kimbundu" kn: "Kannada" - ko: "Korean" + ko: "Koreansk" kok: "Konkani" kos: "Kosraean" kpe: "Kpelle" kr: "Kanuri" krc: "Karachay-Balkar" krl: "Karelian" kro: "Kru" kru: "Kurukh" ks: "Kashmiri" - ku: "Kurdish" + ku: "Kurdisk" kum: "Kumyk" kut: "Kutenai" kv: "Komi" kw: "Cornish" ky: "Kirghiz" - la: "Latin" + la: "Latinsk" lad: "Ladino" lah: "Lahnda" lam: "Lamba" - lb: "Luxembourgish" - lez: "Lezghian" + lb: "Luxemborgsk" + lez: "Lezghisisk" lg: "Ganda" - li: "Limburgish" + li: "Limburgisk" ln: "Lingala" lo: "Lao" lol: "Mongo" loz: "Lozi" - lt: "Lithuanian" + lt: "Litauisk" lu: "Luba-Katanga" lua: "Luba-Lulua" lui: "Luiseno" lun: "Lunda" luo: "Luo" lus: "Lushai" - lv: "Latvian" + lv: "Letisk" mad: "Madurese" mag: "Magahi" mai: "Maithili" mak: "Makasar" man: "Mandingo" - map: "Austronesian Sprog" + map: "Austronesiansk Sprog" mas: "Masai" mdf: "Moksha" mdr: "Mandar" men: "Mende" mg: "Malagasy" - mga: "Middle Irish" - mh: "Marshallese" + mga: "Mellem Irsk" + mh: "Marshallesisk" mi: "Maori" mic: "Micmac" min: "Minangkabau" - mis: "Miscellaneous Sprog" - mk: "Macedonian" + mis: "Diverse Sprog" + mk: "Makedoniansk" mkh: "Mon-Khmer Sprog" ml: "Malayalam" mn: "Mongolian" mnc: "Manchu" mni: "Manipuri" mno: "Manobo Sprog" - mo: "Moldavian" + mo: "Moldaviansk" moh: "Mohawk" mos: "Mossi" mr: "Marathi" - ms: "Malay" - mt: "Maltese" - mul: "Multiple Sprogs" + ms: "Malaysisk" + mt: "Maltesisk" + mul: "Flere Sprogs" mun: "Munda Sprog" mus: "Creek" mwl: "Mirandese" mwr: "Marwari" my: "Burmese" myn: "Mayan Sprog" myv: "Erzya" na: "Nauru" nah: "Nahuatl" - nai: "North American Indian Sprog" + nai: "Nord Amerikansk Indiansk Sprog" nap: "Neapolitan" - nb: "Norwegian Bokmål" - nd: "North Ndebele" - nds: "Low German" - ne: "Nepali" + nb: "Norsk Bokmål" + nd: "Nord Ndebele" + nds: "Neder Tysk" + ne: "Nepalesisk" new: "Newari" ng: "Ndonga" nia: "Nias" - nic: "Niger-Kordofanian Sprog" + nic: "Niger-Kordofaniansk Sprog" niu: "Niuean" - nl: "Dutch" - "nl-BE": "Flemish" - nn: "Norwegian Nynorsk" - no: "Norwegian" + nl: "Hollandsk" + nl-BE: "Flamsk" + nn: "Norsk Nynorsk" + no: "Norsk" nog: "Nogai" - non: "Old Norse" + non: "Gammelt Norse" nqo: "N’Ko" - nr: "South Ndebele" - nso: "Northern Sotho" - nub: "Nubian Sprog" + nr: "Syd Ndebele" + nso: "Nordisk Sotho" + nub: "Nubiansk Sprog" nv: "Navajo" - nwc: "Classical Newari" + nwc: "Klassisk Newari" ny: "Nyanja" nym: "Nyamwezi" nyn: "Nyankole" nyo: "Nyoro" nzi: "Nzima" oc: "Occitan" oj: "Ojibwa" om: "Oromo" or: "Oriya" - os: "Ossetic" + os: "Ossetisk" osa: "Osage" ota: "Ottoman Turkish" - oto: "Otomian Sprog" + oto: "Otomansk Sprog" pa: "Punjabi" paa: "Papuan Sprog" pag: "Pangasinan" pal: "Pahlavi" pam: "Pampanga" pap: "Papiamento" pau: "Palauan" - peo: "Old Persian" - phi: "Philippine Sprog" - phn: "Phoenician" + peo: "Gammelt Persisk" + phi: "Philippisk Sprog" + phn: "Phoeniciansk" pi: "Pali" - pl: "Polish" + pl: "Polsk" pon: "Pohnpeian" pra: "Prakrit Sprog" - pro: "Old Provençal" + pro: "Gammelt Provençal" ps: "Pashto" - pt: "Portuguese" - "pt-BR": "Brazilian Portuguese" - "pt-PT": "Iberian Portuguese" + pt: "Portugisisk" + pt-BR: "Braziliansk Portugisisk" + pt-PT: "Iberian Portugisisk" qu: "Quechua" raj: "Rajasthani" rap: "Rapanui" rar: "Rarotongan" rm: "Rhaeto-Romance" rn: "Rundi" - ro: "Romanian" + ro: "Rumansk" roa: "Romance Sprog" rom: "Romany" - ru: "Russian" - rup: "Aromanian" + ru: "Russisk" + rup: "Aromaniansk" rw: "Kinyarwanda" sa: "Sanskrit" sad: "Sandawe" sah: "Yakut" - sai: "South American Indian Sprog" + sai: "Syd American Indian Sprog" sal: "Salishan Sprog" - sam: "Samaritan Aramaic" + sam: "Samaritansk Aramaic" sas: "Sasak" sat: "Santali" - sc: "Sardinian" + sc: "Sardinsk" scn: "Sicilian" sco: "Scots" sd: "Sindhi" - se: "Northern Sami" + se: "Nordisk Sami" sel: "Selkup" - sem: "Semitic Sprog" + sem: "Semitisk Sprog" sg: "Sango" - sga: "Old Irish" + sga: "Gammel Irsk" sgn: "Sign Sprog" sh: "Serbo-Croatian" shn: "Shan" si: "Sinhala" sid: "Sidamo" sio: "Siouan Sprog" - sit: "Sino-Tibetan Sprog" - sk: "Slovak" - sl: "Slovenian" - sla: "Slavic Sprog" + sit: "Sino-Tibetansk Sprog" + sk: "Slovakisk" + sl: "Slovensk" + sla: "Slavisk Sprog" sm: "Samoan" - sma: "Southern Sami" + sma: "Syd Sami" smi: "Sami Sprog" smj: "Lule Sami" smn: "Inari Sami" sms: "Skolt Sami" sn: "Shona" snk: "Soninke" so: "Somali" sog: "Sogdien" son: "Songhai" - sq: "Albanian" + sq: "Albansk" sr: "Serbian" srn: "Sranan Tongo" srr: "Serer" ss: "Swati" - ssa: "Nilo-Saharan Sprog" - st: "Southern Sotho" - su: "Sundanese" + ssa: "Nil-Sahara Sprog" + st: "Syd Sotho" + su: "Sundanesisk" suk: "Sukuma" sus: "Susu" - sux: "Sumerian" - sv: "Swedish" + sux: "Sumerisk" + sv: "Svensk" sw: "Swahili" - syc: "Classical Syriac" - syr: "Syriac" + syc: "Klassisk Syrisk" + syr: "Syrisk" ta: "Tamil" tai: "Tai Sprog" te: "Telugu" tem: "Timne" ter: "Tereno" tet: "Tetum" tg: "Tajik" th: "Thai" ti: "Tigrinya" tig: "Tigre" tiv: "Tiv" tk: "Turkmen" tkl: "Tokelau" tl: "Tagalog" tlh: "Klingon" tli: "Tlingit" tmh: "Tamashek" tn: "Tswana" to: "Tonga" tog: "Nyasa Tonga" tpi: "Tok Pisin" tr: "Tyrkisk" trv: "Taroko" ts: "Tsonga" tsi: "Tsimshian" tt: "Tatar" tum: "Tumbuka" tup: "Tupi Sprog" tut: "Altaic Sprog" tvl: "Tuvalu" tw: "Twi" ty: "Tahitian" tyv: "Tuvinian" udm: "Udmurt" ug: "Uighur" uga: "Ugaritic" - uk: "Ukrainian" + uk: "Ukrainsk" umb: "Umbundu" und: "Ukendt eller Invalidt Sprog" ur: "Urdu" uz: "Uzbek" vai: "Vai" ve: "Venda" - vi: "Vietnamese" - vo: "Volapük" + vi: "Vietnamesisk" + vo: "Volapyk" vot: "Votic" wa: "Walloon" wak: "Wakashan Sprog" wal: "Walamo" war: "Waray" was: "Washo" wen: "Sorbian Sprog" wo: "Wolof" xal: "Kalmyk" xh: "Xhosa" yao: "Yao" yap: "Yapese" yi: "Yiddish" yo: "Yoruba" ypk: "Yupik Sprog" za: "Zhuang" zap: "Zapotec" - zbl: "Blissymbols" + zbl: "Blissymbolsk" zen: "Zenaga" - zh: "Chinese" - zh-Hans: "Simplified Chinese" - zh-Hant: "Traditional Chinese" + zh: "Kinesisk" + zh-Hans: "Simplificeret Kinesisk" + zh-Hant: "Traditionelt Kinesisk" znd: "Zande" zu: "Zulu" zun: "Zuni" - zxx: "No linguistic content" + zxx: "Intet linguistisk indhold" zza: "Zaza" diff --git a/locale/de.yml b/locale/de.yml new file mode 100644 index 0000000..123c9d1 --- /dev/null +++ b/locale/de.yml @@ -0,0 +1,6 @@ +de: + languages: + de: "Deutch" + fr: "Französish" + en: "Englisch" + it: "Italienish" diff --git a/locale/fr.rb b/locale/fr.rb deleted file mode 100644 index 184fb5d..0000000 --- a/locale/fr.rb +++ /dev/null @@ -1,509 +0,0 @@ -{ - :fr => { - :languages => { - :ab => "abkhaze", - :ace => "aceh", - :ach => "acoli", - :ada => "adangme", - :ady => "adyghéen", - :ae => "avestique", - :af => "afrikaans", - :afa => "langue afro-asiatique", - :afh => "afrihili", - :ain => "aïnou", - :ak => "akan", - :akk => "akkadien", - :ale => "aléoute", - :alg => "langue algonquienne", - :alt => "altaï du Sud", - :am => "amharique", - :an => "aragonais", - :ang => "ancien anglais", - :anp => "angika", - :apa => "langue apache", - :ar => "arabe", - :arc => "araméen", - :arn => "araukan", - :arp => "arapaho", - :art => "langue artificielle", - :arw => "arawak", - :as => "assamais", - :ast => "asturien", - :ath => "langue athapascane", - :aus => "langue australienne", - :av => "avar", - :awa => "awadhi", - :ay => "aymara", - :az => "azéri", - :ba => "bachkir", - :bad => "banda", - :bai => "langue bamilékée", - :bal => "baloutchi", - :ban => "balinais", - :bas => "bassa", - :bat => "langue balte", - :be => "biélorusse", - :bej => "bedja", - :bem => "bemba", - :ber => "berbère", - :bg => "bulgare", - :bh => "bihari", - :bho => "bhojpuri", - :bi => "bichelamar", - :bik => "bikol", - :bin => "bini", - :bla => "siksika", - :bm => "bambara", - :bn => "bengali", - :bnt => "bantou", - :bo => "tibétain", - :br => "breton", - :bra => "braj", - :bs => "bosniaque", - :btk => "batak", - :bua => "bouriate", - :bug => "bugi", - :byn => "blin", - :ca => "catalan", - :cad => "caddo", - :cai => "langue amérindienne centrale", - :car => "caribe", - :cau => "langue caucasienne", - :cch => "atsam", - :ce => "tchétchène", - :ceb => "cebuano", - :cel => "langue celtique", - :ch => "chamorro", - :chb => "chibcha", - :chg => "tchaghataï", - :chk => "chuuk", - :chm => "mari", - :chn => "jargon chinook", - :cho => "choctaw", - :chp => "chipewyan", - :chr => "cherokee", - :chy => "cheyenne", - :cmc => "langue chame", - :co => "corse", - :cop => "copte", - :cpe => "créole ou pidgin anglais", - :cpf => "créole ou pidgin français", - :cpp => "créole ou pidgin portugais", - :cr => "cree", - :crh => "turc de Crimée", - :crp => "créole ou pidgin", - :cs => "tchèque", - :csb => "kachoube", - :cu => "slavon d’église", - :cus => "langue couchitique", - :cv => "tchouvache", - :cy => "gallois", - :da => "danois", - :dak => "dakota", - :dar => "dargwa", - :day => "dayak", - :de => "allemand", - :"de-AT" => "allemand autrichien", - :"de-CH" => "allemand suisse", - :del => "delaware", - :den => "slavey", - :dgr => "dogrib", - :din => "dinka", - :doi => "dogri", - :dra => "langue dravidienne", - :dsb => "bas-sorabe", - :dua => "douala", - :dum => "moyen néerlandais", - :dv => "maldivien", - :dyu => "dioula", - :dz => "dzongkha", - :ee => "éwé", - :efi => "efik", - :egy => "égyptien ancien", - :eka => "ekajuk", - :el => "grec", - :elx => "élamite", - :en => "anglais", - :"en-AU" => "anglais australien", - :"en-CA" => "anglais canadien", - :"en-GB" => "anglais britannique", - :"en-US" => "anglais américain", - :enm => "moyen anglais", - :eo => "espéranto", - :es => "espagnol", - :"es-ES" => "espagnol ibérique", - :et => "estonien", - :eu => "basque", - :ewo => "éwondo", - :fa => "persan", - :fan => "fang", - :fat => "fanti", - :ff => "peul", - :fi => "finnois", - :fil => "filipino", - :fiu => "langue finno-ougrienne", - :fj => "fidjien", - :fo => "féroïen", - :fon => "fon", - :fr => "français", - :"fr-CA" => "français canadien", - :"fr-CH" => "français suisse", - :frm => "moyen français", - :fro => "ancien français", - :frr => "frison du Nord", - :frs => "frison oriental", - :fur => "frioulan", - :fy => "frison", - :ga => "irlandais", - :gaa => "ga", - :gay => "gayo", - :gba => "gbaya", - :gd => "gaélique écossais", - :gem => "langue germanique", - :gez => "guèze", - :gil => "gilbertais", - :gl => "galicien", - :gmh => "moyen haut-allemand", - :gn => "guarani", - :goh => "ancien haut allemand", - :gon => "gondi", - :gor => "gorontalo", - :got => "gotique", - :grb => "grebo", - :grc => "grec ancien", - :gsw => "alémanique", - :gu => "goudjarâtî", - :gv => "manx", - :gwi => "gwichʼin", - :ha => "haoussa", - :hai => "haida", - :haw => "hawaïen", - :he => "hébreu", - :hi => "hindi", - :hil => "hiligaynon", - :him => "himachali", - :hit => "hittite", - :hmn => "hmong", - :ho => "hiri motu", - :hr => "croate", - :hsb => "haut-sorabe", - :ht => "haïtien", - :hu => "hongrois", - :hup => "hupa", - :hy => "arménien", - :hz => "héréro", - :ia => "interlingua", - :iba => "iban", - :id => "indonésien", - :ie => "interlingue", - :ig => "igbo", - :ii => "yi de Sichuan", - :ijo => "ijo", - :ik => "inupiaq", - :ilo => "ilokano", - :inc => "langue indo-aryenne", - :ine => "langue indo-européenne", - :inh => "ingouche", - :io => "ido", - :ira => "langue iranienne", - :iro => "langue iroquoienne", - :is => "islandais", - :it => "italien", - :iu => "inuktitut", - :ja => "japonais", - :jbo => "lojban", - :jpr => "judéo-persan", - :jrb => "judéo-arabe", - :jv => "javanais", - :ka => "géorgien", - :kaa => "karakalpak", - :kab => "kabyle", - :kac => "kachin", - :kaj => "jju", - :kam => "kamba", - :kar => "karen", - :kaw => "kawi", - :kbd => "kabardin", - :kcg => "tyap", - :kfo => "koro", - :kg => "kongo", - :kha => "khasi", - :khi => "langue khoïsan", - :kho => "khotanais", - :ki => "kikuyu", - :kj => "kuanyama", - :kk => "kazakh", - :kl => "groenlandais", - :km => "khmer", - :kmb => "kiMboundou", - :kn => "kannada", - :ko => "coréen", - :kok => "konkani", - :kos => "kusaien", - :kpe => "kpellé", - :kr => "kanouri", - :krc => "karatchaï balkar", - :krl => "carélien", - :kro => "krou", - :kru => "kurukh", - :ks => "kâshmîrî", - :ku => "kurde", - :kum => "koumyk", - :kut => "kutenai", - :kv => "komi", - :kw => "cornique", - :ky => "kirghize", - :la => "latin", - :lad => "ladino", - :lah => "lahnda", - :lam => "lamba", - :lb => "luxembourgeois", - :lez => "lezghien", - :lg => "ganda", - :li => "limbourgeois", - :ln => "lingala", - :lo => "lao", - :lol => "mongo", - :loz => "lozi", - :lt => "lituanien", - :lu => "luba-katanga", - :lua => "luba-lulua", - :lui => "luiseno", - :lun => "lunda", - :luo => "luo", - :lus => "lushai", - :lv => "letton", - :mad => "madurais", - :mag => "magahi", - :mai => "maithili", - :mak => "makassar", - :man => "mandingue", - :map => "malayo-polynésien", - :mas => "masai", - :mdf => "moksa", - :mdr => "mandar", - :men => "mendé", - :mg => "malgache", - :mga => "moyen irlandais", - :mh => "marshall", - :mi => "maori", - :mic => "micmac", - :min => "minangkabau", - :mis => "langue diverse", - :mk => "macédonien", - :mkh => "langue mon-khmère", - :ml => "malayalam", - :mn => "mongol", - :mnc => "mandchou", - :mni => "manipuri", - :mno => "langue manobo", - :mo => "moldave", - :moh => "mohawk", - :mos => "moré", - :mr => "marathe", - :ms => "malais", - :mt => "maltais", - :mul => "multilingue", - :mun => "langue mounda", - :mus => "creek", - :mwl => "mirandais", - :mwr => "marwarî", - :my => "birman", - :myn => "langue maya", - :myv => "erzya", - :na => "nauruan", - :nah => "nahuatl", - :nai => "langue amérindienne du Nord", - :nap => "napolitain", - :nb => "norvégien bokmål", - :nd => "ndébélé du Nord", - :nds => "bas-allemand", - :ne => "népalais", - :new => "newari", - :ng => "ndonga", - :nia => "nias", - :nic => "langue nigéro-congolaise", - :niu => "niué", - :nl => "néerlandais", - :"nl-BE" => "néerlandais belge", - :nn => "norvégien nynorsk", - :no => "norvégien", - :nog => "nogaï", - :non => "vieux norrois", - :nqo => "n’ko", - :nr => "ndébélé du Sud", - :nso => "sotho du Nord", - :nub => "langue nubienne", - :nv => "navaho", - :nwc => "newarî classique", - :ny => "nyanja", - :nym => "nyamwezi", - :nyn => "nyankolé", - :nyo => "nyoro", - :nzi => "nzema", - :oc => "occitan", - :oj => "ojibwa", - :om => "oromo", - :or => "oriya", - :os => "ossète", - :osa => "osage", - :ota => "turc ottoman", - :oto => "langue otomangue", - :pa => "pendjabi", - :paa => "langue papoue", - :pag => "pangasinan", - :pal => "pahlavi", - :pam => "pampangan", - :pap => "papiamento", - :pau => "palau", - :peo => "persan ancien", - :phi => "langue philippine", - :phn => "phénicien", - :pi => "pali", - :pl => "polonais", - :pon => "pohnpei", - :pra => "langues prâkrit", - :pro => "provençal ancien", - :ps => "pachto", - :pt => "portugais", - :"pt-BR" => "portugais brésilien", - :"pt-PT" => "portugais ibérique", - :qu => "langue quechua", - :raj => "rajasthani", - :rap => "rapanui", - :rar => "rarotongien", - :rm => "rhéto-roman", - :rn => "roundi", - :ro => "roumain", - :roa => "langue romane", - :rom => "tzigane", - :ru => "russe", - :rup => "valaque", - :rw => "rwanda", - :sa => "sanskrit", - :sad => "sandawe", - :sah => "iakoute", - :sai => "langue amérindienne du Sud", - :sal => "langue salishenne", - :sam => "araméen samaritain", - :sas => "sasak", - :sat => "santal", - :sc => "sarde", - :scn => "sicilien", - :sco => "écossais", - :sd => "sindhî", - :se => "sami du Nord", - :sel => "selkoupe", - :sem => "langue sémitique", - :sg => "sangho", - :sga => "ancien irlandais", - :sgn => "langue des signes", - :sh => "serbo-croate", - :shn => "shan", - :si => "singhalais", - :sid => "sidamo", - :sio => "langue sioux", - :sit => "langue sino-tibétaine", - :sk => "slovaque", - :sl => "slovène", - :sla => "langue slave", - :sm => "samoan", - :sma => "sami du Sud", - :smi => "langue samie", - :smj => "sami de Lule", - :smn => "sami d’Inari", - :sms => "sami skolt", - :sn => "shona", - :snk => "soninké", - :so => "somali", - :sog => "sogdien", - :son => "songhai", - :sq => "albanais", - :sr => "serbe", - :srn => "sranan tongo", - :srr => "sérère", - :ss => "swati", - :ssa => "langue nilo-saharienne", - :st => "sesotho", - :su => "soundanais", - :suk => "sukuma", - :sus => "soussou", - :sux => "sumérien", - :sv => "suédois", - :sw => "swahili", - :syc => "syriaque classique", - :syr => "syriaque", - :ta => "tamoul", - :tai => "langue taï", - :te => "télougou", - :tem => "temne", - :ter => "tereno", - :tet => "tetum", - :tg => "tadjik", - :th => "thaï", - :ti => "tigrigna", - :tig => "tigré", - :tiv => "tiv", - :tk => "turkmène", - :tkl => "tokelau", - :tl => "tagalog", - :tlh => "klingon", - :tli => "tlingit", - :tmh => "tamacheq", - :tn => "tswana", - :to => "tongan", - :tog => "tonga nyasa", - :tpi => "tok pisin", - :tr => "turc", - :ts => "tsonga", - :tsi => "tsimshian", - :tt => "tatar", - :tum => "tumbuka", - :tup => "langue tupi", - :tut => "langue altaïque", - :tvl => "tuvalu", - :tw => "twi", - :ty => "tahitien", - :tyv => "touva", - :udm => "oudmourte", - :ug => "ouïgour", - :uga => "ougaritique", - :uk => "ukrainien", - :umb => "umbundu", - :und => "indéterminé", - :ur => "ourdou", - :uz => "ouzbek", - :vai => "vaï", - :ve => "venda", - :vi => "vietnamien", - :vo => "volapuk", - :vot => "vote", - :wa => "wallon", - :wak => "langues wakashennes", - :wal => "walamo", - :war => "waray", - :was => "washo", - :wen => "langue sorabe", - :wo => "wolof", - :xal => "kalmouk", - :xh => "xhosa", - :yao => "yao", - :yap => "yapois", - :yi => "yiddish", - :yo => "yoruba", - :ypk => "langues yupik", - :za => "zhuang", - :zap => "zapotèque", - :zbl => "symboles Bliss", - :zen => "zenaga", - :zh => "chinois", - :"zh-Hans" => "chinois simplifié", - :"zh-Hant" => "chinois traditionnel", - :znd => "zandé", - :zu => "zoulou", - :zun => "zuni", - :zxx => "sans contenu linguistique", - :zza => "zazaki", - } - } -} diff --git a/locale/fr.yml b/locale/fr.yml new file mode 100644 index 0000000..490de02 --- /dev/null +++ b/locale/fr.yml @@ -0,0 +1,505 @@ +fr: + languages: + ab: "abkhaze" + ace: "aceh" + ach: "acoli" + ada: "adangme" + ady: "adyghéen" + ae: "avestique" + af: "afrikaans" + afa: "langue afro-asiatique" + afh: "afrihili" + ain: "aïnou" + ak: "akan" + akk: "akkadien" + ale: "aléoute" + alg: "langue algonquienne" + alt: "altaï du Sud" + am: "amharique" + an: "aragonais" + ang: "ancien anglais" + anp: "angika" + apa: "langue apache" + ar: "arabe" + arc: "araméen" + arn: "araukan" + arp: "arapaho" + art: "langue artificielle" + arw: "arawak" + as: "assamais" + ast: "asturien" + ath: "langue athapascane" + aus: "langue australienne" + av: "avar" + awa: "awadhi" + ay: "aymara" + az: "azéri" + ba: "bachkir" + bad: "banda" + bai: "langue bamilékée" + bal: "baloutchi" + ban: "balinais" + bas: "bassa" + bat: "langue balte" + be: "biélorusse" + bej: "bedja" + bem: "bemba" + ber: "berbère" + bg: "bulgare" + bh: "bihari" + bho: "bhojpuri" + bi: "bichelamar" + bik: "bikol" + bin: "bini" + bla: "siksika" + bm: "bambara" + bn: "bengali" + bnt: "bantou" + bo: "tibétain" + br: "breton" + bra: "braj" + bs: "bosniaque" + btk: "batak" + bua: "bouriate" + bug: "bugi" + byn: "blin" + ca: "catalan" + cad: "caddo" + cai: "langue amérindienne centrale" + car: "caribe" + cau: "langue caucasienne" + cch: "atsam" + ce: "tchétchène" + ceb: "cebuano" + cel: "langue celtique" + ch: "chamorro" + chb: "chibcha" + chg: "tchaghataï" + chk: "chuuk" + chm: "mari" + chn: "jargon chinook" + cho: "choctaw" + chp: "chipewyan" + chr: "cherokee" + chy: "cheyenne" + cmc: "langue chame" + co: "corse" + cop: "copte" + cpe: "créole ou pidgin anglais" + cpf: "créole ou pidgin français" + cpp: "créole ou pidgin portugais" + cr: "cree" + crh: "turc de Crimée" + crp: "créole ou pidgin" + cs: "tchèque" + csb: "kachoube" + cu: "slavon d’église" + cus: "langue couchitique" + cv: "tchouvache" + cy: "gallois" + da: "danois" + dak: "dakota" + dar: "dargwa" + day: "dayak" + de: "allemand" + "de-AT": "allemand autrichien" + "de-CH": "allemand suisse" + del: "delaware" + den: "slavey" + dgr: "dogrib" + din: "dinka" + doi: "dogri" + dra: "langue dravidienne" + dsb: "bas-sorabe" + dua: "douala" + dum: "moyen néerlandais" + dv: "maldivien" + dyu: "dioula" + dz: "dzongkha" + ee: "éwé" + efi: "efik" + egy: "égyptien ancien" + eka: "ekajuk" + el: "grec" + elx: "élamite" + en: "anglais" + "en-AU": "anglais australien" + "en-CA": "anglais canadien" + "en-GB": "anglais britannique" + "en-US": "anglais américain" + enm: "moyen anglais" + eo: "espéranto" + es: "espagnol" + "es-ES": "espagnol ibérique" + et: "estonien" + eu: "basque" + ewo: "éwondo" + fa: "persan" + fan: "fang" + fat: "fanti" + ff: "peul" + fi: "finnois" + fil: "filipino" + fiu: "langue finno-ougrienne" + fj: "fidjien" + fo: "féroïen" + fon: "fon" + fr: "français" + "fr-CA": "français canadien" + "fr-CH": "français suisse" + frm: "moyen français" + fro: "ancien français" + frr: "frison du Nord" + frs: "frison oriental" + fur: "frioulan" + fy: "frison" + ga: "irlandais" + gaa: "ga" + gay: "gayo" + gba: "gbaya" + gd: "gaélique écossais" + gem: "langue germanique" + gez: "guèze" + gil: "gilbertais" + gl: "galicien" + gmh: "moyen haut-allemand" + gn: "guarani" + goh: "ancien haut allemand" + gon: "gondi" + gor: "gorontalo" + got: "gotique" + grb: "grebo" + grc: "grec ancien" + gsw: "alémanique" + gu: "goudjarâtî" + gv: "manx" + gwi: "gwichʼin" + ha: "haoussa" + hai: "haida" + haw: "hawaïen" + he: "hébreu" + hi: "hindi" + hil: "hiligaynon" + him: "himachali" + hit: "hittite" + hmn: "hmong" + ho: "hiri motu" + hr: "croate" + hsb: "haut-sorabe" + ht: "haïtien" + hu: "hongrois" + hup: "hupa" + hy: "arménien" + hz: "héréro" + ia: "interlingua" + iba: "iban" + id: "indonésien" + ie: "interlingue" + ig: "igbo" + ii: "yi de Sichuan" + ijo: "ijo" + ik: "inupiaq" + ilo: "ilokano" + inc: "langue indo-aryenne" + ine: "langue indo-européenne" + inh: "ingouche" + io: "ido" + ira: "langue iranienne" + iro: "langue iroquoienne" + is: "islandais" + it: "italien" + iu: "inuktitut" + ja: "japonais" + jbo: "lojban" + jpr: "judéo-persan" + jrb: "judéo-arabe" + jv: "javanais" + ka: "géorgien" + kaa: "karakalpak" + kab: "kabyle" + kac: "kachin" + kaj: "jju" + kam: "kamba" + kar: "karen" + kaw: "kawi" + kbd: "kabardin" + kcg: "tyap" + kfo: "koro" + kg: "kongo" + kha: "khasi" + khi: "langue khoïsan" + kho: "khotanais" + ki: "kikuyu" + kj: "kuanyama" + kk: "kazakh" + kl: "groenlandais" + km: "khmer" + kmb: "kiMboundou" + kn: "kannada" + ko: "coréen" + kok: "konkani" + kos: "kusaien" + kpe: "kpellé" + kr: "kanouri" + krc: "karatchaï balkar" + krl: "carélien" + kro: "krou" + kru: "kurukh" + ks: "kâshmîrî" + ku: "kurde" + kum: "koumyk" + kut: "kutenai" + kv: "komi" + kw: "cornique" + ky: "kirghize" + la: "latin" + lad: "ladino" + lah: "lahnda" + lam: "lamba" + lb: "luxembourgeois" + lez: "lezghien" + lg: "ganda" + li: "limbourgeois" + ln: "lingala" + lo: "lao" + lol: "mongo" + loz: "lozi" + lt: "lituanien" + lu: "luba-katanga" + lua: "luba-lulua" + lui: "luiseno" + lun: "lunda" + luo: "luo" + lus: "lushai" + lv: "letton" + mad: "madurais" + mag: "magahi" + mai: "maithili" + mak: "makassar" + man: "mandingue" + map: "malayo-polynésien" + mas: "masai" + mdf: "moksa" + mdr: "mandar" + men: "mendé" + mg: "malgache" + mga: "moyen irlandais" + mh: "marshall" + mi: "maori" + mic: "micmac" + min: "minangkabau" + mis: "langue diverse" + mk: "macédonien" + mkh: "langue mon-khmère" + ml: "malayalam" + mn: "mongol" + mnc: "mandchou" + mni: "manipuri" + mno: "langue manobo" + mo: "moldave" + moh: "mohawk" + mos: "moré" + mr: "marathe" + ms: "malais" + mt: "maltais" + mul: "multilingue" + mun: "langue mounda" + mus: "creek" + mwl: "mirandais" + mwr: "marwarî" + my: "birman" + myn: "langue maya" + myv: "erzya" + na: "nauruan" + nah: "nahuatl" + nai: "langue amérindienne du Nord" + nap: "napolitain" + nb: "norvégien bokmål" + nd: "ndébélé du Nord" + nds: "bas-allemand" + ne: "népalais" + new: "newari" + ng: "ndonga" + nia: "nias" + nic: "langue nigéro-congolaise" + niu: "niué" + nl: "néerlandais" + "nl-BE": "néerlandais belge" + nn: "norvégien nynorsk" + no: "norvégien" + nog: "nogaï" + non: "vieux norrois" + nqo: "n’ko" + nr: "ndébélé du Sud" + nso: "sotho du Nord" + nub: "langue nubienne" + nv: "navaho" + nwc: "newarî classique" + ny: "nyanja" + nym: "nyamwezi" + nyn: "nyankolé" + nyo: "nyoro" + nzi: "nzema" + oc: "occitan" + oj: "ojibwa" + om: "oromo" + or: "oriya" + os: "ossète" + osa: "osage" + ota: "turc ottoman" + oto: "langue otomangue" + pa: "pendjabi" + paa: "langue papoue" + pag: "pangasinan" + pal: "pahlavi" + pam: "pampangan" + pap: "papiamento" + pau: "palau" + peo: "persan ancien" + phi: "langue philippine" + phn: "phénicien" + pi: "pali" + pl: "polonais" + pon: "pohnpei" + pra: "langues prâkrit" + pro: "provençal ancien" + ps: "pachto" + pt: "portugais" + "pt-BR": "portugais brésilien" + "pt-PT": "portugais ibérique" + qu: "langue quechua" + raj: "rajasthani" + rap: "rapanui" + rar: "rarotongien" + rm: "rhéto-roman" + rn: "roundi" + ro: "roumain" + roa: "langue romane" + rom: "tzigane" + ru: "russe" + rup: "valaque" + rw: "rwanda" + sa: "sanskrit" + sad: "sandawe" + sah: "iakoute" + sai: "langue amérindienne du Sud" + sal: "langue salishenne" + sam: "araméen samaritain" + sas: "sasak" + sat: "santal" + sc: "sarde" + scn: "sicilien" + sco: "écossais" + sd: "sindhî" + se: "sami du Nord" + sel: "selkoupe" + sem: "langue sémitique" + sg: "sangho" + sga: "ancien irlandais" + sgn: "langue des signes" + sh: "serbo-croate" + shn: "shan" + si: "singhalais" + sid: "sidamo" + sio: "langue sioux" + sit: "langue sino-tibétaine" + sk: "slovaque" + sl: "slovène" + sla: "langue slave" + sm: "samoan" + sma: "sami du Sud" + smi: "langue samie" + smj: "sami de Lule" + smn: "sami d’Inari" + sms: "sami skolt" + sn: "shona" + snk: "soninké" + so: "somali" + sog: "sogdien" + son: "songhai" + sq: "albanais" + sr: "serbe" + srn: "sranan tongo" + srr: "sérère" + ss: "swati" + ssa: "langue nilo-saharienne" + st: "sesotho" + su: "soundanais" + suk: "sukuma" + sus: "soussou" + sux: "sumérien" + sv: "suédois" + sw: "swahili" + syc: "syriaque classique" + syr: "syriaque" + ta: "tamoul" + tai: "langue taï" + te: "télougou" + tem: "temne" + ter: "tereno" + tet: "tetum" + tg: "tadjik" + th: "thaï" + ti: "tigrigna" + tig: "tigré" + tiv: "tiv" + tk: "turkmène" + tkl: "tokelau" + tl: "tagalog" + tlh: "klingon" + tli: "tlingit" + tmh: "tamacheq" + tn: "tswana" + to: "tongan" + tog: "tonga nyasa" + tpi: "tok pisin" + tr: "turc" + ts: "tsonga" + tsi: "tsimshian" + tt: "tatar" + tum: "tumbuka" + tup: "langue tupi" + tut: "langue altaïque" + tvl: "tuvalu" + tw: "twi" + ty: "tahitien" + tyv: "touva" + udm: "oudmourte" + ug: "ouïgour" + uga: "ougaritique" + uk: "ukrainien" + umb: "umbundu" + und: "indéterminé" + ur: "ourdou" + uz: "ouzbek" + vai: "vaï" + ve: "venda" + vi: "vietnamien" + vo: "volapuk" + vot: "vote" + wa: "wallon" + wak: "langues wakashennes" + wal: "walamo" + war: "waray" + was: "washo" + wen: "langue sorabe" + wo: "wolof" + xal: "kalmouk" + xh: "xhosa" + yao: "yao" + yap: "yapois" + yi: "yiddish" + yo: "yoruba" + ypk: "langues yupik" + za: "zhuang" + zap: "zapotèque" + zbl: "symboles Bliss" + zen: "zenaga" + zh: "chinois" + zh-Hans: "chinois simplifié" + zh-Hant: "chinois traditionnel" + znd: "zandé" + zu: "zoulou" + zun: "zuni" + zxx: "sans contenu linguistique" + zza: "zazaki" diff --git a/locale/nl.rb b/locale/nl.rb deleted file mode 100644 index 68c5f8a..0000000 --- a/locale/nl.rb +++ /dev/null @@ -1,509 +0,0 @@ -{ - :nl => { - :languages => { - :ab => "Abchazisch", - :ace => "Atjees", - :ach => "Akoli", - :ada => "Adangme", - :ady => "Adyghe", - :ae => "Avestisch", - :af => "Afrikaans", - :afa => "Afro-Aziatische taal", - :afh => "Afrihili", - :ain => "Ainu", - :ak => "Akan", - :akk => "Akkadisch", - :ale => "Aleut", - :alg => "Algonkium-taal", - :alt => "Zuid-Altaïsch", - :am => "Amhaars", - :an => "Aragonees", - :ang => "Oudengels", - :anp => "Angika", - :apa => "Apache-taal", - :ar => "Arabisch", - :arc => "Aramees", - :arn => "Araukaans", - :arp => "Arapaho", - :art => "Kunstmatige taal", - :arw => "Arawak", - :as => "Assamees", - :ast => "Asturisch", - :ath => "Athapascaanse taal", - :aus => "Australische taal", - :av => "Avarisch", - :awa => "Awadhi", - :ay => "Aymara", - :az => "Azerbeidzjaans", - :ba => "Basjkiers", - :bad => "Banda", - :bai => "Bamileke-taal", - :bal => "Baloetsji", - :ban => "Balinees", - :bas => "Basa", - :bat => "Baltische taal", - :be => "Wit-Russisch", - :bej => "Beja", - :bem => "Bemba", - :ber => "Berber", - :bg => "Bulgaars", - :bh => "Bihari", - :bho => "Bhojpuri", - :bi => "Bislama", - :bik => "Bikol", - :bin => "Bini", - :bla => "Siksika", - :bm => "Bambara", - :bn => "Bengalees", - :bnt => "Bantoe", - :bo => "Tibetaans", - :br => "Bretons", - :bra => "Braj", - :bs => "Bosnisch", - :btk => "Batak", - :bua => "Buriat", - :bug => "Buginees", - :byn => "Blin", - :ca => "Catalaans", - :cad => "Caddo", - :cai => "Midden-Amerikaans Indiaanse taal", - :car => "Caribisch", - :cau => "Kaukasische taal", - :cch => "Atsam", - :ce => "Chechen", - :ceb => "Cebuano", - :cel => "Keltische taal", - :ch => "Chamorro", - :chb => "Chibcha", - :chg => "Chagatai", - :chk => "Chuukees", - :chm => "Mari", - :chn => "Chinook-jargon", - :cho => "Choctaw", - :chp => "Chipewyan", - :chr => "Cherokee", - :chy => "Cheyenne", - :cmc => "Chamische taal", - :co => "Corsicaans", - :cop => "Koptisch", - :cpe => "Op Engels gebaseerd Creools of Pidgin", - :cpf => "Op Frans gebaseerd Creools of Pidgin", - :cpp => "Op Portugees gebaseerd Creools of Pidgin", - :cr => "Cree", - :crh => "Krim-Tataars", - :crp => "Creools of Pidgin", - :cs => "Tsjechisch", - :csb => "Kasjoebisch", - :cu => "Kerkslavisch", - :cus => "Koesjitische taal", - :cv => "Tsjoevasjisch", - :cy => "Welsh", - :da => "Deens", - :dak => "Dakota", - :dar => "Dargwa", - :day => "Dajak", - :de => "Duits", - :"de-AT" => "Oostenrijks Duits", - :"de-CH" => "Zwitsers Hoogduits", - :del => "Delaware", - :den => "Slave", - :dgr => "Dogrib", - :din => "Dinka", - :doi => "Dogri", - :dra => "Dravidische taal", - :dsb => "Nedersorbisch", - :dua => "Duala", - :dum => "Middelnederlands", - :dv => "Divehi", - :dyu => "Dyula", - :dz => "Dzongkha", - :ee => "Ewe", - :efi => "Efik", - :egy => "Oudegyptisch", - :eka => "Ekajuk", - :el => "Grieks", - :elx => "Elamitisch", - :en => "Engels", - :"en-AU" => "Australisch Engels", - :"en-CA" => "Canadees Engels", - :"en-GB" => "Brits Engels", - :"en-US" => "Amerikaans Engels", - :enm => "Middelengels", - :eo => "Esperanto", - :es => "Spaans", - :"es-ES" => "Iberisch Spaans", - :et => "Estlands", - :eu => "Baskisch", - :ewo => "Ewondo", - :fa => "Perzisch", - :fan => "Fang", - :fat => "Fanti", - :ff => "Fulah", - :fi => "Fins", - :fil => "Filippijns", - :fiu => "Fins-Oegrische taal", - :fj => "Fijisch", - :fo => "Faeröers", - :fon => "Fon", - :fr => "Frans", - :"fr-CA" => "Canadees Frans", - :"fr-CH" => "Zwitsers Frans", - :frm => "Middelfrans", - :fro => "Oudfrans", - :frr => "Noord-Fries", - :frs => "Oost-Fries", - :fur => "Friulisch", - :fy => "Fries", - :ga => "Iers", - :gaa => "Ga", - :gay => "Gayo", - :gba => "Gbaya", - :gd => "Schots Gaelic", - :gem => "Germaanse taal", - :gez => "Geez", - :gil => "Gilbertees", - :gl => "Galicisch", - :gmh => "Middelhoogduits", - :gn => "Guarani", - :goh => "Oudhoogduits", - :gon => "Gondi", - :gor => "Gorontalo", - :got => "Gothisch", - :grb => "Grebo", - :grc => "Oudgrieks", - :gsw => "Zwitsers Duits", - :gu => "Gujarati", - :gv => "Manx", - :gwi => "Gwichʼin", - :ha => "Hausa", - :hai => "Haida", - :haw => "Hawaïaans", - :he => "Hebreeuws", - :hi => "Hindi", - :hil => "Hiligaynon", - :him => "Himachali", - :hit => "Hettitisch", - :hmn => "Hmong", - :ho => "Hiri Motu", - :hr => "Kroatisch", - :hsb => "Oppersorbisch", - :ht => "Haïtiaans", - :hu => "Hongaars", - :hup => "Hupa", - :hy => "Armeens", - :hz => "Herero", - :ia => "Interlingua", - :iba => "Iban", - :id => "Indonesisch", - :ie => "Interlingue", - :ig => "Igbo", - :ii => "Sichuan Yi", - :ijo => "Ijo", - :ik => "Inupiaq", - :ilo => "Iloko", - :inc => "Indische taal", - :ine => "Indo-Europese taal", - :inh => "Ingoesj", - :io => "Ido", - :ira => "Iraanse taal", - :iro => "Irokese taal", - :is => "IJslands", - :it => "Italiaans", - :iu => "Inuktitut", - :ja => "Japans", - :jbo => "Lojban", - :jpr => "Judeo-Perzisch", - :jrb => "Judeo-Arabisch", - :jv => "Javaans", - :ka => "Georgisch", - :kaa => "Karakalpaks", - :kab => "Kabyle", - :kac => "Kachin", - :kaj => "Jju", - :kam => "Kamba", - :kar => "Karen", - :kaw => "Kawi", - :kbd => "Kabardisch", - :kcg => "Tyap", - :kfo => "Koro", - :kg => "Kongo", - :kha => "Khasi", - :khi => "Khoisan-taal", - :kho => "Khotanees", - :ki => "Kikuyu", - :kj => "Kuanyama", - :kk => "Kazachs", - :kl => "Kalaallisut", - :km => "Khmer", - :kmb => "Kimbundu", - :kn => "Kannada", - :ko => "Koreaans", - :kok => "Konkani", - :kos => "Kosraeaans", - :kpe => "Kpelle", - :kr => "Kanuri", - :krc => "Karachay-Balkar", - :krl => "Karelisch", - :kro => "Kru", - :kru => "Kurukh", - :ks => "Kashmiri", - :ku => "Koerdisch", - :kum => "Kumyk", - :kut => "Kutenai", - :kv => "Komi", - :kw => "Cornish", - :ky => "Kirgizisch", - :la => "Latijn", - :lad => "Ladino", - :lah => "Lahnda", - :lam => "Lamba", - :lb => "Luxemburgs", - :lez => "Lezgisch", - :lg => "Ganda", - :li => "Limburgs", - :ln => "Lingala", - :lo => "Lao", - :lol => "Mongo", - :loz => "Lozi", - :lt => "Litouws", - :lu => "Luba-Katanga", - :lua => "Luba-Lulua", - :lui => "Luiseno", - :lun => "Lunda", - :luo => "Luo", - :lus => "Lushai", - :lv => "Letlands", - :mad => "Madurees", - :mag => "Magahi", - :mai => "Maithili", - :mak => "Makassaars", - :man => "Mandingo", - :map => "Austronesisch", - :mas => "Masai", - :mdf => "Moksha", - :mdr => "Mandar", - :men => "Mende", - :mg => "Malagasisch", - :mga => "Middeliers", - :mh => "Marshallees", - :mi => "Maori", - :mic => "Mi'kmaq", - :min => "Minangkabau", - :mis => "Diverse talen", - :mk => "Macedonisch", - :mkh => "Mon-Khmer-taal", - :ml => "Malayalam", - :mn => "Mongools", - :mnc => "Mantsjoe", - :mni => "Manipoeri", - :mno => "Manobo-taal", - :mo => "Moldavisch", - :moh => "Mohawk", - :mos => "Mossi", - :mr => "Marathi", - :ms => "Maleis", - :mt => "Maltees", - :mul => "Meerdere talen", - :mun => "Munda-taal", - :mus => "Creek", - :mwl => "Mirandees", - :mwr => "Marwari", - :my => "Birmees", - :myn => "Mayan-taal", - :myv => "Erzya", - :na => "Nauru", - :nah => "Nahuatl", - :nai => "Noord-Amerikaans Indiaanse taal", - :nap => "Napolitaans", - :nb => "Noors - Bokmål", - :nd => "Noord-Ndbele", - :nds => "Laagduits", - :ne => "Nepalees", - :new => "Newari", - :ng => "Ndonga", - :nia => "Nias", - :nic => "Niger-Kordofanische taal", - :niu => "Niueaans", - :nl => "Nederlands", - :"nl-BE" => "Vlaams", - :nn => "Noors - Nynorsk", - :no => "Noors", - :nog => "Nogai", - :non => "Oudnoors", - :nqo => "N’ko", - :nr => "Zuid-Ndbele", - :nso => "Noord-Sotho", - :nub => "Nubische taal", - :nv => "Navajo", - :nwc => "Klassiek Newari", - :ny => "Nyanja", - :nym => "Nyamwezi", - :nyn => "Nyankole", - :nyo => "Nyoro", - :nzi => "Nzima", - :oc => "Occitaans", - :oj => "Ojibwa", - :om => "Oromo", - :or => "Oriya", - :os => "Ossetisch", - :osa => "Osage", - :ota => "Ottomaans-Turks", - :oto => "Otomi-taal", - :pa => "Punjabi", - :paa => "Papoeataal", - :pag => "Pangasinan", - :pal => "Pahlavi", - :pam => "Pampanga", - :pap => "Papiamento", - :pau => "Palauaans", - :peo => "Oudperzisch", - :phi => "Filippijnse taal", - :phn => "Foenicisch", - :pi => "Pali", - :pl => "Pools", - :pon => "Pohnpeiaans", - :pra => "Prakrit-taal", - :pro => "Oudprovençaals", - :ps => "Pasjtoe", - :pt => "Portugees", - :"pt-BR" => "Braziliaans Portugees", - :"pt-PT" => "Iberisch Portugees", - :qu => "Quechua", - :raj => "Rajasthani", - :rap => "Rapanui", - :rar => "Rarotongan", - :rm => "Reto-Romaans", - :rn => "Rundi", - :ro => "Roemeens", - :roa => "Romaanse taal", - :rom => "Romani", - :ru => "Russisch", - :rup => "Aromaniaans", - :rw => "Kinyarwanda", - :sa => "Sanskriet", - :sad => "Sandawe", - :sah => "Yakut", - :sai => "Zuid-Amerikaans Indiaanse taal", - :sal => "Salishan-taal", - :sam => "Samaritaans-Aramees", - :sas => "Sasak", - :sat => "Santali", - :sc => "Sardinisch", - :scn => "Siciliaans", - :sco => "Schots", - :sd => "Sindhi", - :se => "Noord-Samisch", - :sel => "Selkup", - :sem => "Semitische taal", - :sg => "Sango", - :sga => "Oudiers", - :sgn => "Gebarentaal", - :sh => "Servokroatisch", - :shn => "Shan", - :si => "Singalees", - :sid => "Sidamo", - :sio => "Siouaanse talen", - :sit => "Sino-Tibetaanse taal", - :sk => "Slowaaks", - :sl => "Sloveens", - :sla => "Slavische taal", - :sm => "Samoaans", - :sma => "Zuid-Samisch", - :smi => "Sami-taal", - :smj => "Lule Sami", - :smn => "Inari Sami", - :sms => "Skolt Sami", - :sn => "Shona", - :snk => "Soninke", - :so => "Somalisch", - :sog => "Sogdisch", - :son => "Songhai", - :sq => "Albanees", - :sr => "Servisch", - :srn => "Sranantongo", - :srr => "Serer", - :ss => "Swati", - :ssa => "Nilo-Saharaanse taal", - :st => "Zuid-Sotho", - :su => "Soendanees", - :suk => "Sukuma", - :sus => "Soesoe", - :sux => "Soemerisch", - :sv => "Zweeds", - :sw => "Swahili", - :syc => "Klassiek Syrisch", - :syr => "Syriac", - :ta => "Tamil", - :tai => "Tai-taal", - :te => "Teloegoe", - :tem => "Timne", - :ter => "Tereno", - :tet => "Tetum", - :tg => "Tadzjieks", - :th => "Thais", - :ti => "Tigrinya", - :tig => "Tigre", - :tiv => "Tiv", - :tk => "Turkmeens", - :tkl => "Tokelau", - :tl => "Tagalog", - :tlh => "Klingon", - :tli => "Tlingit", - :tmh => "Tamashek", - :tn => "Tswana", - :to => "Tonga", - :tog => "Nyasa Tonga", - :tpi => "Tok Pisin", - :tr => "Turks", - :ts => "Tsonga", - :tsi => "Tsimshian", - :tt => "Tataars", - :tum => "Toemboeka", - :tup => "Tupi-taal", - :tut => "Altaïsche taal", - :tvl => "Tuvalu", - :tw => "Twi", - :ty => "Tahitisch", - :tyv => "Tuvinisch", - :udm => "Udmurt", - :ug => "Oeigoers", - :uga => "Oegaritisch", - :uk => "Oekraïens", - :umb => "Umbundu", - :und => "Onbepaald", - :ur => "Urdu", - :uz => "Oezbeeks", - :vai => "Vai", - :ve => "Venda", - :vi => "Vietnamees", - :vo => "Volapük", - :vot => "Votisch", - :wa => "Wallonisch", - :wak => "Wakashan-taal", - :wal => "Walamo", - :war => "Waray", - :was => "Washo", - :wen => "Sorbische taal", - :wo => "Wolof", - :xal => "Kalmyk", - :xh => "Xhosa", - :yao => "Yao", - :yap => "Yapees", - :yi => "Jiddisch", - :yo => "Yoruba", - :ypk => "Yupik-talen", - :za => "Zhuang", - :zap => "Zapotec", - :zbl => "Blissymbolen", - :zen => "Zenaga", - :zh => "Chinees", - :"zh-Hans" => "Vereenvoudigd Chinees", - :"zh-Hant" => "Traditioneel Chinees", - :znd => "Zande", - :zu => "Zulu", - :zun => "Zuni", - :zxx => "Geen linguïstische inhoud", - :zza => "Zaza", - } - } -} diff --git a/locale/nl.yml b/locale/nl.yml new file mode 100644 index 0000000..a5b1ae9 --- /dev/null +++ b/locale/nl.yml @@ -0,0 +1,505 @@ +nl: + languages: + ab: "Abchazisch" + ace: "Atjees" + ach: "Akoli" + ada: "Adangme" + ady: "Adyghe" + ae: "Avestisch" + af: "Afrikaans" + afa: "Afro-Aziatische taal" + afh: "Afrihili" + ain: "Ainu" + ak: "Akan" + akk: "Akkadisch" + ale: "Aleut" + alg: "Algonkium-taal" + alt: "Zuid-Altaïsch" + am: "Amhaars" + an: "Aragonees" + ang: "Oudengels" + anp: "Angika" + apa: "Apache-taal" + ar: "Arabisch" + arc: "Aramees" + arn: "Araukaans" + arp: "Arapaho" + art: "Kunstmatige taal" + arw: "Arawak" + as: "Assamees" + ast: "Asturisch" + ath: "Athapascaanse taal" + aus: "Australische taal" + av: "Avarisch" + awa: "Awadhi" + ay: "Aymara" + az: "Azerbeidzjaans" + ba: "Basjkiers" + bad: "Banda" + bai: "Bamileke-taal" + bal: "Baloetsji" + ban: "Balinees" + bas: "Basa" + bat: "Baltische taal" + be: "Wit-Russisch" + bej: "Beja" + bem: "Bemba" + ber: "Berber" + bg: "Bulgaars" + bh: "Bihari" + bho: "Bhojpuri" + bi: "Bislama" + bik: "Bikol" + bin: "Bini" + bla: "Siksika" + bm: "Bambara" + bn: "Bengalees" + bnt: "Bantoe" + bo: "Tibetaans" + br: "Bretons" + bra: "Braj" + bs: "Bosnisch" + btk: "Batak" + bua: "Buriat" + bug: "Buginees" + byn: "Blin" + ca: "Catalaans" + cad: "Caddo" + cai: "Midden-Amerikaans Indiaanse taal" + car: "Caribisch" + cau: "Kaukasische taal" + cch: "Atsam" + ce: "Chechen" + ceb: "Cebuano" + cel: "Keltische taal" + ch: "Chamorro" + chb: "Chibcha" + chg: "Chagatai" + chk: "Chuukees" + chm: "Mari" + chn: "Chinook-jargon" + cho: "Choctaw" + chp: "Chipewyan" + chr: "Cherokee" + chy: "Cheyenne" + cmc: "Chamische taal" + co: "Corsicaans" + cop: "Koptisch" + cpe: "Op Engels gebaseerd Creools of Pidgin" + cpf: "Op Frans gebaseerd Creools of Pidgin" + cpp: "Op Portugees gebaseerd Creools of Pidgin" + cr: "Cree" + crh: "Krim-Tataars" + crp: "Creools of Pidgin" + cs: "Tsjechisch" + csb: "Kasjoebisch" + cu: "Kerkslavisch" + cus: "Koesjitische taal" + cv: "Tsjoevasjisch" + cy: "Welsh" + da: "Deens" + dak: "Dakota" + dar: "Dargwa" + day: "Dajak" + de: "Duits" + "de-AT": "Oostenrijks Duits" + "de-CH": "Zwitsers Hoogduits" + del: "Delaware" + den: "Slave" + dgr: "Dogrib" + din: "Dinka" + doi: "Dogri" + dra: "Dravidische taal" + dsb: "Nedersorbisch" + dua: "Duala" + dum: "Middelnederlands" + dv: "Divehi" + dyu: "Dyula" + dz: "Dzongkha" + ee: "Ewe" + efi: "Efik" + egy: "Oudegyptisch" + eka: "Ekajuk" + el: "Grieks" + elx: "Elamitisch" + en: "Engels" + "en-AU": "Australisch Engels" + "en-CA": "Canadees Engels" + "en-GB": "Brits Engels" + "en-US": "Amerikaans Engels" + enm: "Middelengels" + eo: "Esperanto" + es: "Spaans" + "es-ES": "Iberisch Spaans" + et: "Estlands" + eu: "Baskisch" + ewo: "Ewondo" + fa: "Perzisch" + fan: "Fang" + fat: "Fanti" + ff: "Fulah" + fi: "Fins" + fil: "Filippijns" + fiu: "Fins-Oegrische taal" + fj: "Fijisch" + fo: "Faeröers" + fon: "Fon" + fr: "Frans" + "fr-CA": "Canadees Frans" + "fr-CH": "Zwitsers Frans" + frm: "Middelfrans" + fro: "Oudfrans" + frr: "Noord-Fries" + frs: "Oost-Fries" + fur: "Friulisch" + fy: "Fries" + ga: "Iers" + gaa: "Ga" + gay: "Gayo" + gba: "Gbaya" + gd: "Schots Gaelic" + gem: "Germaanse taal" + gez: "Geez" + gil: "Gilbertees" + gl: "Galicisch" + gmh: "Middelhoogduits" + gn: "Guarani" + goh: "Oudhoogduits" + gon: "Gondi" + gor: "Gorontalo" + got: "Gothisch" + grb: "Grebo" + grc: "Oudgrieks" + gsw: "Zwitsers Duits" + gu: "Gujarati" + gv: "Manx" + gwi: "Gwichʼin" + ha: "Hausa" + hai: "Haida" + haw: "Hawaïaans" + he: "Hebreeuws" + hi: "Hindi" + hil: "Hiligaynon" + him: "Himachali" + hit: "Hettitisch" + hmn: "Hmong" + ho: "Hiri Motu" + hr: "Kroatisch" + hsb: "Oppersorbisch" + ht: "Haïtiaans" + hu: "Hongaars" + hup: "Hupa" + hy: "Armeens" + hz: "Herero" + ia: "Interlingua" + iba: "Iban" + id: "Indonesisch" + ie: "Interlingue" + ig: "Igbo" + ii: "Sichuan Yi" + ijo: "Ijo" + ik: "Inupiaq" + ilo: "Iloko" + inc: "Indische taal" + ine: "Indo-Europese taal" + inh: "Ingoesj" + io: "Ido" + ira: "Iraanse taal" + iro: "Irokese taal" + is: "IJslands" + it: "Italiaans" + iu: "Inuktitut" + ja: "Japans" + jbo: "Lojban" + jpr: "Judeo-Perzisch" + jrb: "Judeo-Arabisch" + jv: "Javaans" + ka: "Georgisch" + kaa: "Karakalpaks" + kab: "Kabyle" + kac: "Kachin" + kaj: "Jju" + kam: "Kamba" + kar: "Karen" + kaw: "Kawi" + kbd: "Kabardisch" + kcg: "Tyap" + kfo: "Koro" + kg: "Kongo" + kha: "Khasi" + khi: "Khoisan-taal" + kho: "Khotanees" + ki: "Kikuyu" + kj: "Kuanyama" + kk: "Kazachs" + kl: "Kalaallisut" + km: "Khmer" + kmb: "Kimbundu" + kn: "Kannada" + ko: "Koreaans" + kok: "Konkani" + kos: "Kosraeaans" + kpe: "Kpelle" + kr: "Kanuri" + krc: "Karachay-Balkar" + krl: "Karelisch" + kro: "Kru" + kru: "Kurukh" + ks: "Kashmiri" + ku: "Koerdisch" + kum: "Kumyk" + kut: "Kutenai" + kv: "Komi" + kw: "Cornish" + ky: "Kirgizisch" + la: "Latijn" + lad: "Ladino" + lah: "Lahnda" + lam: "Lamba" + lb: "Luxemburgs" + lez: "Lezgisch" + lg: "Ganda" + li: "Limburgs" + ln: "Lingala" + lo: "Lao" + lol: "Mongo" + loz: "Lozi" + lt: "Litouws" + lu: "Luba-Katanga" + lua: "Luba-Lulua" + lui: "Luiseno" + lun: "Lunda" + luo: "Luo" + lus: "Lushai" + lv: "Letlands" + mad: "Madurees" + mag: "Magahi" + mai: "Maithili" + mak: "Makassaars" + man: "Mandingo" + map: "Austronesisch" + mas: "Masai" + mdf: "Moksha" + mdr: "Mandar" + men: "Mende" + mg: "Malagasisch" + mga: "Middeliers" + mh: "Marshallees" + mi: "Maori" + mic: "Mi'kmaq" + min: "Minangkabau" + mis: "Diverse talen" + mk: "Macedonisch" + mkh: "Mon-Khmer-taal" + ml: "Malayalam" + mn: "Mongools" + mnc: "Mantsjoe" + mni: "Manipoeri" + mno: "Manobo-taal" + mo: "Moldavisch" + moh: "Mohawk" + mos: "Mossi" + mr: "Marathi" + ms: "Maleis" + mt: "Maltees" + mul: "Meerdere talen" + mun: "Munda-taal" + mus: "Creek" + mwl: "Mirandees" + mwr: "Marwari" + my: "Birmees" + myn: "Mayan-taal" + myv: "Erzya" + na: "Nauru" + nah: "Nahuatl" + nai: "Noord-Amerikaans Indiaanse taal" + nap: "Napolitaans" + nb: "Noors - Bokmål" + nd: "Noord-Ndbele" + nds: "Laagduits" + ne: "Nepalees" + new: "Newari" + ng: "Ndonga" + nia: "Nias" + nic: "Niger-Kordofanische taal" + niu: "Niueaans" + nl: "Nederlands" + "nl-BE": "Vlaams" + nn: "Noors - Nynorsk" + no: "Noors" + nog: "Nogai" + non: "Oudnoors" + nqo: "N’ko" + nr: "Zuid-Ndbele" + nso: "Noord-Sotho" + nub: "Nubische taal" + nv: "Navajo" + nwc: "Klassiek Newari" + ny: "Nyanja" + nym: "Nyamwezi" + nyn: "Nyankole" + nyo: "Nyoro" + nzi: "Nzima" + oc: "Occitaans" + oj: "Ojibwa" + om: "Oromo" + or: "Oriya" + os: "Ossetisch" + osa: "Osage" + ota: "Ottomaans-Turks" + oto: "Otomi-taal" + pa: "Punjabi" + paa: "Papoeataal" + pag: "Pangasinan" + pal: "Pahlavi" + pam: "Pampanga" + pap: "Papiamento" + pau: "Palauaans" + peo: "Oudperzisch" + phi: "Filippijnse taal" + phn: "Foenicisch" + pi: "Pali" + pl: "Pools" + pon: "Pohnpeiaans" + pra: "Prakrit-taal" + pro: "Oudprovençaals" + ps: "Pasjtoe" + pt: "Portugees" + "pt-BR": "Braziliaans Portugees" + "pt-PT": "Iberisch Portugees" + qu: "Quechua" + raj: "Rajasthani" + rap: "Rapanui" + rar: "Rarotongan" + rm: "Reto-Romaans" + rn: "Rundi" + ro: "Roemeens" + roa: "Romaanse taal" + rom: "Romani" + ru: "Russisch" + rup: "Aromaniaans" + rw: "Kinyarwanda" + sa: "Sanskriet" + sad: "Sandawe" + sah: "Yakut" + sai: "Zuid-Amerikaans Indiaanse taal" + sal: "Salishan-taal" + sam: "Samaritaans-Aramees" + sas: "Sasak" + sat: "Santali" + sc: "Sardinisch" + scn: "Siciliaans" + sco: "Schots" + sd: "Sindhi" + se: "Noord-Samisch" + sel: "Selkup" + sem: "Semitische taal" + sg: "Sango" + sga: "Oudiers" + sgn: "Gebarentaal" + sh: "Servokroatisch" + shn: "Shan" + si: "Singalees" + sid: "Sidamo" + sio: "Siouaanse talen" + sit: "Sino-Tibetaanse taal" + sk: "Slowaaks" + sl: "Sloveens" + sla: "Slavische taal" + sm: "Samoaans" + sma: "Zuid-Samisch" + smi: "Sami-taal" + smj: "Lule Sami" + smn: "Inari Sami" + sms: "Skolt Sami" + sn: "Shona" + snk: "Soninke" + so: "Somalisch" + sog: "Sogdisch" + son: "Songhai" + sq: "Albanees" + sr: "Servisch" + srn: "Sranantongo" + srr: "Serer" + ss: "Swati" + ssa: "Nilo-Saharaanse taal" + st: "Zuid-Sotho" + su: "Soendanees" + suk: "Sukuma" + sus: "Soesoe" + sux: "Soemerisch" + sv: "Zweeds" + sw: "Swahili" + syc: "Klassiek Syrisch" + syr: "Syriac" + ta: "Tamil" + tai: "Tai-taal" + te: "Teloegoe" + tem: "Timne" + ter: "Tereno" + tet: "Tetum" + tg: "Tadzjieks" + th: "Thais" + ti: "Tigrinya" + tig: "Tigre" + tiv: "Tiv" + tk: "Turkmeens" + tkl: "Tokelau" + tl: "Tagalog" + tlh: "Klingon" + tli: "Tlingit" + tmh: "Tamashek" + tn: "Tswana" + to: "Tonga" + tog: "Nyasa Tonga" + tpi: "Tok Pisin" + tr: "Turks" + ts: "Tsonga" + tsi: "Tsimshian" + tt: "Tataars" + tum: "Toemboeka" + tup: "Tupi-taal" + tut: "Altaïsche taal" + tvl: "Tuvalu" + tw: "Twi" + ty: "Tahitisch" + tyv: "Tuvinisch" + udm: "Udmurt" + ug: "Oeigoers" + uga: "Oegaritisch" + uk: "Oekraïens" + umb: "Umbundu" + und: "Onbepaald" + ur: "Urdu" + uz: "Oezbeeks" + vai: "Vai" + ve: "Venda" + vi: "Vietnamees" + vo: "Volapük" + vot: "Votisch" + wa: "Wallonisch" + wak: "Wakashan-taal" + wal: "Walamo" + war: "Waray" + was: "Washo" + wen: "Sorbische taal" + wo: "Wolof" + xal: "Kalmyk" + xh: "Xhosa" + yao: "Yao" + yap: "Yapees" + yi: "Jiddisch" + yo: "Yoruba" + ypk: "Yupik-talen" + za: "Zhuang" + zap: "Zapotec" + zbl: "Blissymbolen" + zen: "Zenaga" + zh: "Chinees" + "zh-Hans": "Vereenvoudigd Chinees" + "zh-Hant": "Traditioneel Chinees" + znd: "Zande" + zu: "Zulu" + zun: "Zuni" + zxx: "Geen linguïstische inhoud" + zza: "Zaza"
davec/localized_language_select
8c3854c113cb915e78f11c09beec73d38a05d25a
initial gem version
diff --git a/README.textile b/README.textile index f100f8b..5e85851 100644 --- a/README.textile +++ b/README.textile @@ -1,91 +1,99 @@ h1. LocalizedLanguageSelect Rails plugin to provide support for localized <tt><select></tt> menu with language names and for storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database. Uses the Rails internationalization framework ("I18n":http://rails-i18n.org) for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value. You can easily translate language codes in your application like this: <pre> <%= I18n.t @user.language, :scope => 'languages' %> </pre> Comes with a Rake task <tt>rake import:language_select locale=de</tt> for importing language names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) Don't forget to restart the application when you add new locale. The code borrows heavily from the LocalizedCountrySelect plugin. See "localized_country_select":http://github.com/karmi/localized_country_select h2. Install & Usage Install as plugin: <pre>$ rails plugin install https://github.com/kristianmandrup/localized_language_select.git</pre> Install as gem: Insert in Gemfile <pre>gem 'localized_language_select'</pre> Then run: <pre>$ bundle install</pre> +Then run: + +<pre>$ rails g localized_language_select:locales</pre> + +In order to copy locale files to your Rails config/locales dir. Note: you can specify which locales using the @--locales@ option, which takes a list of locales. + +<pre>$ rails g localized_language_select:locales --locales da en fr</pre> + h2. Usage example <pre> <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %> </pre> will become: <pre> <select name="user[language]" id="user_language"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="aa">Afar</option> ... <option value="zza">ZaZa</option> </select> </pre> for the <tt>en</tt> locale. h2. Options @:exclude@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :exclude => ['Afrikaans']) %> </pre> @:only@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> </pre> h2. Framework usage This plugin should also integrate nicely with various formbuilders, including Formtastic Formtastic example: <pre> <%= semantic_form_for @user do |form| %> ... <%= form.input :lang, :as => :language, :priority_languages => ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> ... <% end %> </pre> h2. Copyright Copyright (c) 2009 David Cato, released under the MIT license diff --git a/lib/generators/localized_language_select/locales/locales_generator.rb b/lib/generators/localized_language_select/locales/locales_generator.rb new file mode 100644 index 0000000..e4dd534 --- /dev/null +++ b/lib/generators/localized_language_select/locales/locales_generator.rb @@ -0,0 +1,38 @@ +# require 'rails/generators/base' +# require 'sugar-high/array' +# require 'active_support/inflector' +# require 'rails3_artifactor' +# require 'logging_assist' + +module LocalizedLanguageSelect + module Generators + class LocaleGenerator < Rails::Generators::Base + desc "Copy locale files" + + class_option :locales, :type => :array, :default => ['all'], :desc => 'locales to generate for' + + source_root File.dirname(__FILE__) + + def main_flow + copy_locales + end + + protected + + def supported_locales + [:en, :da] + end + + def locales + return supported_locales if options[:locales].include? 'all' + options[:locales].map(&:to_sym) & supported_locales + end + + def copy_locales + locales.each do |locale| + copy_file "../../../../locale/#{locale}.yml", "config/locales/languages.#{locale}.yml" + end + end + end + end +end \ No newline at end of file diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index 2219e10..a315342 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,114 +1,117 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # + +require 'localized_language_select/i18n' + module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array options = {} res = [] list = I18n.translate(:languages).each do |key, value| res << [value, key.to_s.upcase] if include_language?(key.to_s, options) end res.sort_by { |country| country.first.parameterize } end def include_language?(key, options) if options[:only] return options[:only].include?(key) end if options[:except] return !options[:except].include?(key) end true end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/lib/localized_language_select/i18n.rb b/lib/localized_language_select/i18n.rb new file mode 100644 index 0000000..f9ba2e5 --- /dev/null +++ b/lib/localized_language_select/i18n.rb @@ -0,0 +1,19 @@ +# encoding: utf-8 + +# module LocalizedLanguageSelect +# module I18n +# DEFAULT_SCOPE = [:languages].freeze +# DEFAULT_VALUES = YAML.load_file(File.expand_path("../../../locale/en.yml", __FILE__))["en"]["languages"].freeze +# +# class << self +# def translate(*args) +# key = args.shift.to_sym +# options = args.extract_options! +# options.reverse_merge!(:default => DEFAULT_VALUES[key]) +# options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact +# ::I18n.translate(key, *(args << options)) +# end +# alias :t :translate +# end +# end +# end diff --git a/locale/da.yml b/locale/da.yml new file mode 100644 index 0000000..6c66b1c --- /dev/null +++ b/locale/da.yml @@ -0,0 +1,508 @@ +# TODO !!! + +en: + languages: + ab: "Abkhazian" + ace: "Achinese" + ach: "Acoli" + ada: "Adangme" + ady: "Adyghe" + ae: "Avestan" + af: "Afrikaans" + afa: "Afro-Asiatic Sprog" + afh: "Afrihili" + ain: "Ainu" + ak: "Akan" + akk: "Akkadian" + ale: "Aleut" + alg: "Algonquian Sprog" + alt: "Southern Altai" + am: "Amharic" + an: "Aragonese" + ang: "Gammelt Engelsk" + anp: "Angika" + apa: "Apache Sprog" + ar: "Arabic" + arc: "Aramaic" + arn: "Araucanian" + arp: "Arapaho" + art: "Kunstigt Sprog" + arw: "Arawak" + as: "Assamese" + ast: "Asturian" + ath: "Athapascan Sprog" + aus: "Australian Sprog" + av: "Avaric" + awa: "Awadhi" + ay: "Aymara" + az: "Azerbaijani" + ba: "Bashkir" + bad: "Banda" + bai: "Bamileke Sprog" + bal: "Baluchi" + ban: "Balinese" + bas: "Basa" + bat: "Baltic Sprog" + be: "Belarusian" + bej: "Beja" + bem: "Bemba" + ber: "Berber" + bg: "Bulgarian" + bh: "Bihari" + bho: "Bhojpuri" + bi: "Bislama" + bik: "Bikol" + bin: "Bini" + bla: "Siksika" + bm: "Bambara" + bn: "Bengali" + bnt: "Bantu" + bo: "Tibetan" + br: "Breton" + bra: "Braj" + bs: "Bosnian" + btk: "Batak" + bua: "Buriat" + bug: "Buginese" + byn: "Blin" + ca: "Catalan" + cad: "Caddo" + cai: "Central American Indian Sprog" + car: "Carib" + cau: "Caucasian Sprog" + cch: "Atsam" + ce: "Chechen" + ceb: "Cebuano" + cel: "Celtic Sprog" + ch: "Chamorro" + chb: "Chibcha" + chg: "Chagatai" + chk: "Chuukese" + chm: "Mari" + chn: "Chinook Jargon" + cho: "Choctaw" + chp: "Chipewyan" + chr: "Cherokee" + chy: "Cheyenne" + cmc: "Chamic Sprog" + co: "Corsican" + cop: "Coptic" + cpe: "English-based Creole or Pidgin" + cpf: "French-based Creole or Pidgin" + cpp: "Portuguese-based Creole or Pidgin" + cr: "Cree" + crh: "Crimean Turkish" + crp: "Creole or Pidgin" + cs: "Czech" + csb: "Kashubian" + cu: "Church Slavic" + cus: "Cushitic Sprog" + cv: "Chuvash" + cy: "Welsh" + da: "Danish" + dak: "Dakota" + dar: "Dargwa" + day: "Dayak" + de: "German" + "de-AT": "Austrian German" + "de-CH": "Swiss High German" + del: "Delaware" + den: "Slave" + dgr: "Dogrib" + din: "Dinka" + doi: "Dogri" + dra: "Dravidian Sprog" + dsb: "Lower Sorbian" + dua: "Duala" + dum: "Middle Dutch" + dv: "Divehi" + dyu: "Dyula" + dz: "Dzongkha" + ee: "Ewe" + efi: "Efik" + egy: "Ancient Egyptian" + eka: "Ekajuk" + el: "Greek" + elx: "Elamite" + en: "English" + "en-AU": "Australian English" + "en-CA": "Canadian English" + "en-GB": "British English" + "en-US": "U.S. English" + enm: "Middle English" + eo: "Esperanto" + es: "Spanish" + "es-ES": "Iberian Spanish" + et: "Estonian" + eu: "Basque" + ewo: "Ewondo" + fa: "Persian" + fan: "Fang" + fat: "Fanti" + ff: "Fulah" + fi: "Finnish" + fil: "Filipino" + fiu: "Finno-Ugrian Sprog" + fj: "Fijian" + fo: "Faroese" + fon: "Fon" + fr: "French" + "fr-CA": "Canadian French" + "fr-CH": "Swiss French" + frm: "Middle French" + fro: "Old French" + frr: "Northern Frisian" + frs: "Eastern Frisian" + fur: "Friulian" + fy: "Western Frisian" + ga: "Irish" + gaa: "Ga" + gay: "Gayo" + gba: "Gbaya" + gd: "Scottish Gaelic" + gem: "Germanic Sprog" + gez: "Geez" + gil: "Gilbertese" + gl: "Galician" + gmh: "Middle High German" + gn: "Guarani" + goh: "Old High German" + gon: "Gondi" + gor: "Gorontalo" + got: "Gothic" + grb: "Grebo" + grc: "Ancient Greek" + gsw: "Swiss German" + gu: "Gujarati" + gv: "Manx" + gwi: "Gwichʼin" + ha: "Hausa" + hai: "Haida" + haw: "Hawaiian" + he: "Hebrew" + hi: "Hindi" + hil: "Hiligaynon" + him: "Himachali" + hit: "Hittite" + hmn: "Hmong" + ho: "Hiri Motu" + hr: "Croatian" + hsb: "Upper Sorbian" + ht: "Haitian" + hu: "Hungarian" + hup: "Hupa" + hy: "Armenian" + hz: "Herero" + ia: "Interlingua" + iba: "Iban" + id: "Indonesian" + ie: "Interlingue" + ig: "Igbo" + ii: "Sichuan Yi" + ijo: "Ijo" + ik: "Inupiaq" + ilo: "Iloko" + inc: "Indic Sprog" + ine: "Indo-European Sprog" + inh: "Ingush" + io: "Ido" + ira: "Iranian Sprog" + iro: "Iroquoian Sprog" + is: "Icelandic" + it: "Italian" + iu: "Inuktitut" + ja: "Japanese" + jbo: "Lojban" + jpr: "Judeo-Persian" + jrb: "Judeo-Arabic" + jv: "Javanese" + ka: "Georgian" + kaa: "Kara-Kalpak" + kab: "Kabyle" + kac: "Kachin" + kaj: "Jju" + kam: "Kamba" + kar: "Karen" + kaw: "Kawi" + kbd: "Kabardian" + kcg: "Tyap" + kfo: "Koro" + kg: "Kongo" + kha: "Khasi" + khi: "Khoisan Sprog" + kho: "Khotanese" + ki: "Kikuyu" + kj: "Kuanyama" + kk: "Kazakh" + kl: "Kalaallisut" + km: "Khmer" + kmb: "Kimbundu" + kn: "Kannada" + ko: "Korean" + kok: "Konkani" + kos: "Kosraean" + kpe: "Kpelle" + kr: "Kanuri" + krc: "Karachay-Balkar" + krl: "Karelian" + kro: "Kru" + kru: "Kurukh" + ks: "Kashmiri" + ku: "Kurdish" + kum: "Kumyk" + kut: "Kutenai" + kv: "Komi" + kw: "Cornish" + ky: "Kirghiz" + la: "Latin" + lad: "Ladino" + lah: "Lahnda" + lam: "Lamba" + lb: "Luxembourgish" + lez: "Lezghian" + lg: "Ganda" + li: "Limburgish" + ln: "Lingala" + lo: "Lao" + lol: "Mongo" + loz: "Lozi" + lt: "Lithuanian" + lu: "Luba-Katanga" + lua: "Luba-Lulua" + lui: "Luiseno" + lun: "Lunda" + luo: "Luo" + lus: "Lushai" + lv: "Latvian" + mad: "Madurese" + mag: "Magahi" + mai: "Maithili" + mak: "Makasar" + man: "Mandingo" + map: "Austronesian Sprog" + mas: "Masai" + mdf: "Moksha" + mdr: "Mandar" + men: "Mende" + mg: "Malagasy" + mga: "Middle Irish" + mh: "Marshallese" + mi: "Maori" + mic: "Micmac" + min: "Minangkabau" + mis: "Miscellaneous Sprog" + mk: "Macedonian" + mkh: "Mon-Khmer Sprog" + ml: "Malayalam" + mn: "Mongolian" + mnc: "Manchu" + mni: "Manipuri" + mno: "Manobo Sprog" + mo: "Moldavian" + moh: "Mohawk" + mos: "Mossi" + mr: "Marathi" + ms: "Malay" + mt: "Maltese" + mul: "Multiple Sprogs" + mun: "Munda Sprog" + mus: "Creek" + mwl: "Mirandese" + mwr: "Marwari" + my: "Burmese" + myn: "Mayan Sprog" + myv: "Erzya" + na: "Nauru" + nah: "Nahuatl" + nai: "North American Indian Sprog" + nap: "Neapolitan" + nb: "Norwegian Bokmål" + nd: "North Ndebele" + nds: "Low German" + ne: "Nepali" + new: "Newari" + ng: "Ndonga" + nia: "Nias" + nic: "Niger-Kordofanian Sprog" + niu: "Niuean" + nl: "Dutch" + "nl-BE": "Flemish" + nn: "Norwegian Nynorsk" + no: "Norwegian" + nog: "Nogai" + non: "Old Norse" + nqo: "N’Ko" + nr: "South Ndebele" + nso: "Northern Sotho" + nub: "Nubian Sprog" + nv: "Navajo" + nwc: "Classical Newari" + ny: "Nyanja" + nym: "Nyamwezi" + nyn: "Nyankole" + nyo: "Nyoro" + nzi: "Nzima" + oc: "Occitan" + oj: "Ojibwa" + om: "Oromo" + or: "Oriya" + os: "Ossetic" + osa: "Osage" + ota: "Ottoman Turkish" + oto: "Otomian Sprog" + pa: "Punjabi" + paa: "Papuan Sprog" + pag: "Pangasinan" + pal: "Pahlavi" + pam: "Pampanga" + pap: "Papiamento" + pau: "Palauan" + peo: "Old Persian" + phi: "Philippine Sprog" + phn: "Phoenician" + pi: "Pali" + pl: "Polish" + pon: "Pohnpeian" + pra: "Prakrit Sprog" + pro: "Old Provençal" + ps: "Pashto" + pt: "Portuguese" + "pt-BR": "Brazilian Portuguese" + "pt-PT": "Iberian Portuguese" + qu: "Quechua" + raj: "Rajasthani" + rap: "Rapanui" + rar: "Rarotongan" + rm: "Rhaeto-Romance" + rn: "Rundi" + ro: "Romanian" + roa: "Romance Sprog" + rom: "Romany" + ru: "Russian" + rup: "Aromanian" + rw: "Kinyarwanda" + sa: "Sanskrit" + sad: "Sandawe" + sah: "Yakut" + sai: "South American Indian Sprog" + sal: "Salishan Sprog" + sam: "Samaritan Aramaic" + sas: "Sasak" + sat: "Santali" + sc: "Sardinian" + scn: "Sicilian" + sco: "Scots" + sd: "Sindhi" + se: "Northern Sami" + sel: "Selkup" + sem: "Semitic Sprog" + sg: "Sango" + sga: "Old Irish" + sgn: "Sign Sprog" + sh: "Serbo-Croatian" + shn: "Shan" + si: "Sinhala" + sid: "Sidamo" + sio: "Siouan Sprog" + sit: "Sino-Tibetan Sprog" + sk: "Slovak" + sl: "Slovenian" + sla: "Slavic Sprog" + sm: "Samoan" + sma: "Southern Sami" + smi: "Sami Sprog" + smj: "Lule Sami" + smn: "Inari Sami" + sms: "Skolt Sami" + sn: "Shona" + snk: "Soninke" + so: "Somali" + sog: "Sogdien" + son: "Songhai" + sq: "Albanian" + sr: "Serbian" + srn: "Sranan Tongo" + srr: "Serer" + ss: "Swati" + ssa: "Nilo-Saharan Sprog" + st: "Southern Sotho" + su: "Sundanese" + suk: "Sukuma" + sus: "Susu" + sux: "Sumerian" + sv: "Swedish" + sw: "Swahili" + syc: "Classical Syriac" + syr: "Syriac" + ta: "Tamil" + tai: "Tai Sprog" + te: "Telugu" + tem: "Timne" + ter: "Tereno" + tet: "Tetum" + tg: "Tajik" + th: "Thai" + ti: "Tigrinya" + tig: "Tigre" + tiv: "Tiv" + tk: "Turkmen" + tkl: "Tokelau" + tl: "Tagalog" + tlh: "Klingon" + tli: "Tlingit" + tmh: "Tamashek" + tn: "Tswana" + to: "Tonga" + tog: "Nyasa Tonga" + tpi: "Tok Pisin" + tr: "Tyrkisk" + trv: "Taroko" + ts: "Tsonga" + tsi: "Tsimshian" + tt: "Tatar" + tum: "Tumbuka" + tup: "Tupi Sprog" + tut: "Altaic Sprog" + tvl: "Tuvalu" + tw: "Twi" + ty: "Tahitian" + tyv: "Tuvinian" + udm: "Udmurt" + ug: "Uighur" + uga: "Ugaritic" + uk: "Ukrainian" + umb: "Umbundu" + und: "Ukendt eller Invalidt Sprog" + ur: "Urdu" + uz: "Uzbek" + vai: "Vai" + ve: "Venda" + vi: "Vietnamese" + vo: "Volapük" + vot: "Votic" + wa: "Walloon" + wak: "Wakashan Sprog" + wal: "Walamo" + war: "Waray" + was: "Washo" + wen: "Sorbian Sprog" + wo: "Wolof" + xal: "Kalmyk" + xh: "Xhosa" + yao: "Yao" + yap: "Yapese" + yi: "Yiddish" + yo: "Yoruba" + ypk: "Yupik Sprog" + za: "Zhuang" + zap: "Zapotec" + zbl: "Blissymbols" + zen: "Zenaga" + zh: "Chinese" + zh-Hans: "Simplified Chinese" + zh-Hant: "Traditional Chinese" + znd: "Zande" + zu: "Zulu" + zun: "Zuni" + zxx: "No linguistic content" + zza: "Zaza" diff --git a/locale/en.rb b/locale/en.rb deleted file mode 100644 index 59ba3b1..0000000 --- a/locale/en.rb +++ /dev/null @@ -1,510 +0,0 @@ -{ - :en => { - :languages => { - :ab => "Abkhazian", - :ace => "Achinese", - :ach => "Acoli", - :ada => "Adangme", - :ady => "Adyghe", - :ae => "Avestan", - :af => "Afrikaans", - :afa => "Afro-Asiatic Language", - :afh => "Afrihili", - :ain => "Ainu", - :ak => "Akan", - :akk => "Akkadian", - :ale => "Aleut", - :alg => "Algonquian Language", - :alt => "Southern Altai", - :am => "Amharic", - :an => "Aragonese", - :ang => "Old English", - :anp => "Angika", - :apa => "Apache Language", - :ar => "Arabic", - :arc => "Aramaic", - :arn => "Araucanian", - :arp => "Arapaho", - :art => "Artificial Language", - :arw => "Arawak", - :as => "Assamese", - :ast => "Asturian", - :ath => "Athapascan Language", - :aus => "Australian Language", - :av => "Avaric", - :awa => "Awadhi", - :ay => "Aymara", - :az => "Azerbaijani", - :ba => "Bashkir", - :bad => "Banda", - :bai => "Bamileke Language", - :bal => "Baluchi", - :ban => "Balinese", - :bas => "Basa", - :bat => "Baltic Language", - :be => "Belarusian", - :bej => "Beja", - :bem => "Bemba", - :ber => "Berber", - :bg => "Bulgarian", - :bh => "Bihari", - :bho => "Bhojpuri", - :bi => "Bislama", - :bik => "Bikol", - :bin => "Bini", - :bla => "Siksika", - :bm => "Bambara", - :bn => "Bengali", - :bnt => "Bantu", - :bo => "Tibetan", - :br => "Breton", - :bra => "Braj", - :bs => "Bosnian", - :btk => "Batak", - :bua => "Buriat", - :bug => "Buginese", - :byn => "Blin", - :ca => "Catalan", - :cad => "Caddo", - :cai => "Central American Indian Language", - :car => "Carib", - :cau => "Caucasian Language", - :cch => "Atsam", - :ce => "Chechen", - :ceb => "Cebuano", - :cel => "Celtic Language", - :ch => "Chamorro", - :chb => "Chibcha", - :chg => "Chagatai", - :chk => "Chuukese", - :chm => "Mari", - :chn => "Chinook Jargon", - :cho => "Choctaw", - :chp => "Chipewyan", - :chr => "Cherokee", - :chy => "Cheyenne", - :cmc => "Chamic Language", - :co => "Corsican", - :cop => "Coptic", - :cpe => "English-based Creole or Pidgin", - :cpf => "French-based Creole or Pidgin", - :cpp => "Portuguese-based Creole or Pidgin", - :cr => "Cree", - :crh => "Crimean Turkish", - :crp => "Creole or Pidgin", - :cs => "Czech", - :csb => "Kashubian", - :cu => "Church Slavic", - :cus => "Cushitic Language", - :cv => "Chuvash", - :cy => "Welsh", - :da => "Danish", - :dak => "Dakota", - :dar => "Dargwa", - :day => "Dayak", - :de => "German", - :"de-AT" => "Austrian German", - :"de-CH" => "Swiss High German", - :del => "Delaware", - :den => "Slave", - :dgr => "Dogrib", - :din => "Dinka", - :doi => "Dogri", - :dra => "Dravidian Language", - :dsb => "Lower Sorbian", - :dua => "Duala", - :dum => "Middle Dutch", - :dv => "Divehi", - :dyu => "Dyula", - :dz => "Dzongkha", - :ee => "Ewe", - :efi => "Efik", - :egy => "Ancient Egyptian", - :eka => "Ekajuk", - :el => "Greek", - :elx => "Elamite", - :en => "English", - :"en-AU" => "Australian English", - :"en-CA" => "Canadian English", - :"en-GB" => "British English", - :"en-US" => "U.S. English", - :enm => "Middle English", - :eo => "Esperanto", - :es => "Spanish", - :"es-ES" => "Iberian Spanish", - :et => "Estonian", - :eu => "Basque", - :ewo => "Ewondo", - :fa => "Persian", - :fan => "Fang", - :fat => "Fanti", - :ff => "Fulah", - :fi => "Finnish", - :fil => "Filipino", - :fiu => "Finno-Ugrian Language", - :fj => "Fijian", - :fo => "Faroese", - :fon => "Fon", - :fr => "French", - :"fr-CA" => "Canadian French", - :"fr-CH" => "Swiss French", - :frm => "Middle French", - :fro => "Old French", - :frr => "Northern Frisian", - :frs => "Eastern Frisian", - :fur => "Friulian", - :fy => "Western Frisian", - :ga => "Irish", - :gaa => "Ga", - :gay => "Gayo", - :gba => "Gbaya", - :gd => "Scottish Gaelic", - :gem => "Germanic Language", - :gez => "Geez", - :gil => "Gilbertese", - :gl => "Galician", - :gmh => "Middle High German", - :gn => "Guarani", - :goh => "Old High German", - :gon => "Gondi", - :gor => "Gorontalo", - :got => "Gothic", - :grb => "Grebo", - :grc => "Ancient Greek", - :gsw => "Swiss German", - :gu => "Gujarati", - :gv => "Manx", - :gwi => "Gwichʼin", - :ha => "Hausa", - :hai => "Haida", - :haw => "Hawaiian", - :he => "Hebrew", - :hi => "Hindi", - :hil => "Hiligaynon", - :him => "Himachali", - :hit => "Hittite", - :hmn => "Hmong", - :ho => "Hiri Motu", - :hr => "Croatian", - :hsb => "Upper Sorbian", - :ht => "Haitian", - :hu => "Hungarian", - :hup => "Hupa", - :hy => "Armenian", - :hz => "Herero", - :ia => "Interlingua", - :iba => "Iban", - :id => "Indonesian", - :ie => "Interlingue", - :ig => "Igbo", - :ii => "Sichuan Yi", - :ijo => "Ijo", - :ik => "Inupiaq", - :ilo => "Iloko", - :inc => "Indic Language", - :ine => "Indo-European Language", - :inh => "Ingush", - :io => "Ido", - :ira => "Iranian Language", - :iro => "Iroquoian Language", - :is => "Icelandic", - :it => "Italian", - :iu => "Inuktitut", - :ja => "Japanese", - :jbo => "Lojban", - :jpr => "Judeo-Persian", - :jrb => "Judeo-Arabic", - :jv => "Javanese", - :ka => "Georgian", - :kaa => "Kara-Kalpak", - :kab => "Kabyle", - :kac => "Kachin", - :kaj => "Jju", - :kam => "Kamba", - :kar => "Karen", - :kaw => "Kawi", - :kbd => "Kabardian", - :kcg => "Tyap", - :kfo => "Koro", - :kg => "Kongo", - :kha => "Khasi", - :khi => "Khoisan Language", - :kho => "Khotanese", - :ki => "Kikuyu", - :kj => "Kuanyama", - :kk => "Kazakh", - :kl => "Kalaallisut", - :km => "Khmer", - :kmb => "Kimbundu", - :kn => "Kannada", - :ko => "Korean", - :kok => "Konkani", - :kos => "Kosraean", - :kpe => "Kpelle", - :kr => "Kanuri", - :krc => "Karachay-Balkar", - :krl => "Karelian", - :kro => "Kru", - :kru => "Kurukh", - :ks => "Kashmiri", - :ku => "Kurdish", - :kum => "Kumyk", - :kut => "Kutenai", - :kv => "Komi", - :kw => "Cornish", - :ky => "Kirghiz", - :la => "Latin", - :lad => "Ladino", - :lah => "Lahnda", - :lam => "Lamba", - :lb => "Luxembourgish", - :lez => "Lezghian", - :lg => "Ganda", - :li => "Limburgish", - :ln => "Lingala", - :lo => "Lao", - :lol => "Mongo", - :loz => "Lozi", - :lt => "Lithuanian", - :lu => "Luba-Katanga", - :lua => "Luba-Lulua", - :lui => "Luiseno", - :lun => "Lunda", - :luo => "Luo", - :lus => "Lushai", - :lv => "Latvian", - :mad => "Madurese", - :mag => "Magahi", - :mai => "Maithili", - :mak => "Makasar", - :man => "Mandingo", - :map => "Austronesian Language", - :mas => "Masai", - :mdf => "Moksha", - :mdr => "Mandar", - :men => "Mende", - :mg => "Malagasy", - :mga => "Middle Irish", - :mh => "Marshallese", - :mi => "Maori", - :mic => "Micmac", - :min => "Minangkabau", - :mis => "Miscellaneous Language", - :mk => "Macedonian", - :mkh => "Mon-Khmer Language", - :ml => "Malayalam", - :mn => "Mongolian", - :mnc => "Manchu", - :mni => "Manipuri", - :mno => "Manobo Language", - :mo => "Moldavian", - :moh => "Mohawk", - :mos => "Mossi", - :mr => "Marathi", - :ms => "Malay", - :mt => "Maltese", - :mul => "Multiple Languages", - :mun => "Munda Language", - :mus => "Creek", - :mwl => "Mirandese", - :mwr => "Marwari", - :my => "Burmese", - :myn => "Mayan Language", - :myv => "Erzya", - :na => "Nauru", - :nah => "Nahuatl", - :nai => "North American Indian Language", - :nap => "Neapolitan", - :nb => "Norwegian Bokmål", - :nd => "North Ndebele", - :nds => "Low German", - :ne => "Nepali", - :new => "Newari", - :ng => "Ndonga", - :nia => "Nias", - :nic => "Niger-Kordofanian Language", - :niu => "Niuean", - :nl => "Dutch", - :"nl-BE" => "Flemish", - :nn => "Norwegian Nynorsk", - :no => "Norwegian", - :nog => "Nogai", - :non => "Old Norse", - :nqo => "N’Ko", - :nr => "South Ndebele", - :nso => "Northern Sotho", - :nub => "Nubian Language", - :nv => "Navajo", - :nwc => "Classical Newari", - :ny => "Nyanja", - :nym => "Nyamwezi", - :nyn => "Nyankole", - :nyo => "Nyoro", - :nzi => "Nzima", - :oc => "Occitan", - :oj => "Ojibwa", - :om => "Oromo", - :or => "Oriya", - :os => "Ossetic", - :osa => "Osage", - :ota => "Ottoman Turkish", - :oto => "Otomian Language", - :pa => "Punjabi", - :paa => "Papuan Language", - :pag => "Pangasinan", - :pal => "Pahlavi", - :pam => "Pampanga", - :pap => "Papiamento", - :pau => "Palauan", - :peo => "Old Persian", - :phi => "Philippine Language", - :phn => "Phoenician", - :pi => "Pali", - :pl => "Polish", - :pon => "Pohnpeian", - :pra => "Prakrit Language", - :pro => "Old Provençal", - :ps => "Pashto", - :pt => "Portuguese", - :"pt-BR" => "Brazilian Portuguese", - :"pt-PT" => "Iberian Portuguese", - :qu => "Quechua", - :raj => "Rajasthani", - :rap => "Rapanui", - :rar => "Rarotongan", - :rm => "Rhaeto-Romance", - :rn => "Rundi", - :ro => "Romanian", - :roa => "Romance Language", - :rom => "Romany", - :ru => "Russian", - :rup => "Aromanian", - :rw => "Kinyarwanda", - :sa => "Sanskrit", - :sad => "Sandawe", - :sah => "Yakut", - :sai => "South American Indian Language", - :sal => "Salishan Language", - :sam => "Samaritan Aramaic", - :sas => "Sasak", - :sat => "Santali", - :sc => "Sardinian", - :scn => "Sicilian", - :sco => "Scots", - :sd => "Sindhi", - :se => "Northern Sami", - :sel => "Selkup", - :sem => "Semitic Language", - :sg => "Sango", - :sga => "Old Irish", - :sgn => "Sign Language", - :sh => "Serbo-Croatian", - :shn => "Shan", - :si => "Sinhala", - :sid => "Sidamo", - :sio => "Siouan Language", - :sit => "Sino-Tibetan Language", - :sk => "Slovak", - :sl => "Slovenian", - :sla => "Slavic Language", - :sm => "Samoan", - :sma => "Southern Sami", - :smi => "Sami Language", - :smj => "Lule Sami", - :smn => "Inari Sami", - :sms => "Skolt Sami", - :sn => "Shona", - :snk => "Soninke", - :so => "Somali", - :sog => "Sogdien", - :son => "Songhai", - :sq => "Albanian", - :sr => "Serbian", - :srn => "Sranan Tongo", - :srr => "Serer", - :ss => "Swati", - :ssa => "Nilo-Saharan Language", - :st => "Southern Sotho", - :su => "Sundanese", - :suk => "Sukuma", - :sus => "Susu", - :sux => "Sumerian", - :sv => "Swedish", - :sw => "Swahili", - :syc => "Classical Syriac", - :syr => "Syriac", - :ta => "Tamil", - :tai => "Tai Language", - :te => "Telugu", - :tem => "Timne", - :ter => "Tereno", - :tet => "Tetum", - :tg => "Tajik", - :th => "Thai", - :ti => "Tigrinya", - :tig => "Tigre", - :tiv => "Tiv", - :tk => "Turkmen", - :tkl => "Tokelau", - :tl => "Tagalog", - :tlh => "Klingon", - :tli => "Tlingit", - :tmh => "Tamashek", - :tn => "Tswana", - :to => "Tonga", - :tog => "Nyasa Tonga", - :tpi => "Tok Pisin", - :tr => "Turkish", - :trv => "Taroko", - :ts => "Tsonga", - :tsi => "Tsimshian", - :tt => "Tatar", - :tum => "Tumbuka", - :tup => "Tupi Language", - :tut => "Altaic Language", - :tvl => "Tuvalu", - :tw => "Twi", - :ty => "Tahitian", - :tyv => "Tuvinian", - :udm => "Udmurt", - :ug => "Uighur", - :uga => "Ugaritic", - :uk => "Ukrainian", - :umb => "Umbundu", - :und => "Unknown or Invalid Language", - :ur => "Urdu", - :uz => "Uzbek", - :vai => "Vai", - :ve => "Venda", - :vi => "Vietnamese", - :vo => "Volapük", - :vot => "Votic", - :wa => "Walloon", - :wak => "Wakashan Language", - :wal => "Walamo", - :war => "Waray", - :was => "Washo", - :wen => "Sorbian Language", - :wo => "Wolof", - :xal => "Kalmyk", - :xh => "Xhosa", - :yao => "Yao", - :yap => "Yapese", - :yi => "Yiddish", - :yo => "Yoruba", - :ypk => "Yupik Language", - :za => "Zhuang", - :zap => "Zapotec", - :zbl => "Blissymbols", - :zen => "Zenaga", - :zh => "Chinese", - :"zh-Hans" => "Simplified Chinese", - :"zh-Hant" => "Traditional Chinese", - :znd => "Zande", - :zu => "Zulu", - :zun => "Zuni", - :zxx => "No linguistic content", - :zza => "Zaza", - } - } -} diff --git a/locale/en.yml b/locale/en.yml new file mode 100644 index 0000000..d3e233d --- /dev/null +++ b/locale/en.yml @@ -0,0 +1,506 @@ +en: + languages: + ab: "Abkhazian" + ace: "Achinese" + ach: "Acoli" + ada: "Adangme" + ady: "Adyghe" + ae: "Avestan" + af: "Afrikaans" + afa: "Afro-Asiatic Language" + afh: "Afrihili" + ain: "Ainu" + ak: "Akan" + akk: "Akkadian" + ale: "Aleut" + alg: "Algonquian Language" + alt: "Southern Altai" + am: "Amharic" + an: "Aragonese" + ang: "Old English" + anp: "Angika" + apa: "Apache Language" + ar: "Arabic" + arc: "Aramaic" + arn: "Araucanian" + arp: "Arapaho" + art: "Artificial Language" + arw: "Arawak" + as: "Assamese" + ast: "Asturian" + ath: "Athapascan Language" + aus: "Australian Language" + av: "Avaric" + awa: "Awadhi" + ay: "Aymara" + az: "Azerbaijani" + ba: "Bashkir" + bad: "Banda" + bai: "Bamileke Language" + bal: "Baluchi" + ban: "Balinese" + bas: "Basa" + bat: "Baltic Language" + be: "Belarusian" + bej: "Beja" + bem: "Bemba" + ber: "Berber" + bg: "Bulgarian" + bh: "Bihari" + bho: "Bhojpuri" + bi: "Bislama" + bik: "Bikol" + bin: "Bini" + bla: "Siksika" + bm: "Bambara" + bn: "Bengali" + bnt: "Bantu" + bo: "Tibetan" + br: "Breton" + bra: "Braj" + bs: "Bosnian" + btk: "Batak" + bua: "Buriat" + bug: "Buginese" + byn: "Blin" + ca: "Catalan" + cad: "Caddo" + cai: "Central American Indian Language" + car: "Carib" + cau: "Caucasian Language" + cch: "Atsam" + ce: "Chechen" + ceb: "Cebuano" + cel: "Celtic Language" + ch: "Chamorro" + chb: "Chibcha" + chg: "Chagatai" + chk: "Chuukese" + chm: "Mari" + chn: "Chinook Jargon" + cho: "Choctaw" + chp: "Chipewyan" + chr: "Cherokee" + chy: "Cheyenne" + cmc: "Chamic Language" + co: "Corsican" + cop: "Coptic" + cpe: "English-based Creole or Pidgin" + cpf: "French-based Creole or Pidgin" + cpp: "Portuguese-based Creole or Pidgin" + cr: "Cree" + crh: "Crimean Turkish" + crp: "Creole or Pidgin" + cs: "Czech" + csb: "Kashubian" + cu: "Church Slavic" + cus: "Cushitic Language" + cv: "Chuvash" + cy: "Welsh" + da: "Danish" + dak: "Dakota" + dar: "Dargwa" + day: "Dayak" + de: "German" + "de-AT": "Austrian German" + "de-CH": "Swiss High German" + del: "Delaware" + den: "Slave" + dgr: "Dogrib" + din: "Dinka" + doi: "Dogri" + dra: "Dravidian Language" + dsb: "Lower Sorbian" + dua: "Duala" + dum: "Middle Dutch" + dv: "Divehi" + dyu: "Dyula" + dz: "Dzongkha" + ee: "Ewe" + efi: "Efik" + egy: "Ancient Egyptian" + eka: "Ekajuk" + el: "Greek" + elx: "Elamite" + en: "English" + "en-AU": "Australian English" + "en-CA": "Canadian English" + "en-GB": "British English" + "en-US": "U.S. English" + enm: "Middle English" + eo: "Esperanto" + es: "Spanish" + "es-ES": "Iberian Spanish" + et: "Estonian" + eu: "Basque" + ewo: "Ewondo" + fa: "Persian" + fan: "Fang" + fat: "Fanti" + ff: "Fulah" + fi: "Finnish" + fil: "Filipino" + fiu: "Finno-Ugrian Language" + fj: "Fijian" + fo: "Faroese" + fon: "Fon" + fr: "French" + "fr-CA": "Canadian French" + "fr-CH": "Swiss French" + frm: "Middle French" + fro: "Old French" + frr: "Northern Frisian" + frs: "Eastern Frisian" + fur: "Friulian" + fy: "Western Frisian" + ga: "Irish" + gaa: "Ga" + gay: "Gayo" + gba: "Gbaya" + gd: "Scottish Gaelic" + gem: "Germanic Language" + gez: "Geez" + gil: "Gilbertese" + gl: "Galician" + gmh: "Middle High German" + gn: "Guarani" + goh: "Old High German" + gon: "Gondi" + gor: "Gorontalo" + got: "Gothic" + grb: "Grebo" + grc: "Ancient Greek" + gsw: "Swiss German" + gu: "Gujarati" + gv: "Manx" + gwi: "Gwichʼin" + ha: "Hausa" + hai: "Haida" + haw: "Hawaiian" + he: "Hebrew" + hi: "Hindi" + hil: "Hiligaynon" + him: "Himachali" + hit: "Hittite" + hmn: "Hmong" + ho: "Hiri Motu" + hr: "Croatian" + hsb: "Upper Sorbian" + ht: "Haitian" + hu: "Hungarian" + hup: "Hupa" + hy: "Armenian" + hz: "Herero" + ia: "Interlingua" + iba: "Iban" + id: "Indonesian" + ie: "Interlingue" + ig: "Igbo" + ii: "Sichuan Yi" + ijo: "Ijo" + ik: "Inupiaq" + ilo: "Iloko" + inc: "Indic Language" + ine: "Indo-European Language" + inh: "Ingush" + io: "Ido" + ira: "Iranian Language" + iro: "Iroquoian Language" + is: "Icelandic" + it: "Italian" + iu: "Inuktitut" + ja: "Japanese" + jbo: "Lojban" + jpr: "Judeo-Persian" + jrb: "Judeo-Arabic" + jv: "Javanese" + ka: "Georgian" + kaa: "Kara-Kalpak" + kab: "Kabyle" + kac: "Kachin" + kaj: "Jju" + kam: "Kamba" + kar: "Karen" + kaw: "Kawi" + kbd: "Kabardian" + kcg: "Tyap" + kfo: "Koro" + kg: "Kongo" + kha: "Khasi" + khi: "Khoisan Language" + kho: "Khotanese" + ki: "Kikuyu" + kj: "Kuanyama" + kk: "Kazakh" + kl: "Kalaallisut" + km: "Khmer" + kmb: "Kimbundu" + kn: "Kannada" + ko: "Korean" + kok: "Konkani" + kos: "Kosraean" + kpe: "Kpelle" + kr: "Kanuri" + krc: "Karachay-Balkar" + krl: "Karelian" + kro: "Kru" + kru: "Kurukh" + ks: "Kashmiri" + ku: "Kurdish" + kum: "Kumyk" + kut: "Kutenai" + kv: "Komi" + kw: "Cornish" + ky: "Kirghiz" + la: "Latin" + lad: "Ladino" + lah: "Lahnda" + lam: "Lamba" + lb: "Luxembourgish" + lez: "Lezghian" + lg: "Ganda" + li: "Limburgish" + ln: "Lingala" + lo: "Lao" + lol: "Mongo" + loz: "Lozi" + lt: "Lithuanian" + lu: "Luba-Katanga" + lua: "Luba-Lulua" + lui: "Luiseno" + lun: "Lunda" + luo: "Luo" + lus: "Lushai" + lv: "Latvian" + mad: "Madurese" + mag: "Magahi" + mai: "Maithili" + mak: "Makasar" + man: "Mandingo" + map: "Austronesian Language" + mas: "Masai" + mdf: "Moksha" + mdr: "Mandar" + men: "Mende" + mg: "Malagasy" + mga: "Middle Irish" + mh: "Marshallese" + mi: "Maori" + mic: "Micmac" + min: "Minangkabau" + mis: "Miscellaneous Language" + mk: "Macedonian" + mkh: "Mon-Khmer Language" + ml: "Malayalam" + mn: "Mongolian" + mnc: "Manchu" + mni: "Manipuri" + mno: "Manobo Language" + mo: "Moldavian" + moh: "Mohawk" + mos: "Mossi" + mr: "Marathi" + ms: "Malay" + mt: "Maltese" + mul: "Multiple Languages" + mun: "Munda Language" + mus: "Creek" + mwl: "Mirandese" + mwr: "Marwari" + my: "Burmese" + myn: "Mayan Language" + myv: "Erzya" + na: "Nauru" + nah: "Nahuatl" + nai: "North American Indian Language" + nap: "Neapolitan" + nb: "Norwegian Bokmål" + nd: "North Ndebele" + nds: "Low German" + ne: "Nepali" + new: "Newari" + ng: "Ndonga" + nia: "Nias" + nic: "Niger-Kordofanian Language" + niu: "Niuean" + nl: "Dutch" + "nl-BE": "Flemish" + nn: "Norwegian Nynorsk" + no: "Norwegian" + nog: "Nogai" + non: "Old Norse" + nqo: "N’Ko" + nr: "South Ndebele" + nso: "Northern Sotho" + nub: "Nubian Language" + nv: "Navajo" + nwc: "Classical Newari" + ny: "Nyanja" + nym: "Nyamwezi" + nyn: "Nyankole" + nyo: "Nyoro" + nzi: "Nzima" + oc: "Occitan" + oj: "Ojibwa" + om: "Oromo" + or: "Oriya" + os: "Ossetic" + osa: "Osage" + ota: "Ottoman Turkish" + oto: "Otomian Language" + pa: "Punjabi" + paa: "Papuan Language" + pag: "Pangasinan" + pal: "Pahlavi" + pam: "Pampanga" + pap: "Papiamento" + pau: "Palauan" + peo: "Old Persian" + phi: "Philippine Language" + phn: "Phoenician" + pi: "Pali" + pl: "Polish" + pon: "Pohnpeian" + pra: "Prakrit Language" + pro: "Old Provençal" + ps: "Pashto" + pt: "Portuguese" + "pt-BR": "Brazilian Portuguese" + "pt-PT": "Iberian Portuguese" + qu: "Quechua" + raj: "Rajasthani" + rap: "Rapanui" + rar: "Rarotongan" + rm: "Rhaeto-Romance" + rn: "Rundi" + ro: "Romanian" + roa: "Romance Language" + rom: "Romany" + ru: "Russian" + rup: "Aromanian" + rw: "Kinyarwanda" + sa: "Sanskrit" + sad: "Sandawe" + sah: "Yakut" + sai: "South American Indian Language" + sal: "Salishan Language" + sam: "Samaritan Aramaic" + sas: "Sasak" + sat: "Santali" + sc: "Sardinian" + scn: "Sicilian" + sco: "Scots" + sd: "Sindhi" + se: "Northern Sami" + sel: "Selkup" + sem: "Semitic Language" + sg: "Sango" + sga: "Old Irish" + sgn: "Sign Language" + sh: "Serbo-Croatian" + shn: "Shan" + si: "Sinhala" + sid: "Sidamo" + sio: "Siouan Language" + sit: "Sino-Tibetan Language" + sk: "Slovak" + sl: "Slovenian" + sla: "Slavic Language" + sm: "Samoan" + sma: "Southern Sami" + smi: "Sami Language" + smj: "Lule Sami" + smn: "Inari Sami" + sms: "Skolt Sami" + sn: "Shona" + snk: "Soninke" + so: "Somali" + sog: "Sogdien" + son: "Songhai" + sq: "Albanian" + sr: "Serbian" + srn: "Sranan Tongo" + srr: "Serer" + ss: "Swati" + ssa: "Nilo-Saharan Language" + st: "Southern Sotho" + su: "Sundanese" + suk: "Sukuma" + sus: "Susu" + sux: "Sumerian" + sv: "Swedish" + sw: "Swahili" + syc: "Classical Syriac" + syr: "Syriac" + ta: "Tamil" + tai: "Tai Language" + te: "Telugu" + tem: "Timne" + ter: "Tereno" + tet: "Tetum" + tg: "Tajik" + th: "Thai" + ti: "Tigrinya" + tig: "Tigre" + tiv: "Tiv" + tk: "Turkmen" + tkl: "Tokelau" + tl: "Tagalog" + tlh: "Klingon" + tli: "Tlingit" + tmh: "Tamashek" + tn: "Tswana" + to: "Tonga" + tog: "Nyasa Tonga" + tpi: "Tok Pisin" + tr: "Turkish" + trv: "Taroko" + ts: "Tsonga" + tsi: "Tsimshian" + tt: "Tatar" + tum: "Tumbuka" + tup: "Tupi Language" + tut: "Altaic Language" + tvl: "Tuvalu" + tw: "Twi" + ty: "Tahitian" + tyv: "Tuvinian" + udm: "Udmurt" + ug: "Uighur" + uga: "Ugaritic" + uk: "Ukrainian" + umb: "Umbundu" + und: "Unknown or Invalid Language" + ur: "Urdu" + uz: "Uzbek" + vai: "Vai" + ve: "Venda" + vi: "Vietnamese" + vo: "Volapük" + vot: "Votic" + wa: "Walloon" + wak: "Wakashan Language" + wal: "Walamo" + war: "Waray" + was: "Washo" + wen: "Sorbian Language" + wo: "Wolof" + xal: "Kalmyk" + xh: "Xhosa" + yao: "Yao" + yap: "Yapese" + yi: "Yiddish" + yo: "Yoruba" + ypk: "Yupik Language" + za: "Zhuang" + zap: "Zapotec" + zbl: "Blissymbols" + zen: "Zenaga" + zh: "Chinese" + zh-Hans: "Simplified Chinese" + zh-Hant: "Traditional Chinese" + znd: "Zande" + zu: "Zulu" + zun: "Zuni" + zxx: "No linguistic content" + zza: "Zaza"
davec/localized_language_select
b3747ad2df6293de1bfd12919e876d0193d2b89b
created gemspec
diff --git a/.gitignore b/.gitignore index dce082c..6ff956b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,46 @@ # rcov generated coverage # rdoc generated rdoc # yard generated doc .yardoc # bundler .bundle # jeweler generated -pkg -pkg/* +pkg +pkg/*.gem + +# custom +sandbox # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: # # * Create a file at ~/.gitignore # * Include files you want ignored # * Run: git config --global core.excludesfile ~/.gitignore # # After doing this, these files will be ignored in all your git projects, # saving you from having to 'pollute' every project you touch with them # # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) # # For MacOS: # -#.DS_Store +.DS_Store # # For TextMate -#*.tmproj -#tmtags +*.tmproj +tmtags # # For emacs: #*~ #\#* #.\#* # # For vim: #*.swp diff --git a/localized_language_select.gemspec b/localized_language_select.gemspec new file mode 100644 index 0000000..7343100 --- /dev/null +++ b/localized_language_select.gemspec @@ -0,0 +1,73 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{localized_language_select} + s.version = "0.1.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Kristian Mandrup"] + s.date = %q{2011-01-14} + s.description = %q{Localized language select for Rails 2.3+ with options to control languages to display} + s.email = %q{[email protected]} + s.extra_rdoc_files = [ + "README.textile" + ] + s.files = [ + "Gemfile", + "Gemfile.lock", + "MIT-LICENSE", + "README.textile", + "Rakefile", + "VERSION", + "init.rb", + "install.rb", + "lib/localized_language_select.rb", + "locale/en.rb", + "locale/fr.rb", + "locale/nl.rb", + "pkg/localized_language_select-0.1.0.gem", + "tasks/localized_language_select_tasks.rake", + "test/localized_language_select_test.rb", + "uninstall.rb" + ] + s.homepage = %q{http://github.com/kristianmandrup/localized_language_select} + s.licenses = ["MIT"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Localized language select for Rails 2.3+} + s.test_files = [ + "test/localized_language_select_test.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) + s.add_development_dependency(%q<rspec>, [">= 2.3.0"]) + s.add_development_dependency(%q<bundler>, ["~> 1.0.0"]) + s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"]) + s.add_development_dependency(%q<rcov>, [">= 0"]) + s.add_runtime_dependency(%q<rails>, [">= 2.3.5"]) + else + s.add_dependency(%q<rails>, [">= 2.3.5"]) + s.add_dependency(%q<rspec>, [">= 2.3.0"]) + s.add_dependency(%q<bundler>, ["~> 1.0.0"]) + s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) + s.add_dependency(%q<rcov>, [">= 0"]) + s.add_dependency(%q<rails>, [">= 2.3.5"]) + end + else + s.add_dependency(%q<rails>, [">= 2.3.5"]) + s.add_dependency(%q<rspec>, [">= 2.3.0"]) + s.add_dependency(%q<bundler>, ["~> 1.0.0"]) + s.add_dependency(%q<jeweler>, ["~> 1.5.2"]) + s.add_dependency(%q<rcov>, [">= 0"]) + s.add_dependency(%q<rails>, [">= 2.3.5"]) + end +end + diff --git a/pkg/localized_language_select-0.1.0.gem b/pkg/localized_language_select-0.1.0.gem deleted file mode 100644 index 1d0578a..0000000 Binary files a/pkg/localized_language_select-0.1.0.gem and /dev/null differ
davec/localized_language_select
1696e17fa3cee495a7f9f0f92ee6bbf4ec407f64
added ignore
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2288186 --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# rcov generated +coverage + +# rdoc generated +rdoc + +# yard generated +doc +.yardoc + +# bundler +.bundle + +# jeweler generated +pkg + +# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: +# +# * Create a file at ~/.gitignore +# * Include files you want ignored +# * Run: git config --global core.excludesfile ~/.gitignore +# +# After doing this, these files will be ignored in all your git projects, +# saving you from having to 'pollute' every project you touch with them +# +# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) +# +# For MacOS: +# +#.DS_Store +# +# For TextMate +#*.tmproj +#tmtags +# +# For emacs: +#*~ +#\#* +#.\#* +# +# For vim: +#*.swp diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..60b7adf --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,90 @@ +GEM + remote: http://rubygems.org/ + specs: + abstract (1.0.0) + actionmailer (3.0.3) + actionpack (= 3.0.3) + mail (~> 2.2.9) + actionpack (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.4) + rack (~> 1.2.1) + rack-mount (~> 0.6.13) + rack-test (~> 0.5.6) + tzinfo (~> 0.3.23) + activemodel (3.0.3) + activesupport (= 3.0.3) + builder (~> 2.1.2) + i18n (~> 0.4) + activerecord (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) + activesupport (3.0.3) + arel (2.0.6) + builder (2.1.2) + diff-lcs (1.1.2) + erubis (2.6.6) + abstract (>= 1.0.0) + git (1.2.5) + i18n (0.5.0) + jeweler (1.5.2) + bundler (~> 1.0.0) + git (>= 1.2.5) + rake + mail (2.2.14) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + polyglot (0.3.1) + rack (1.2.1) + rack-mount (0.6.13) + rack (>= 1.0.0) + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.3) + actionmailer (= 3.0.3) + actionpack (= 3.0.3) + activerecord (= 3.0.3) + activeresource (= 3.0.3) + activesupport (= 3.0.3) + bundler (~> 1.0) + railties (= 3.0.3) + railties (3.0.3) + actionpack (= 3.0.3) + activesupport (= 3.0.3) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.8.7) + rcov (0.9.9) + rspec (2.4.0) + rspec-core (~> 2.4.0) + rspec-expectations (~> 2.4.0) + rspec-mocks (~> 2.4.0) + rspec-core (2.4.0) + rspec-expectations (2.4.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.4.0) + thor (0.14.6) + treetop (1.4.9) + polyglot (>= 0.3.1) + tzinfo (0.3.23) + +PLATFORMS + ruby + +DEPENDENCIES + bundler (~> 1.0.0) + jeweler (~> 1.5.2) + rails (>= 2.3.5) + rcov + rspec (>= 2.3.0) diff --git a/VERSION.yml b/VERSION similarity index 100% rename from VERSION.yml rename to VERSION diff --git a/pkg/localized_language_select-0.1.0.gem b/pkg/localized_language_select-0.1.0.gem new file mode 100644 index 0000000..150a43b Binary files /dev/null and b/pkg/localized_language_select-0.1.0.gem differ
davec/localized_language_select
784641ceddd8de6aa4a2ff00823dca8a70c4be0b
converted to gem
diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..eb41536 --- /dev/null +++ b/Gemfile @@ -0,0 +1,15 @@ +source "http://rubygems.org" +# Add dependencies required to use your gem here. +# Example: +# gem "activesupport", ">= 2.3.5" + +gem "rails", ">= 2.3.5" + +# Add dependencies to develop your gem here. +# Include everything needed to run rake, tests, features, etc. +group :development do + gem "rspec", ">= 2.3.0" + gem "bundler", "~> 1.0.0" + gem "jeweler", "~> 1.5.2" + gem "rcov", ">= 0" +end diff --git a/README.textile b/README.textile index 5404a45..f100f8b 100644 --- a/README.textile +++ b/README.textile @@ -1,71 +1,91 @@ h1. LocalizedLanguageSelect Rails plugin to provide support for localized <tt><select></tt> menu with language names and for storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database. Uses the Rails internationalization framework ("I18n":http://rails-i18n.org) for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value. You can easily translate language codes in your application like this: <pre> <%= I18n.t @user.language, :scope => 'languages' %> </pre> Comes with a Rake task <tt>rake import:language_select locale=de</tt> for importing language names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) Don't forget to restart the application when you add new locale. The code borrows heavily from the LocalizedCountrySelect plugin. See "localized_country_select":http://github.com/karmi/localized_country_select h2. Install & Usage +Install as plugin: + <pre>$ rails plugin install https://github.com/kristianmandrup/localized_language_select.git</pre> -It should be converted into a gem... +Install as gem: + +Insert in Gemfile + +<pre>gem 'localized_language_select'</pre> -h2. Example +Then run: + +<pre>$ bundle install</pre> + +h2. Usage example <pre> <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %> </pre> will become: <pre> <select name="user[language]" id="user_language"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="aa">Afar</option> ... <option value="zza">ZaZa</option> </select> </pre> for the <tt>en</tt> locale. h2. Options @:exclude@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :exclude => ['Afrikaans']) %> </pre> @:only@ option <pre> <%= localized_language_select(:user, :language, ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> </pre> h2. Framework usage This plugin should also integrate nicely with various formbuilders, including Formtastic +Formtastic example: + +<pre> +<%= semantic_form_for @user do |form| %> + ... + <%= form.input :lang, :as => :language, :priority_languages => ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %> + ... +<% end %> +</pre> + h2. Copyright Copyright (c) 2009 David Cato, released under the MIT license diff --git a/Rakefile b/Rakefile index a63ca93..b32c382 100644 --- a/Rakefile +++ b/Rakefile @@ -1,24 +1,50 @@ +require 'rubygems' +require 'bundler' +begin + Bundler.setup(:default, :development) +rescue Bundler::BundlerError => e + $stderr.puts e.message + $stderr.puts "Run `bundle install` to install missing gems" + exit e.status_code +end require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' -load File.join(File.dirname(__FILE__), 'tasks', 'localized_language_select_tasks.rake') +require 'jeweler' +Jeweler::Tasks.new do |gem| + # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options + gem.name = "localized_language_select" + gem.homepage = "http://github.com/kristianmandrup/localized_language_select" + gem.license = "MIT" + gem.summary = %Q{Localized language select for Rails 2.3+} + gem.description = %Q{Localized language select for Rails 2.3+ with options to control languages to display} + gem.email = "[email protected]" + gem.authors = ["Kristian Mandrup"] + # Include your dependencies below. Runtime dependencies are required when using your gem, + # and development dependencies are only needed for development (ie running rake tasks, tests, etc) -desc 'Default: run unit tests.' -task :default => :test + gem.add_runtime_dependency 'rails', '>= 2.3.5' +end +Jeweler::RubygemsDotOrgTasks.new + +require 'rspec/core' +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) do |spec| + spec.pattern = FileList['spec/**/*_spec.rb'] +end -desc 'Test the localized_language_select plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true +RSpec::Core::RakeTask.new(:rcov) do |spec| + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true end -desc 'Generate documentation for the localized_language_select plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| +task :default => :spec + +require 'rake/rdoctask' +Rake::RDocTask.new do |rdoc| + version = File.exist?('VERSION') ? File.read('VERSION') : "" + rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'LocalizedLanguageSelect' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README.rdoc') + rdoc.title = "localized_language_select #{version}" + rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') -end +end \ No newline at end of file diff --git a/VERSION.yml b/VERSION.yml new file mode 100644 index 0000000..6c6aa7c --- /dev/null +++ b/VERSION.yml @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file
davec/localized_language_select
7bbc4f430a9932fbdd826ebb37c8086f585414b6
added :except and :include options to control which languages are displayed
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index 7a8ddd9..2219e10 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,98 +1,114 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags - def localized_languages_array - I18n.translate(:languages).map { |key, value| [value, key.to_s] }.sort + def localized_languages_array options = {} + res = [] + list = I18n.translate(:languages).each do |key, value| + res << [value, key.to_s.upcase] if include_language?(key.to_s, options) + end + res.sort_by { |country| country.first.parameterize } end + + def include_language?(key, options) + if options[:only] + return options[:only].include?(key) + end + if options[:except] + return !options[:except].include?(key) + end + true + end + + # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first - def localized_language_options_for_select(selected = nil, priority_languages = nil) + def localized_language_options_for_select(selected = nil, priority_languages = nil, options = {}) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end - return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array, selected) + return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( - localized_language_options_for_select(value, priority_languages), + localized_language_options_for_select(value, priority_languages, options), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/test/localized_language_select_test.rb b/test/localized_language_select_test.rb index df17523..b820851 100644 --- a/test/localized_language_select_test.rb +++ b/test/localized_language_select_test.rb @@ -1,93 +1,113 @@ # -*- coding: utf-8 -*- require 'test/unit' require 'rubygems' require 'active_support' require 'action_controller' -require 'action_controller/test_process' +# require 'action_controller/test_process' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/tag_helper' require 'i18n' require 'localized_language_select' class LocalizedLanguageSelectTest < Test::Unit::TestCase include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::TagHelper def test_action_view_should_include_helper_for_object assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select') assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select') end def test_action_view_should_include_helper_tag assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag') end def test_should_return_select_tag_with_proper_name_for_object assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')), "Should have proper name for object" end def test_should_return_select_tag_with_proper_name assert localized_language_select_tag( "competition_submission[data][language]", nil) =~ Regexp.new( Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ), "Should have proper name" end def test_should_return_option_tags assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>')) end def test_should_return_localized_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>')) end def test_should_return_localized_country_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es-ES">espagnol ibérique</option>')) end def test_should_return_priority_languages_first assert localized_language_options_for_select(nil, [:es, :fr]) =~ Regexp.new( Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) end def test_i18n_should_know_about_languages assert_equal 'Spanish', I18n.t('es', :scope => 'languages') I18n.locale = 'fr' assert_equal 'espagnol', I18n.t('es', :scope => 'languages') end def test_localized_languages_array_returns_correctly assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() } I18n.locale = 'en' assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'Abkhazian', LocalizedLanguageSelect::localized_languages_array.first[0] I18n.locale = 'fr' assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size assert_equal 'abkhaze', LocalizedLanguageSelect::localized_languages_array.first[0] end def test_priority_languages_returns_correctly_and_in_correct_order assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) } I18n.locale = 'en' assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) end - private + def test_include_country_rejects_on_except_option + res = !LocalizedLanguageSelect::include_language?('af', except: ['af']) + puts "should not include_language? '' except af : #{res}" + end + + def test_include_country_accept_on_only_option + res = LocalizedLanguageSelect::include_language?('af', only: ['af']) + puts "should include_language? 'af' : #{res}" + + res = !LocalizedLanguageSelect::include_language?('af', only: ['ad']) + puts "should not include_language? 'af' : #{res}" + end + + def test_localized_countries_array_rejects_on_except_option + list = LocalizedLanguageSelect::localized_languages_array(:except => ['af']) + res = !list.include?(['Afrikaans', 'af']) + puts "rejected 'af' from array? #{res}" + end + + + # private def setup ['fr', 'en'].each do |locale| # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :) I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ] end I18n.locale = 'en' end end
davec/localized_language_select
ddc2408ce6c4769f6f22ec5cd2b0b93287ac5b2e
Don't downcase the language tags. Closes #1
diff --git a/lib/localized_language_select.rb b/lib/localized_language_select.rb index d4d1621..7a8ddd9 100644 --- a/lib/localized_language_select.rb +++ b/lib/localized_language_select.rb @@ -1,98 +1,98 @@ # = LocalizedLanguageSelect # # View helper for displaying select list with languages: # # localized_language_select(:user, :language) # # Works just like the default Rails' +country_select+ plugin, but stores languages as # language *codes*, not *names*, in the database. # # You can easily translate language codes in your application like this: # <%= I18n.t @user.language, :scope => 'languages' %> # # Uses the Rails internationalization framework (I18n) for translating the names of languages. # # Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names # from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) # # The code borrows heavily from the LocalizedCountrySelect plugin. # See http://github.com/karmi/localized_country_select # module LocalizedLanguageSelect class << self # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>) # for <tt><option></tt> tags def localized_languages_array - I18n.translate(:languages).map { |key, value| [value, key.to_s.downcase] }.sort + I18n.translate(:languages).map { |key, value| [value, key.to_s] }.sort end # Return array with codes and localized language names for array of language codes passed as argument # == Example # priority_languages_array([:de, :fr, :en]) # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ] def priority_languages_array(language_codes=[]) languages = I18n.translate(:languages) language_codes.map { |code| [languages[code], code.to_s.downcase] } end end end module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using +localized_language_options_for_select+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {}) InstanceTag.new(object, method, self, options.delete(:object)). to_localized_language_select_tag(priority_languages, options, html_options) end # Return "named" select and option tags according to given arguments. # Use +selected_value+ for setting initial value # It behaves likes older object-binded brother +localized_language_select+ otherwise # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {}) content_tag :select, localized_language_options_for_select(selected_value, priority_languages), { "name" => name, "id" => name }.update(html_options.stringify_keys) end # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de') # as +selected+ to have it marked as the selected option tag. # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first def localized_language_options_for_select(selected = nil, priority_languages = nil) language_options = "" if priority_languages language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected) language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" end return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array, selected) end end class InstanceTag def to_localized_language_select_tag(priority_languages, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) value = value(object) content_tag("select", add_options( localized_language_options_for_select(value, priority_languages), options, value ), html_options ) end end class FormBuilder def localized_language_select(method, priority_languages = nil, options = {}, html_options = {}) @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options) end end end end diff --git a/test/localized_language_select_test.rb b/test/localized_language_select_test.rb index d4c6cc1..df17523 100644 --- a/test/localized_language_select_test.rb +++ b/test/localized_language_select_test.rb @@ -1,86 +1,93 @@ +# -*- coding: utf-8 -*- require 'test/unit' require 'rubygems' require 'active_support' require 'action_controller' require 'action_controller/test_process' require 'action_view' +require 'action_view/helpers' require 'action_view/helpers/tag_helper' require 'i18n' require 'localized_language_select' class LocalizedLanguageSelectTest < Test::Unit::TestCase include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::TagHelper def test_action_view_should_include_helper_for_object assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select') assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select') end def test_action_view_should_include_helper_tag assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag') end def test_should_return_select_tag_with_proper_name_for_object assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')), "Should have proper name for object" end def test_should_return_select_tag_with_proper_name assert localized_language_select_tag( "competition_submission[data][language]", nil) =~ Regexp.new( Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ), "Should have proper name" end def test_should_return_option_tags assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>')) end def test_should_return_localized_option_tags I18n.locale = 'fr' assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>')) end + def test_should_return_localized_country_option_tags + I18n.locale = 'fr' + assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es-ES">espagnol ibérique</option>')) + end + def test_should_return_priority_languages_first assert localized_language_options_for_select(nil, [:es, :fr]) =~ Regexp.new( - Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"aa\">Afar</option>\n")) + Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"ab\">Abkhazian</option>\n")) end def test_i18n_should_know_about_languages assert_equal 'Spanish', I18n.t('es', :scope => 'languages') I18n.locale = 'fr' assert_equal 'espagnol', I18n.t('es', :scope => 'languages') end def test_localized_languages_array_returns_correctly assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() } I18n.locale = 'en' assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size - assert_equal 'Afar', LocalizedLanguageSelect::localized_languages_array.first[0] + assert_equal 'Abkhazian', LocalizedLanguageSelect::localized_languages_array.first[0] I18n.locale = 'fr' assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size - assert_equal 'afar', LocalizedLanguageSelect::localized_languages_array.first[0] + assert_equal 'abkhaze', LocalizedLanguageSelect::localized_languages_array.first[0] end def test_priority_languages_returns_correctly_and_in_correct_order assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) } I18n.locale = 'en' assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) end private def setup ['fr', 'en'].each do |locale| # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :) I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ] end I18n.locale = 'en' end end
davec/localized_language_select
47ed1cf1ca74b858924e7bf125fc1f891715d19e
Adjust rake task invocation
diff --git a/README.rdoc b/README.rdoc index 7894514..58d8e22 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,37 +1,37 @@ = LocalizedLanguageSelect Rails plugin to provide support for localized <tt><select></tt> menu with language names and for storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database. Uses the Rails internationalization framework (I18n, http://rails-i18n.org) for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value. You can easily translate language codes in your application like this: <%= I18n.t @user.language, :scope => 'languages' %> -Comes with a Rake task <tt>rake import:language_select 'de'</tt> for importing language names +Comes with a Rake task <tt>rake import:language_select locale=de</tt> for importing language names from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html) Don't forget to restart the application when you add new locale. The code borrows heavily from the LocalizedCountrySelect plugin. See http://github.com/karmi/localized_country_select == Example <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %> will become: <select name="user[language]" id="user_language"> <option value="">Please choose...</option> <option disabled="disabled" value="">-------------</option> <option value="aa">Afar</option> ... <option value="zza">ZaZa</option> </select> for the <tt>en</tt> locale. Copyright (c) 2009 David Cato, released under the MIT license diff --git a/tasks/localized_language_select_tasks.rake b/tasks/localized_language_select_tasks.rake index ab545c6..b78054b 100644 --- a/tasks/localized_language_select_tasks.rake +++ b/tasks/localized_language_select_tasks.rake @@ -1,87 +1,87 @@ require 'rubygems' require 'hpricot' require 'open-uri' # Rake task for importing language names from Unicode.org's CLDR repository # (http://www.unicode.org/cldr/data/charts/summary/root.html). # # It parses a HTML file from Unicode.org for given locale and saves the # Rails' I18n hash in the plugin +locale+ directory # # Don't forget to restart the application when you add new locale to load it into Rails! # # == Example -# rake import:language_select 'de' +# rake import:language_select locale=de # # The code is deliberately procedural and simple, so it's easily # understandable by beginners as an introduction to Rake tasks power. # See http://github.com/joshmh/cldr/tree/master/converter.rb for much more robust solution namespace :import do desc "Import language codes and names for various languages from the Unicode.org CLDR archive. Depends on Hpricot gem." task :language_select do # TODO : Implement locale import chooser from CLDR root via Highline # Setup variables - locale = ARGV[1] + locale = ENV['locale'] unless locale - puts "\n[!] Usage: rake import:language_select de\n\n" + puts "\n[!] Usage: rake import:language_select locale=de\n\n" exit 0 end # ----- Get the CLDR HTML -------------------------------------------------- begin puts "... getting the HTML file for locale '#{locale}'" doc = Hpricot( open("http://www.unicode.org/cldr/data/charts/summary/#{locale}.html") ) rescue => e puts "[!] Invalid locale name '#{locale}'! Not found in CLDR (#{e})" exit 0 end require 'ruby-debug' # ----- Parse the HTML with Hpricot ---------------------------------------- puts "... parsing the HTML file" languages = [] doc.search("//tr").each do |row| if row.search("td[@class='n']") && row.search("td[@class='n']").inner_html =~ /^nameslanguage$/ && row.search("td[@class='g']").inner_html =~ /^[a-z]{2,3}(?:_([A-Z][a-z]{3}))?(?:_([A-Z]{2}))?$/ code = row.search("td[@class='g']").inner_text code.sub!('_','-') #debugger if code =~ /-/ name = row.search("td[@class='v']").first.inner_text languages << { :code => code.to_sym, :name => name.to_s } print " ... #{name}" end end # ----- Prepare the output format ------------------------------------------ output =<<HEAD { :#{locale} => { :languages => { HEAD languages.each do |language| output << " #{language[:code].inspect} => \"#{language[:name]}\",\n" end output <<<<TAIL } } } TAIL # ----- Write the parsed values into file --------------------------------- puts "\n... writing the output" filename = File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") filename += '.NEW' if File.exists?(filename) # Append 'NEW' if file exists File.open(filename, 'w+') { |f| f << output } puts "\n---\nWritten values for the '#{locale}' into file: #{filename}\n" # ------------------------------------------------------------------------------ end end
qdot/twitter_breakcore
9d19ff7316c395d5669f63c399f0eb568a2e08dd
Importing projects directory to svn
diff --git a/testfile.txt b/testfile.txt new file mode 100755 index 0000000..583f695 --- /dev/null +++ b/testfile.txt @@ -0,0 +1,25 @@ +Just Triumph, looped over and over +anyone who'd ignore the first album is no friend of mine. +i think it was springsteen that said that. +i don't know much past the first couple of albums. i am bad at keeping up with things. +yeah, everything i'm throwing on so far is 2000 or earlier. +i've got it down to 860 megs, but now it's like pulling teeth trying to cut it down. +feh +feh, indeed. +i completely forgot aout the tiki thing today +but i'm not in much shape for more out at thisp oint +too tired? +woosh +weez +yeah, mostly feeling vaguely queasy +that sucks +hello there. +i spent a week tha way before leaving +that way +eep +and, it's fourtwenty +taht'd probably fix the queasienss but woudln't help the tired, and i'm not equipped +i have one very bored cat here. and me without a laser pointer. +my laser pointer is out of batteries +i think bored spencer is better than agitated spencer anyway +http://m.assetbar.com/achewood/uua9mPPHn diff --git a/twitter.py b/twitter.py new file mode 100755 index 0000000..9da7739 --- /dev/null +++ b/twitter.py @@ -0,0 +1,1524 @@ +#!/usr/bin/python +# +# Copyright 2007 Google Inc. All Rights Reserved. + +'''A library that provides a python interface to the Twitter API''' + +__author__ = '[email protected]' +__version__ = '0.5' + + +import base64 +import md5 +import os +import simplejson +import sys +import tempfile +import time +import urllib +import urllib2 +import urlparse +import twitter + +class TwitterError(Exception): + '''Base class for Twitter errors''' + + +class Status(object): + '''A class representing the Status structure used by the twitter API. + + The Status structure exposes the following properties: + + status.created_at + status.created_at_in_seconds # read only + status.id + status.text + status.relative_created_at # read only + status.user + ''' + def __init__(self, + created_at=None, + id=None, + text=None, + user=None, + now=None): + '''An object to hold a Twitter status message. + + This class is normally instantiated by the twitter.Api class and + returned in a sequence. + + Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" + + Args: + created_at: The time this status message was posted + id: The unique id of this status message + text: The text of this status message + relative_created_at: + A human readable string representing the posting time + user: + A twitter.User instance representing the person posting the message + now: + The current time, if the client choses to set it. Defaults to the + wall clock time. + ''' + self.created_at = created_at + self.id = id + self.text = text + self.user = user + self.now = now + + def GetCreatedAt(self): + '''Get the time this status message was posted. + + Returns: + The time this status message was posted + ''' + return self._created_at + + def SetCreatedAt(self, created_at): + '''Set the time this status message was posted. + + Args: + created_at: The time this status message was created + ''' + self._created_at = created_at + + created_at = property(GetCreatedAt, SetCreatedAt, + doc='The time this status message was posted.') + + def GetCreatedAtInSeconds(self): + '''Get the time this status message was posted, in seconds since the epoch. + + Returns: + The time this status message was posted, in seconds since the epoch. + ''' + return time.mktime(time.strptime(self.created_at, '%a %b %d %H:%M:%S +0000 %Y')) + + created_at_in_seconds = property(GetCreatedAtInSeconds, + doc="The time this status message was " + "posted, in seconds since the epoch") + + def GetId(self): + '''Get the unique id of this status message. + + Returns: + The unique id of this status message + ''' + return self._id + + def SetId(self, id): + '''Set the unique id of this status message. + + Args: + id: The unique id of this status message + ''' + self._id = id + + id = property(GetId, SetId, + doc='The unique id of this status message.') + + def GetText(self): + '''Get the text of this status message. + + Returns: + The text of this status message. + ''' + return self._text + + def SetText(self, text): + '''Set the text of this status message. + + Args: + text: The text of this status message + ''' + self._text = text + + text = property(GetText, SetText, + doc='The text of this status message') + + def GetRelativeCreatedAt(self): + '''Get a human redable string representing the posting time + + Returns: + A human readable string representing the posting time + ''' + fudge = 1.25 + delta = int(self.now) - int(self.created_at_in_seconds) + + if delta < (1 * fudge): + return 'about a second ago' + elif delta < (60 * (1/fudge)): + return 'about %d seconds ago' % (delta) + elif delta < (60 * fudge): + return 'about a minute ago' + elif delta < (60 * 60 * (1/fudge)): + return 'about %d minutes ago' % (delta / 60) + elif delta < (60 * 60 * fudge): + return 'about an hour ago' + elif delta < (60 * 60 * 24 * (1/fudge)): + return 'about %d hours ago' % (delta / (60 * 60)) + elif delta < (60 * 60 * 24 * fudge): + return 'about a day ago' + else: + return 'about %d days ago' % (delta / (60 * 60 * 24)) + + relative_created_at = property(GetRelativeCreatedAt, + doc='Get a human readable string representing' + 'the posting time') + + def GetUser(self): + '''Get a twitter.User reprenting the entity posting this status message. + + Returns: + A twitter.User reprenting the entity posting this status message + ''' + return self._user + + def SetUser(self, user): + '''Set a twitter.User reprenting the entity posting this status message. + + Args: + user: A twitter.User reprenting the entity posting this status message + ''' + self._user = user + + user = property(GetUser, SetUser, + doc='A twitter.User reprenting the entity posting this ' + 'status message') + + def GetNow(self): + '''Get the wallclock time for this status message. + + Used to calculate relative_created_at. Defaults to the time + the object was instantiated. + + Returns: + Whatever the status instance believes the current time to be, + in seconds since the epoch. + ''' + if self._now is None: + self._now = time.mktime(time.gmtime()) + return self._now + + def SetNow(self, now): + '''Set the wallclock time for this status message. + + Used to calculate relative_created_at. Defaults to the time + the object was instantiated. + + Args: + now: The wallclock time for this instance. + ''' + self._now = now + + now = property(GetNow, SetNow, + doc='The wallclock time for this status instance.') + + + def __ne__(self, other): + return not self.__eq__(other) + + def __eq__(self, other): + try: + return other and \ + self.created_at == other.created_at and \ + self.id == other.id and \ + self.text == other.text and \ + self.user == other.user + except AttributeError: + return False + + def __str__(self): + '''A string representation of this twitter.Status instance. + + The return value is the same as the JSON string representation. + + Returns: + A string representation of this twitter.Status instance. + ''' + return self.AsJsonString() + + def AsJsonString(self): + '''A JSON string representation of this twitter.Status instance. + + Returns: + A JSON string representation of this twitter.Status instance + ''' + return simplejson.dumps(self.AsDict(), sort_keys=True) + + def AsDict(self): + '''A dict representation of this twitter.Status instance. + + The return value uses the same key names as the JSON representation. + + Return: + A dict representing this twitter.Status instance + ''' + data = {} + if self.created_at: + data['created_at'] = self.created_at + if self.id: + data['id'] = self.id + if self.text: + data['text'] = self.text + if self.user: + data['user'] = self.user.AsDict() + return data + + @staticmethod + def NewFromJsonDict(data): + '''Create a new instance based on a JSON dict. + + Args: + data: A JSON dict, as converted from the JSON in the twitter API + Returns: + A twitter.Status instance + ''' + if 'user' in data: + user = User.NewFromJsonDict(data['user']) + else: + user = None + return Status(created_at=data.get('created_at', None), + id=data.get('id', None), + text=data.get('text', None), + user=user) + + +class User(object): + '''A class representing the User structure used by the twitter API. + + The User structure exposes the following properties: + + user.id + user.name + user.screen_name + user.location + user.description + user.profile_image_url + user.url + user.status + ''' + def __init__(self, + id=None, + name=None, + screen_name=None, + location=None, + description=None, + profile_image_url=None, + url=None, + status=None): + self.id = id + self.name = name + self.screen_name = screen_name + self.location = location + self.description = description + self.profile_image_url = profile_image_url + self.url = url + self.status = status + + + def GetId(self): + '''Get the unique id of this user. + + Returns: + The unique id of this user + ''' + return self._id + + def SetId(self, id): + '''Set the unique id of this user. + + Args: + id: The unique id of this user. + ''' + self._id = id + + id = property(GetId, SetId, + doc='The unique id of this user.') + + def GetName(self): + '''Get the real name of this user. + + Returns: + The real name of this user + ''' + return self._name + + def SetName(self, name): + '''Set the real name of this user. + + Args: + name: The real name of this user + ''' + self._name = name + + name = property(GetName, SetName, + doc='The real name of this user.') + + def GetScreenName(self): + '''Get the short username of this user. + + Returns: + The short username of this user + ''' + return self._screen_name + + def SetScreenName(self, screen_name): + '''Set the short username of this user. + + Args: + screen_name: the short username of this user + ''' + self._screen_name = screen_name + + screen_name = property(GetScreenName, SetScreenName, + doc='The short username of this user.') + + def GetLocation(self): + '''Get the geographic location of this user. + + Returns: + The geographic location of this user + ''' + return self._location + + def SetLocation(self, location): + '''Set the geographic location of this user. + + Args: + location: The geographic location of this user + ''' + self._location = location + + location = property(GetLocation, SetLocation, + doc='The geographic location of this user.') + + def GetDescription(self): + '''Get the short text description of this user. + + Returns: + The short text description of this user + ''' + return self._description + + def SetDescription(self, description): + '''Set the short text description of this user. + + Args: + description: The short text description of this user + ''' + self._description = description + + description = property(GetDescription, SetDescription, + doc='The short text description of this user.') + + def GetUrl(self): + '''Get the homepage url of this user. + + Returns: + The homepage url of this user + ''' + return self._url + + def SetUrl(self, url): + '''Set the homepage url of this user. + + Args: + url: The homepage url of this user + ''' + self._url = url + + url = property(GetUrl, SetUrl, + doc='The homepage url of this user.') + + def GetProfileImageUrl(self): + '''Get the url of the thumbnail of this user. + + Returns: + The url of the thumbnail of this user + ''' + return self._profile_image_url + + def SetProfileImageUrl(self, profile_image_url): + '''Set the url of the thumbnail of this user. + + Args: + profile_image_url: The url of the thumbnail of this user + ''' + self._profile_image_url = profile_image_url + + profile_image_url= property(GetProfileImageUrl, SetProfileImageUrl, + doc='The url of the thumbnail of this user.') + + def GetStatus(self): + '''Get the latest twitter.Status of this user. + + Returns: + The latest twitter.Status of this user + ''' + return self._status + + def SetStatus(self, status): + '''Set the latest twitter.Status of this user. + + Args: + status: The latest twitter.Status of this user + ''' + self._status = status + + status = property(GetStatus, SetStatus, + doc='The latest twitter.Status of this user.') + + def __ne__(self, other): + return not self.__eq__(other) + + def __eq__(self, other): + try: + return other and \ + self.id == other.id and \ + self.name == other.name and \ + self.screen_name == other.screen_name and \ + self.location == other.location and \ + self.description == other.description and \ + self.profile_image_url == other.profile_image_url and \ + self.url == other.url and \ + self.status == other.status + except AttributeError: + return False + + def __str__(self): + '''A string representation of this twitter.User instance. + + The return value is the same as the JSON string representation. + + Returns: + A string representation of this twitter.User instance. + ''' + return self.AsJsonString() + + def AsJsonString(self): + '''A JSON string representation of this twitter.User instance. + + Returns: + A JSON string representation of this twitter.User instance + ''' + return simplejson.dumps(self.AsDict(), sort_keys=True) + + def AsDict(self): + '''A dict representation of this twitter.User instance. + + The return value uses the same key names as the JSON representation. + + Return: + A dict representing this twitter.User instance + ''' + data = {} + if self.id: + data['id'] = self.id + if self.name: + data['name'] = self.name + if self.screen_name: + data['screen_name'] = self.screen_name + if self.location: + data['location'] = self.location + if self.description: + data['description'] = self.description + if self.profile_image_url: + data['profile_image_url'] = self.profile_image_url + if self.url: + data['url'] = self.url + if self.status: + data['status'] = self.status.AsDict() + return data + + @staticmethod + def NewFromJsonDict(data): + '''Create a new instance based on a JSON dict. + + Args: + data: A JSON dict, as converted from the JSON in the twitter API + Returns: + A twitter.User instance + ''' + if 'status' in data: + status = Status.NewFromJsonDict(data['status']) + else: + status = None + return User(id=data.get('id', None), + name=data.get('name', None), + screen_name=data.get('screen_name', None), + location=data.get('location', None), + description=data.get('description', None), + profile_image_url=data.get('profile_image_url', None), + url=data.get('url', None), + status=status) + +class DirectMessage(object): + '''A class representing the DirectMessage structure used by the twitter API. + + The DirectMessage structure exposes the following properties: + + direct_message.id + direct_message.created_at + direct_message.created_at_in_seconds # read only + direct_message.sender_id + direct_message.sender_screen_name + direct_message.recipient_id + direct_message.recipient_screen_name + direct_message.text + ''' + + def __init__(self, + id=None, + created_at=None, + sender_id=None, + sender_screen_name=None, + recipient_id=None, + recipient_screen_name=None, + text=None): + '''An object to hold a Twitter direct message. + + This class is normally instantiated by the twitter.Api class and + returned in a sequence. + + Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" + + Args: + id: The unique id of this direct message + created_at: The time this direct message was posted + sender_id: The id of the twitter user that sent this message + sender_screen_name: The name of the twitter user that sent this message + recipient_id: The id of the twitter that received this message + recipient_screen_name: The name of the twitter that received this message + text: The text of this direct message + ''' + self.id = id + self.created_at = created_at + self.sender_id = sender_id + self.sender_screen_name = sender_screen_name + self.recipient_id = recipient_id + self.recipient_screen_name = recipient_screen_name + self.text = text + + def GetId(self): + '''Get the unique id of this direct message. + + Returns: + The unique id of this direct message + ''' + return self._id + + def SetId(self, id): + '''Set the unique id of this direct message. + + Args: + id: The unique id of this direct message + ''' + self._id = id + + id = property(GetId, SetId, + doc='The unique id of this direct message.') + + def GetCreatedAt(self): + '''Get the time this direct message was posted. + + Returns: + The time this direct message was posted + ''' + return self._created_at + + def SetCreatedAt(self, created_at): + '''Set the time this direct message was posted. + + Args: + created_at: The time this direct message was created + ''' + self._created_at = created_at + + created_at = property(GetCreatedAt, SetCreatedAt, + doc='The time this direct message was posted.') + + def GetCreatedAtInSeconds(self): + '''Get the time this direct message was posted, in seconds since the epoch. + + Returns: + The time this direct message was posted, in seconds since the epoch. + ''' + return time.mktime(time.strptime(self.created_at, '%a %b %d %H:%M:%S +0000 %Y')) + + created_at_in_seconds = property(GetCreatedAtInSeconds, + doc="The time this direct message was " + "posted, in seconds since the epoch") + + def GetSenderId(self): + '''Get the unique sender id of this direct message. + + Returns: + The unique sender id of this direct message + ''' + return self._sender_id + + def SetSenderId(self, sender_id): + '''Set the unique sender id of this direct message. + + Args: + sender id: The unique sender id of this direct message + ''' + self._sender_id = sender_id + + sender_id = property(GetSenderId, SetSenderId, + doc='The unique sender id of this direct message.') + + def GetSenderScreenName(self): + '''Get the unique sender screen name of this direct message. + + Returns: + The unique sender screen name of this direct message + ''' + return self._sender_screen_name + + def SetSenderScreenName(self, sender_screen_name): + '''Set the unique sender screen name of this direct message. + + Args: + sender_screen_name: The unique sender screen name of this direct message + ''' + self._sender_screen_name = sender_screen_name + + sender_screen_name = property(GetSenderScreenName, SetSenderScreenName, + doc='The unique sender screen name of this direct message.') + + def GetRecipientId(self): + '''Get the unique recipient id of this direct message. + + Returns: + The unique recipient id of this direct message + ''' + return self._recipient_id + + def SetRecipientId(self, recipient_id): + '''Set the unique recipient id of this direct message. + + Args: + recipient id: The unique recipient id of this direct message + ''' + self._recipient_id = recipient_id + + recipient_id = property(GetRecipientId, SetRecipientId, + doc='The unique recipient id of this direct message.') + + def GetRecipientScreenName(self): + '''Get the unique recipient screen name of this direct message. + + Returns: + The unique recipient screen name of this direct message + ''' + return self._recipient_screen_name + + def SetRecipientScreenName(self, recipient_screen_name): + '''Set the unique recipient screen name of this direct message. + + Args: + recipient_screen_name: The unique recipient screen name of this direct message + ''' + self._recipient_screen_name = recipient_screen_name + + recipient_screen_name = property(GetRecipientScreenName, SetRecipientScreenName, + doc='The unique recipient screen name of this direct message.') + + def GetText(self): + '''Get the text of this direct message. + + Returns: + The text of this direct message. + ''' + return self._text + + def SetText(self, text): + '''Set the text of this direct message. + + Args: + text: The text of this direct message + ''' + self._text = text + + text = property(GetText, SetText, + doc='The text of this direct message') + + def __ne__(self, other): + return not self.__eq__(other) + + def __eq__(self, other): + try: + return other and \ + self.id == other.id and \ + self.created_at == other.created_at and \ + self.sender_id == other.sender_id and \ + self.sender_screen_name == other.sender_screen_name and \ + self.recipient_id == other.recipient_id and \ + self.recipient_screen_name == other.recipient_screen_name and \ + self.text == other.text + except AttributeError: + return False + + def __str__(self): + '''A string representation of this twitter.DirectMessage instance. + + The return value is the same as the JSON string representation. + + Returns: + A string representation of this twitter.DirectMessage instance. + ''' + return self.AsJsonString() + + def AsJsonString(self): + '''A JSON string representation of this twitter.DirectMessage instance. + + Returns: + A JSON string representation of this twitter.DirectMessage instance + ''' + return simplejson.dumps(self.AsDict(), sort_keys=True) + + def AsDict(self): + '''A dict representation of this twitter.DirectMessage instance. + + The return value uses the same key names as the JSON representation. + + Return: + A dict representing this twitter.DirectMessage instance + ''' + data = {} + if self.id: + data['id'] = self.id + if self.created_at: + data['created_at'] = self.created_at + if self.sender_id: + data['sender_id'] = self.sender_id + if self.sender_screen_name: + data['sender_screen_name'] = self.sender_screen_name + if self.recipient_id: + data['recipient_id'] = self.recipient_id + if self.recipient_screen_name: + data['recipient_screen_name'] = self.recipient_screen_name + if self.text: + data['text'] = self.text + return data + + @staticmethod + def NewFromJsonDict(data): + '''Create a new instance based on a JSON dict. + + Args: + data: A JSON dict, as converted from the JSON in the twitter API + Returns: + A twitter.DirectMessage instance + ''' + return DirectMessage(created_at=data.get('created_at', None), + recipient_id=data.get('recipient_id', None), + sender_id=data.get('sender_id', None), + text=data.get('text', None), + sender_screen_name=data.get('sender_screen_name', None), + id=data.get('id', None), + recipient_screen_name=data.get('recipient_screen_name', None)) + +class Api(object): + '''A python interface into the Twitter API + + By default, the Api caches results for 1 minute. + + Example usage: + + To create an instance of the twitter.Api class, with no authentication: + + >>> import twitter + >>> api = twitter.Api() + + To fetch the most recently posted public twitter status messages: + + >>> statuses = api.GetPublicTimeline() + >>> print [s.user.name for s in statuses] + [u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone'] #... + + To fetch a single user's public status messages, where "user" is either + a Twitter "short name" or their user id. + + >>> statuses = api.GetUserTimeline(user) + >>> print [s.text for s in statuses] + + To use authentication, instantiate the twitter.Api class with a + username and password: + + >>> api = twitter.Api(username='twitter user', password='twitter pass') + + To fetch your friends (after being authenticated): + + >>> users = api.GetFriends() + >>> print [u.name for u in users] + + To post a twitter status message (after being authenticated): + + >>> status = api.PostUpdate('I love python-twitter!') + >>> print status.text + I love python-twitter! + + There are many other methods, including: + + >>> api.PostDirectMessage(user, text) + >>> api.GetUser(user) + >>> api.GetReplies() + >>> api.GetUserTimeline(user) + >>> api.GetStatus(id) + >>> api.DestroyStatus(id) + >>> api.GetFriendsTimeline(user) + >>> api.GetFriends(user) + >>> api.GetFollowers() + >>> api.GetFeatured() + >>> api.GetDirectMessages() + >>> api.PostDirectMessage(user, text) + >>> api.DestroyDirectMessage(id) + >>> api.DestroyFriendship(user) + >>> api.CreateFriendship(user) + ''' + + DEFAULT_CACHE_TIMEOUT = 60 # cache for 1 minute + + _API_REALM = 'Twitter API' + + def __init__(self, + username=None, + password=None, + input_encoding=None, + request_headers=None): + '''Instantiate a new twitter.Api object. + + Args: + username: The username of the twitter account. [optional] + password: The password for the twitter account. [optional] + input_encoding: The encoding used to encode input strings. [optional] + request_header: A dictionary of additional HTTP request headers. [optional] + ''' + self._cache = _FileCache() + self._urllib = urllib2 + self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT + self._InitializeRequestHeaders(request_headers) + self._InitializeUserAgent() + self._input_encoding = input_encoding + self.SetCredentials(username, password) + + def GetPublicTimeline(self, since_id=None): + '''Fetch the sequnce of public twitter.Status message for all users. + + Args: + since_id: + Returns only public statuses with an ID greater than (that is, + more recent than) the specified ID. [Optional] + + Returns: + An sequence of twitter.Status instances, one for each message + ''' + parameters = {} + if since_id: + parameters['since_id'] = since_id + url = 'http://twitter.com/statuses/public_timeline.json' + json = self._FetchUrl(url, parameters=parameters) + data = simplejson.loads(json) + return [Status.NewFromJsonDict(x) for x in data] + + def GetFriendsTimeline(self, user=None, since=None): + '''Fetch the sequence of twitter.Status messages for a user's friends + + The twitter.Api instance must be authenticated if the user is private. + + Args: + user: + Specifies the ID or screen name of the user for whom to return + the friends_timeline. If unspecified, the username and password + must be set in the twitter.Api instance. [optional] + since: + Narrows the returned results to just those statuses created + after the specified HTTP-formatted date. [optional] + + Returns: + A sequence of twitter.Status instances, one for each message + ''' + if user: + url = 'http://twitter.com/statuses/friends_timeline/%s.json' % user + elif not user and not self._username: + raise TwitterError("User must be specified if API is not authenticated.") + else: + url = 'http://twitter.com/statuses/friends_timeline.json' + parameters = {} + if since: + parameters['since'] = since + json = self._FetchUrl(url, parameters=parameters) + data = simplejson.loads(json) + return [Status.NewFromJsonDict(x) for x in data] + + def GetUserTimeline(self, user=None, count=None, since=None): + '''Fetch the sequence of public twitter.Status messages for a single user. + + The twitter.Api instance must be authenticated if the user is private. + + Args: + user: + either the username (short_name) or id of the user to retrieve. If + not specified, then the current authenticated user is used. [optional] + count: the number of status messages to retrieve [optional] + since: + Narrows the returned results to just those statuses created + after the specified HTTP-formatted date. [optional] + + Returns: + A sequence of twitter.Status instances, one for each message up to count + ''' + try: + if count: + int(count) + except: + raise TwitterError("Count must be an integer") + parameters = {} + if count: + parameters['count'] = count + if since: + parameters['since'] = since + if user: + url = 'http://twitter.com/statuses/user_timeline/%s.json' % user + elif not user and not self._username: + raise TwitterError("User must be specified if API is not authenticated.") + else: + url = 'http://twitter.com/statuses/user_timeline.json' + json = self._FetchUrl(url, parameters=parameters) + data = simplejson.loads(json) + return [Status.NewFromJsonDict(x) for x in data] + + def GetStatus(self, id): + '''Returns a single status message. + + The twitter.Api instance must be authenticated if the status message is private. + + Args: + id: The numerical ID of the status you're trying to retrieve. + + Returns: + A twitter.Status instance representing that status message + ''' + try: + if id: + int(id) + except: + raise TwitterError("id must be an integer") + url = 'http://twitter.com/statuses/show/%s.json' % id + json = self._FetchUrl(url) + data = simplejson.loads(json) + return Status.NewFromJsonDict(data) + + def DestroyStatus(self, id): + '''Destroys the status specified by the required ID parameter. + + The twitter.Api instance must be authenticated and thee + authenticating user must be the author of the specified status. + + Args: + id: The numerical ID of the status you're trying to destroy. + + Returns: + A twitter.Status instance representing the destroyed status message + ''' + try: + if id: + int(id) + except: + raise TwitterError("id must be an integer") + url = 'http://twitter.com/statuses/destroy/%s.json' % id + json = self._FetchUrl(url, post_data={}) + data = simplejson.loads(json) + return Status.NewFromJsonDict(data) + + def PostUpdate(self, text): + '''Post a twitter status message from the authenticated user. + + The twitter.Api instance must be authenticated. + + Args: + text: The message text to be posted. Must be less than 140 characters. + + Returns: + A twitter.Status instance representing the message posted + ''' + if not self._username: + raise TwitterError("The twitter.Api instance must be authenticated.") + if len(text) > 140: + raise TwitterError("Text must be less than or equal to 140 characters.") + url = 'http://twitter.com/statuses/update.json' + data = {'status': text} + json = self._FetchUrl(url, post_data=data) + data = simplejson.loads(json) + return Status.NewFromJsonDict(data) + + def GetReplies(self): + '''Get a sequence of status messages representing the 20 most recent + replies (status updates prefixed with @username) to the authenticating + user. + + Returns: + A sequence of twitter.Status instances, one for each reply to the user. + ''' + url = 'http://twitter.com/statuses/replies.json' + if not self._username: + raise TwitterError("The twitter.Api instance must be authenticated.") + json = self._FetchUrl(url) + data = simplejson.loads(json) + return [Status.NewFromJsonDict(x) for x in data] + + def GetFriends(self, user=None): + '''Fetch the sequence of twitter.User instances, one for each friend. + + Args: + user: the username or id of the user whose friends you are fetching. If + not specified, defaults to the authenticated user. [optional] + + The twitter.Api instance must be authenticated. + + Returns: + A sequence of twitter.User instances, one for each friend + ''' + if not self._username: + raise TwitterError("twitter.Api instance must be authenticated") + if user: + url = 'http://twitter.com/statuses/friends/%s.json' % user + else: + url = 'http://twitter.com/statuses/friends.json' + json = self._FetchUrl(url) + data = simplejson.loads(json) + return [User.NewFromJsonDict(x) for x in data] + + def GetFollowers(self): + '''Fetch the sequence of twitter.User instances, one for each follower + + The twitter.Api instance must be authenticated. + + Returns: + A sequence of twitter.User instances, one for each follower + ''' + if not self._username: + raise TwitterError("twitter.Api instance must be authenticated") + url = 'http://twitter.com/statuses/followers.json' + json = self._FetchUrl(url) + data = simplejson.loads(json) + return [User.NewFromJsonDict(x) for x in data] + + def GetFeatured(self): + '''Fetch the sequence of twitter.User instances featured on twitter.com + + The twitter.Api instance must be authenticated. + + Returns: + A sequence of twitter.User instances + ''' + url = 'http://twitter.com/statuses/featured.json' + json = self._FetchUrl(url) + data = simplejson.loads(json) + return [User.NewFromJsonDict(x) for x in data] + + def GetUser(self, user): + '''Returns a single user. + + The twitter.Api instance must be authenticated. + + Args: + user: The username or id of the user to retrieve. + + Returns: + A twitter.User instance representing that user + ''' + url = 'http://twitter.com/users/show/%s.json' % user + json = self._FetchUrl(url) + data = simplejson.loads(json) + return User.NewFromJsonDict(data) + + def GetDirectMessages(self, since=None): + '''Returns a list of the direct messages sent to the authenticating user. + + The twitter.Api instance must be authenticated. + + Args: + since: + Narrows the returned results to just those statuses created + after the specified HTTP-formatted date. [optional] + + Returns: + A sequence of twitter.DirectMessage instances + ''' + url = 'http://twitter.com/direct_messages.json' + if not self._username: + raise TwitterError("The twitter.Api instance must be authenticated.") + parameters = {} + if since: + parameters['since'] = since + json = self._FetchUrl(url, parameters=parameters) + data = simplejson.loads(json) + return [DirectMessage.NewFromJsonDict(x) for x in data] + + def PostDirectMessage(self, user, text): + '''Post a twitter direct message from the authenticated user + + The twitter.Api instance must be authenticated. + + Args: + user: The ID or screen name of the recipient user. + text: The message text to be posted. Must be less than 140 characters. + + Returns: + A twitter.DirectMessage instance representing the message posted + ''' + if not self._username: + raise TwitterError("The twitter.Api instance must be authenticated.") + url = 'http://twitter.com/direct_messages/new.json' + data = {'text': text, 'user': user} + json = self._FetchUrl(url, post_data=data) + data = simplejson.loads(json) + return DirectMessage.NewFromJsonDict(data) + + def DestroyDirectMessage(self, id): + '''Destroys the direct message specified in the required ID parameter. + + The twitter.Api instance must be authenticated, and the + authenticating user must be the recipient of the specified direct + message. + + Args: + id: The id of the direct message to be destroyed + + Returns: + A twitter.DirectMessage instance representing the message destroyed + ''' + url = 'http://twitter.com/direct_messages/destroy/%s.json' % id + json = self._FetchUrl(url, post_data={}) + data = simplejson.loads(json) + return DirectMessage.NewFromJsonDict(data) + + def CreateFriendship(self, user): + '''Befriends the user specified in the user parameter as the authenticating user. + + The twitter.Api instance must be authenticated. + + Args: + The ID or screen name of the user to befriend. + Returns: + A twitter.User instance representing the befriended user. + ''' + url = 'http://twitter.com/friendships/create/%s.json' % user + json = self._FetchUrl(url, post_data={}) + data = simplejson.loads(json) + return User.NewFromJsonDict(data) + + def DestroyFriendship(self, user): + '''Discontinues friendship with the user specified in the user parameter. + + The twitter.Api instance must be authenticated. + + Args: + The ID or screen name of the user with whom to discontinue friendship. + Returns: + A twitter.User instance representing the discontinued friend. + ''' + url = 'http://twitter.com/friendships/destroy/%s.json' % user + json = self._FetchUrl(url, post_data={}) + data = simplejson.loads(json) + return User.NewFromJsonDict(data) + + def SetCredentials(self, username, password): + '''Set the username and password for this instance + + Args: + username: The twitter username. + password: The twitter password. + ''' + self._username = username + self._password = password + + def ClearCredentials(self): + '''Clear the username and password for this instance + ''' + self._username = None + self._password = None + + def SetCache(self, cache): + '''Override the default cache. Set to None to prevent caching. + + Args: + cache: an instance that supports the same API as the twitter._FileCache + ''' + self._cache = cache + + def SetUrllib(self, urllib): + '''Override the default urllib implementation. + + Args: + urllib: an instance that supports the same API as the urllib2 module + ''' + self._urllib = urllib + + def SetCacheTimeout(self, cache_timeout): + '''Override the default cache timeout. + + Args: + cache_timeout: time, in seconds, that responses should be reused. + ''' + self._cache_timeout = cache_timeout + + def SetUserAgent(self, user_agent): + '''Override the default user agent + + Args: + user_agent: a string that should be send to the server as the User-agent + ''' + self._request_headers['User-Agent'] = user_agent + + def SetXTwitterHeaders(self, client, url, version): + '''Set the X-Twitter HTTP headers that will be sent to the server. + + Args: + client: + The client name as a string. Will be sent to the server as + the 'X-Twitter-Client' header. + url: + The URL of the meta.xml as a string. Will be sent to the server + as the 'X-Twitter-Client-URL' header. + version: + The client version as a string. Will be sent to the server + as the 'X-Twitter-Client-Version' header. + ''' + self._request_headers['X-Twitter-Client'] = client + self._request_headers['X-Twitter-Client-URL'] = url + self._request_headers['X-Twitter-Client-Version'] = version + + def _BuildUrl(self, url, path_elements=None, extra_params=None): + # Break url into consituent parts + (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url) + + # Add any additional path elements to the path + if path_elements: + # Filter out the path elements that have a value of None + p = [i for i in path_elements if i] + if not path.endswith('/'): + path += '/' + path += '/'.join(p) + + # Add any additional query parameters to the query string + if extra_params and len(extra_params) > 0: + extra_query = self._EncodeParameters(extra_params) + # Add it to the existing query + if query: + query += '&' + extra_query + else: + query = extra_query + + # Return the rebuilt URL + return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) + + def _InitializeRequestHeaders(self, request_headers): + if request_headers: + self._request_headers = request_headers + else: + self._request_headers = {} + + def _InitializeUserAgent(self): + user_agent = 'Python-urllib/%s (python-twitter/%s)' % \ + (self._urllib.__version__, twitter.__version__) + self.SetUserAgent(user_agent) + + def _AddAuthorizationHeader(self, username, password): + if username and password: + basic_auth = base64.encodestring('%s:%s' % (username, password))[:-1] + self._request_headers['Authorization'] = 'Basic %s' % basic_auth + + def _RemoveAuthorizationHeader(self): + if self._request_headers and 'Authorization' in self._request_headers: + del self._request_headers['Authorization'] + + def _GetOpener(self, url, username=None, password=None): + if username and password: + self._AddAuthorizationHeader(username, password) + handler = self._urllib.HTTPBasicAuthHandler() + (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url) + handler.add_password(Api._API_REALM, netloc, username, password) + opener = self._urllib.build_opener(handler) + else: + opener = self._urllib.build_opener() + opener.addheaders = self._request_headers.items() + return opener + + def _Encode(self, s): + if self._input_encoding: + return unicode(s, self._input_encoding).encode('utf-8') + else: + return unicode(s).encode('utf-8') + + def _EncodeParameters(self, parameters): + '''Return a string in key=value&key=value form + + Values of None are not included in the output string. + + Args: + parameters: + A dict of (key, value) tuples, where value is encoded as + specified by self._encoding + Returns: + A URL-encoded string in "key=value&key=value" form + ''' + if parameters is None: + return None + else: + return urllib.urlencode(dict([(k, self._Encode(v)) for k, v in parameters.items() if v is not None])) + + def _EncodePostData(self, post_data): + '''Return a string in key=value&key=value form + + Values are assumed to be encoded in the format specified by self._encoding, + and are subsequently URL encoded. + + Args: + post_data: + A dict of (key, value) tuples, where value is encoded as + specified by self._encoding + Returns: + A URL-encoded string in "key=value&key=value" form + ''' + if post_data is None: + return None + else: + return urllib.urlencode(dict([(k, self._Encode(v)) for k, v in post_data.items()])) + + def _FetchUrl(self, + url, + post_data=None, + parameters=None, + no_cache=None): + """Fetch a URL, optionally caching for a specified time. + + Args: + url: The URL to retrieve + data: A dict of (str, unicode) key value pairs. If set, POST will be used. + parameters: A dict of key/value pairs that should added to + the query string. [OPTIONAL] + username: A HTTP Basic Auth username for this request + username: A HTTP Basic Auth password for this request + no_cache: If true, overrides the cache on the current request + + Returns: + A string containing the body of the response. + """ + # Add key/value parameters to the query string of the url + url = self._BuildUrl(url, extra_params=parameters) + + # Get a url opener that can handle basic auth + opener = self._GetOpener(url, username=self._username, password=self._password) + + encoded_post_data = self._EncodePostData(post_data) + + # Open and return the URL immediately if we're not going to cache + if encoded_post_data or no_cache or not self._cache or not self._cache_timeout: + url_data = opener.open(url, encoded_post_data).read() + else: + # Unique keys are a combination of the url and the username + if self._username: + key = self._username + ':' + url + else: + key = url + + # See if it has been cached before + last_cached = self._cache.GetCachedTime(key) + + # If the cached version is outdated then fetch another and store it + if not last_cached or time.time() >= last_cached + self._cache_timeout: + url_data = opener.open(url, encoded_post_data).read() + self._cache.Set(key, url_data) + else: + url_data = self._cache.Get(key) + + # Always return the latest version + return url_data + +class _FileCacheError(Exception): + '''Base exception class for FileCache related errors''' + +class _FileCache(object): + + DEPTH = 3 + + def __init__(self,root_directory=None): + self._InitializeRootDirectory(root_directory) + + def Get(self,key): + path = self._GetPath(key) + if os.path.exists(path): + return open(path).read() + else: + return None + + def Set(self,key,data): + path = self._GetPath(key) + directory = os.path.dirname(path) + if not os.path.exists(directory): + os.makedirs(directory) + if not os.path.isdir(directory): + raise _FileCacheError('%s exists but is not a directory' % directory) + temp_fd, temp_path = tempfile.mkstemp() + temp_fp = os.fdopen(temp_fd, 'w') + temp_fp.write(data) + temp_fp.close() + if not path.startswith(self._root_directory): + raise _FileCacheError('%s does not appear to live under %s' % + (path, self._root_directory)) + if os.path.exists(path): + os.remove(path) + os.rename(temp_path, path) + + def Remove(self,key): + path = self._GetPath(key) + if not path.startswith(self._root_directory): + raise _FileCacheError('%s does not appear to live under %s' % + (path, self._root_directory )) + if os.path.exists(path): + os.remove(path) + + def GetCachedTime(self,key): + path = self._GetPath(key) + if os.path.exists(path): + return os.path.getmtime(path) + else: + return None + + def _GetUsername(self): + '''Attempt to find the username in a cross-platform fashion.''' + return os.getenv('USER') or \ + os.getenv('LOGNAME') or \ + os.getenv('USERNAME') or \ + os.getlogin() or \ + 'nobody' + + def _GetTmpCachePath(self): + username = self._GetUsername() + cache_directory = 'python.cache_' + username + return os.path.join(tempfile.gettempdir(), cache_directory) + + def _InitializeRootDirectory(self, root_directory): + if not root_directory: + root_directory = self._GetTmpCachePath() + root_directory = os.path.abspath(root_directory) + if not os.path.exists(root_directory): + os.mkdir(root_directory) + if not os.path.isdir(root_directory): + raise _FileCacheError('%s exists but is not a directory' % + root_directory) + self._root_directory = root_directory + + def _GetPath(self,key): + hashed_key = md5.new(key).hexdigest() + return os.path.join(self._root_directory, + self._GetPrefix(hashed_key), + hashed_key) + + def _GetPrefix(self,hashed_key): + return os.path.sep.join(hashed_key[0:_FileCache.DEPTH]) diff --git a/twitter_breakcore.pat b/twitter_breakcore.pat new file mode 100755 index 0000000..776f618 Binary files /dev/null and b/twitter_breakcore.pat differ diff --git a/twittercore.py b/twittercore.py new file mode 100755 index 0000000..a28c31b --- /dev/null +++ b/twittercore.py @@ -0,0 +1,71 @@ +import linecache +import twitter +import random +import sys + +try: + import pyext + class twittercore(pyext._class): + """Example of a simple class which receives messages and prints to the console""" + + # number of inlets and outlets + _inlets=1 + _outlets=2 + _api = twitter.Api() + +# methods for first inlet + + + def break_generate(self, strout): + words = strout.split(' ') + sumlist = list() + for word in words: + sum = 0 + for i in range(len(word)): + sum += ord(word[i]) + sumlist.append(sum) + print sumlist + if len(sumlist) % 2 == 1: + sumlist.append(1000) + self._outlet(2, sumlist) + + def pull_twitter_1(self): + msg_list = self._api.GetPublicTimeline() + strout = "" + while len(msg_list) != 0: + msg = msg_list.pop() + try: + strout = str(msg.text) + break + except: + continue + self._outlet(1, strout) + self.break_generate(strout) + + def pull_file_1(self): + i = random.randint(0,20) + strout = linecache.getline("testfile.txt", i) + self._outlet(1, strout) + self.break_generate(strout) + +except: + print "ERROR: This script must be loaded by the PD/Max pyext external" + + +if __name__ == "__main__": + random.seed() + api = twitter.Api() + msg_list = api.GetPublicTimeline() + i = random.randint(0, 20) + # msg = msg_list[i] + # print msg.text + strout = "" + while len(msg_list) != 0: + msg = msg_list.pop() + try: + strout = str(msg.text) + break + except: + continue +# str = linecache.getline("testfile.txt", i) + print strout
dhotson/fdopen-php
c7bdeb420b40af600ea5375b15421e238bdbf479
Added PHP license
diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3cc8b77 --- /dev/null +++ b/LICENSE @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 +Copyright (c) 1999 - 2010 The PHP Group. All rights reserved. +-------------------------------------------------------------------- + +Redistribution and use in source and binary forms, with or without +modification, is permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact [email protected]. + + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from [email protected]. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" + + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes PHP software, freely available from + <http://www.php.net/software/>". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND +ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +This software consists of voluntary contributions made by many +individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at [email protected]. + +For more information on the PHP Group and the PHP project, +please see <http://www.php.net>. + +PHP includes the Zend Engine, freely available at +<http://www.zend.com>.
qpliu/TXTSpeak
584d08a8868e598e07ebb5dd6c697b677f3c3edf
Move formatting of the spoken message to the resources, enabling localization.
diff --git a/res/values/strings.xml b/res/values/strings.xml index f3bfd69..5d38bb9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">TXTSpeak</string> <string name="enable_title">Enable</string> <string name="enable_summary">Enable TXTSpeak</string> <string name="contacts_title">Contacts only</string> <string name="contacts_summary">Speak only for messages from contacts</string> + <string name="notification">Text message from %s, %s</string> </resources> diff --git a/src/com/yrek/android/txtspeak/SMSService.java b/src/com/yrek/android/txtspeak/SMSService.java index 27300dd..3112ea9 100644 --- a/src/com/yrek/android/txtspeak/SMSService.java +++ b/src/com/yrek/android/txtspeak/SMSService.java @@ -1,101 +1,99 @@ package com.yrek.android.txtspeak; import java.util.HashMap; import android.app.IntentService; import android.content.Intent; import android.database.Cursor; import android.media.AudioManager; import android.net.Uri; import android.preference.PreferenceManager; import android.provider.ContactsContract.PhoneLookup; import android.speech.tts.TextToSpeech; import android.telephony.SmsMessage; import android.util.Log; public class SMSService extends IntentService implements TextToSpeech.OnInitListener { private TextToSpeech tts = null; private HashMap<String,String> params = null; private boolean initialized = false; public SMSService() { super("SMSService"); } @Override public void onCreate() { super.onCreate(); Log.d("SMSService","onCreate"); params = new HashMap<String,String>(); params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_NOTIFICATION)); tts = new TextToSpeech(this, this); } @Override public void onDestroy() { Log.d("SMSService","onDestroy"); tts.shutdown(); super.onDestroy(); } @Override public void onInit(int status) { Log.d("SMSService","onInit status="+status); if (status != TextToSpeech.SUCCESS) tts = null; initialized = true; } @Override protected void onHandleIntent(Intent intent) { if (initialized && tts == null) return; Object[] pdus = intent.getExtras() != null ? (Object[]) intent.getExtras().get("pdus") : null; if (!initialized || (pdus == null && tts.isSpeaking())) { try { Thread.sleep(1000); } catch (InterruptedException e) { } startService(intent); return; } if (pdus == null) return; boolean contactsOnly = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("contacts",true); Log.d("SMSService","contactsOnly="+contactsOnly); for (Object pdu : pdus) handleMessage(SmsMessage.createFromPdu((byte[]) pdu), contactsOnly); startService(new Intent(this, SMSService.class)); } private void handleMessage(SmsMessage sms, boolean contactsOnly) { String sender = sms.getOriginatingAddress(); Log.d("SMSService","sender="+sender); if (contactsOnly && sender == null) return; if (sender == null) { sender = sms.getDisplayOriginatingAddress(); } else { Cursor cursor = null; try { cursor = getContentResolver().query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(sender)), new String[] { PhoneLookup.DISPLAY_NAME, PhoneLookup.SEND_TO_VOICEMAIL }, null, null, null); if (!cursor.moveToNext()) { if (contactsOnly) return; } else { if ("1".equals(cursor.getString(1))) return; sender = cursor.getString(0); if (sender == null) sender = sms.getDisplayOriginatingAddress(); } } finally { cursor.close(); } } Log.d("SMSService","sender="+sender); - StringBuffer sb = new StringBuffer(); - sb.append("From ").append(sender).append(", ").append(sms.getDisplayMessageBody()); - tts.speak(sb.toString(), TextToSpeech.QUEUE_ADD, params); + tts.speak(getResources().getString(R.string.notification, sender, sms.getDisplayMessageBody()), TextToSpeech.QUEUE_ADD, params); } }
qpliu/TXTSpeak
0764ff72adf6acb53ed1aff97fef27c9d8b444d5
Add LICENSE and README.
diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..22384dc --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2010 Q.P.Liu + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README b/README new file mode 100644 index 0000000..9735584 --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +TXTSpeak is a simple Android application that invokes text-to-speech +on incoming SMS messages. + +It only speaks messages from contacts unless configured otherwise. It +does not speak messages from contacts that are sent to voicemail. + +TXTSpeak requires Android 2.1.
qpliu/TXTSpeak
11941a60ec1d137160c5a985cef2310e62428884
Add .gitignore.
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c0bb8dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +local.properties +bin +gen
qpliu/TXTSpeak
2d9553310a749d7ba63ad0dd9e01b864c44957c1
Initial SMS - TTS Android app.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..b8810e1 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.yrek.android.txtspeak" + android:versionCode="1" + android:versionName="1.0"> + <application android:label="@string/app_name" android:icon="@drawable/icon"> + <activity android:name="TXTSpeak" + android:label="@string/app_name"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <receiver android:name="SMSReceiver"> + <intent-filter> + <action android:name="android.provider.Telephony.SMS_RECEIVED"/> + </intent-filter> + </receiver> + <service android:name="SMSService" android:exported="false"/> + </application> + <uses-sdk android:minSdkVersion="7"/> + <uses-permission android:name="android.permission.RECEIVE_SMS"/> + <uses-permission android:name="android.permission.READ_CONTACTS"/> +</manifest> diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..edc7f23 --- /dev/null +++ b/build.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked in Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..44704cc --- /dev/null +++ b/build.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="TXTSpeak" default="help"> + + <!-- The local.properties file is created and updated by the 'android' tool. + It contains the path to the SDK. It should *NOT* be checked in in Version + Control Systems. --> + <property file="local.properties" /> + + <!-- The build.properties file can be created by you and is never touched + by the 'android' tool. This is the place to change some of the default property values + used by the Ant rules. + Here are some properties you may want to change/update: + + application.package + the name of your application package as defined in the manifest. Used by the + 'uninstall' rule. + source.dir + the name of the source directory. Default is 'src'. + out.dir + the name of the output directory. Default is 'bin'. + + Properties related to the SDK location or the project target should be updated + using the 'android' tool with the 'update' action. + + This file is an integral part of the build system for your application and + should be checked in in Version Control Systems. + + --> + <property file="build.properties" /> + + <!-- The default.properties file is created and updated by the 'android' tool, as well + as ADT. + This file is an integral part of the build system for your application and + should be checked in in Version Control Systems. --> + <property file="default.properties" /> + + <!-- Custom Android task to deal with the project target, and import the proper rules. + This requires ant 1.6.0 or above. --> + <path id="android.antlibs"> + <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" /> + <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" /> + <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" /> + <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" /> + <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" /> + </path> + + <taskdef name="setup" + classname="com.android.ant.SetupTask" + classpathref="android.antlibs" /> + + <!-- Execute the Android Setup task that will setup some properties specific to the target, + and import the build rules files. + + The rules file is imported from + <SDK>/platforms/<target_platform>/templates/android_rules.xml + + To customize some build steps for your project: + - copy the content of the main node <project> from android_rules.xml + - paste it in this build.xml below the <setup /> task. + - disable the import by changing the setup task below to <setup import="false" /> + + This will ensure that the properties are setup correctly but that your customized + build steps are used. + --> + <setup /> + +</project> diff --git a/default.properties b/default.properties new file mode 100644 index 0000000..9d135cb --- /dev/null +++ b/default.properties @@ -0,0 +1,11 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "build.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-7 diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png new file mode 100644 index 0000000..8074c4c Binary files /dev/null and b/res/drawable-hdpi/icon.png differ diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png new file mode 100644 index 0000000..1095584 Binary files /dev/null and b/res/drawable-ldpi/icon.png differ diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png new file mode 100644 index 0000000..a07c69f Binary files /dev/null and b/res/drawable-mdpi/icon.png differ diff --git a/res/layout/main.xml b/res/layout/main.xml new file mode 100644 index 0000000..2068963 --- /dev/null +++ b/res/layout/main.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <CheckBoxPreference + android:key="enabled" + android:title="@string/enable_title" + android:summary="@string/enable_summary" + android:defaultValue="false"/> + <CheckBoxPreference + android:key="contacts" + android:title="@string/contacts_title" + android:summary="@string/contacts_summary" + android:defaultValue="true"/> +</PreferenceScreen> diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..f3bfd69 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">TXTSpeak</string> + <string name="enable_title">Enable</string> + <string name="enable_summary">Enable TXTSpeak</string> + <string name="contacts_title">Contacts only</string> + <string name="contacts_summary">Speak only for messages from contacts</string> +</resources> diff --git a/src/com/yrek/android/txtspeak/SMSReceiver.java b/src/com/yrek/android/txtspeak/SMSReceiver.java new file mode 100644 index 0000000..f1a9ce2 --- /dev/null +++ b/src/com/yrek/android/txtspeak/SMSReceiver.java @@ -0,0 +1,18 @@ +package com.yrek.android.txtspeak; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.preference.PreferenceManager; + +public class SMSReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + if (!"android.provider.Telephony.SMS_RECEIVED".equals(intent.getAction()) + || !PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enabled", false)) + return; + Intent smsService = new Intent(context, SMSService.class); + smsService.putExtras(intent.getExtras()); + context.startService(smsService); + } +} diff --git a/src/com/yrek/android/txtspeak/SMSService.java b/src/com/yrek/android/txtspeak/SMSService.java new file mode 100644 index 0000000..27300dd --- /dev/null +++ b/src/com/yrek/android/txtspeak/SMSService.java @@ -0,0 +1,101 @@ +package com.yrek.android.txtspeak; + +import java.util.HashMap; + +import android.app.IntentService; +import android.content.Intent; +import android.database.Cursor; +import android.media.AudioManager; +import android.net.Uri; +import android.preference.PreferenceManager; +import android.provider.ContactsContract.PhoneLookup; +import android.speech.tts.TextToSpeech; +import android.telephony.SmsMessage; +import android.util.Log; + +public class SMSService extends IntentService implements TextToSpeech.OnInitListener { + private TextToSpeech tts = null; + private HashMap<String,String> params = null; + private boolean initialized = false; + + public SMSService() { + super("SMSService"); + } + + @Override + public void onCreate() { + super.onCreate(); + Log.d("SMSService","onCreate"); + params = new HashMap<String,String>(); + params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_NOTIFICATION)); + tts = new TextToSpeech(this, this); + } + + @Override + public void onDestroy() { + Log.d("SMSService","onDestroy"); + tts.shutdown(); + super.onDestroy(); + } + + @Override + public void onInit(int status) { + Log.d("SMSService","onInit status="+status); + if (status != TextToSpeech.SUCCESS) + tts = null; + initialized = true; + } + + @Override + protected void onHandleIntent(Intent intent) { + if (initialized && tts == null) + return; + Object[] pdus = intent.getExtras() != null ? (Object[]) intent.getExtras().get("pdus") : null; + if (!initialized || (pdus == null && tts.isSpeaking())) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } + startService(intent); + return; + } + if (pdus == null) + return; + boolean contactsOnly = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("contacts",true); + Log.d("SMSService","contactsOnly="+contactsOnly); + for (Object pdu : pdus) + handleMessage(SmsMessage.createFromPdu((byte[]) pdu), contactsOnly); + startService(new Intent(this, SMSService.class)); + } + + private void handleMessage(SmsMessage sms, boolean contactsOnly) { + String sender = sms.getOriginatingAddress(); + Log.d("SMSService","sender="+sender); + if (contactsOnly && sender == null) + return; + if (sender == null) { + sender = sms.getDisplayOriginatingAddress(); + } else { + Cursor cursor = null; + try { + cursor = getContentResolver().query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(sender)), new String[] { PhoneLookup.DISPLAY_NAME, PhoneLookup.SEND_TO_VOICEMAIL }, null, null, null); + if (!cursor.moveToNext()) { + if (contactsOnly) + return; + } else { + if ("1".equals(cursor.getString(1))) + return; + sender = cursor.getString(0); + if (sender == null) + sender = sms.getDisplayOriginatingAddress(); + } + } finally { + cursor.close(); + } + } + Log.d("SMSService","sender="+sender); + StringBuffer sb = new StringBuffer(); + sb.append("From ").append(sender).append(", ").append(sms.getDisplayMessageBody()); + tts.speak(sb.toString(), TextToSpeech.QUEUE_ADD, params); + } +} diff --git a/src/com/yrek/android/txtspeak/TXTSpeak.java b/src/com/yrek/android/txtspeak/TXTSpeak.java new file mode 100644 index 0000000..6daf22d --- /dev/null +++ b/src/com/yrek/android/txtspeak/TXTSpeak.java @@ -0,0 +1,21 @@ +package com.yrek.android.txtspeak; + +import android.content.Intent; +import android.os.Bundle; +import android.preference.PreferenceActivity; +import android.speech.tts.TextToSpeech; + +public class TXTSpeak extends PreferenceActivity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + startActivityForResult(new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA), 0); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode != TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) + startActivity(new Intent(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA)); + addPreferencesFromResource(R.layout.main); + } +}
jkbnerad/Demo
964a58722f71bd84ffc92c5e87a3c523e4bde565
Přidán komentář
diff --git a/index.php b/index.php index f1ca701..6bc1e5c 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,5 @@ <?php echo 'Test commitu'; + +// komentář \ No newline at end of file
jkbnerad/Demo
276ba9fa48e43e5d239436c2e589238dd0e08ae3
Přidán index.php
diff --git a/index.php b/index.php new file mode 100644 index 0000000..f1ca701 --- /dev/null +++ b/index.php @@ -0,0 +1,3 @@ +<?php + +echo 'Test commitu';
agate/onTap
9c0d72e02ab6ed316a76730d5ea6da1fc79e754c
fixed some iui problem
diff --git a/views/iui/index.haml b/views/iui/index.haml index 20a8f5f..8e8b53c 100644 --- a/views/iui/index.haml +++ b/views/iui/index.haml @@ -1,40 +1,39 @@ .toolbar %h1#pageTitle %a#backButton.button{ :href => '#' } %ul#index{ :title => 'Factual Demo', :selected => 'true' } %li %a{ :href => '#users' } Users %li %a{ :href => '#signup' } Signup %ul#users{ :title => 'Users' } - @users.each do |u| - %li - %a= u[:username] + %li= u[:username] %form#signup.panel{ :title => 'Signup', :action => '/iui/signup', :method => 'POST' } %h2 Register a new account %fieldset .row %label username %input{ :name => 'username', :type => 'text' }/ .row %label password %input{ :name => 'password', :type => 'password' }/ .row %label repassword %input{ :name => 'password_confirmation', :type => 'password' }/ .row %label I am at least 21 years old %input{ :name => 'over_21', :type => 'checkbox' }/ .row %label I accept the Factual %a{ :href => '#terms_of_service' } Terms of Service %input{ :name => 'terms_of_service', :type => 'checkbox' }/ %a.whiteButton{ :href => '#', :type => 'submit' } Done %ul#terms_of_service{ :title => 'Terms of Service' } %li All legal text as required by our attorney diff --git a/views/iui/success.haml b/views/iui/success.haml index d941324..eee6a1a 100644 --- a/views/iui/success.haml +++ b/views/iui/success.haml @@ -1,25 +1,28 @@ -#success - .toolbar - %h1 Success - %a.back{ :href => '#index' } Back - .message - Thanks for you registion. +#success.panel{ :title => 'Factual Demo' } + %h2 Thanks for you registion. -#index - .toolbar - %h1 Factual Demo - %ul.links - %li.arrow - %a{ :href => '#users' } Users - %small.counter= @users.count - %li.arrow - %a{ :href => '#signup' } Signup +%ul#users{ :title => 'Users' } + - @users.each do |u| + %li= u[:username] -#users - .toolbar - %h1 Users - %a.back{ :href => '#index' } Back - %ul.edgetoedge - - @users.each do |u| - %li - %a= u[:username] +%form#signup.panel{ :title => 'Signup', :action => '/iui/signup', :method => 'POST' } + %h2 Register a new account + %fieldset + .row + %label username + %input{ :name => 'username', :type => 'text' }/ + .row + %label password + %input{ :name => 'password', :type => 'password' }/ + .row + %label repassword + %input{ :name => 'password_confirmation', :type => 'password' }/ + .row + %label I am at least 21 years old + %input{ :name => 'over_21', :type => 'checkbox' }/ + .row + %label + I accept the Factual + %a{ :href => '#terms_of_service' } Terms of Service + %input{ :name => 'terms_of_service', :type => 'checkbox' }/ + %a.whiteButton{ :href => '#', :type => 'submit' } Done
agate/onTap
3d678977a06007c44a3dd48d2f45afd1f62cf86a
modifed rackup file
diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..76d42ad --- /dev/null +++ b/config.ru @@ -0,0 +1,2 @@ +require 'onTap' +run Sinatra::Application diff --git a/config/rackup.ru b/config/rackup.ru deleted file mode 100644 index 894c088..0000000 --- a/config/rackup.ru +++ /dev/null @@ -1,9 +0,0 @@ -set :app_file, File.expand_path(File.dirname(__FILE__) + '/../my_sinatra_app.rb') -set :public, File.expand_path(File.dirname(__FILE__) + '/../public') -set :views, File.expand_path(File.dirname(__FILE__) + '/../views') -set :env, :production -disable :run, :reload - -require File.dirname(__FILE__) + "/../my_sinatra_app" - -run Sinatra.application
agate/onTap
584ec16f9b6fc288af5156070556f7f7f5100b96
refactor the dir
diff --git a/config/rackup.ru b/config/rackup.ru new file mode 100644 index 0000000..894c088 --- /dev/null +++ b/config/rackup.ru @@ -0,0 +1,9 @@ +set :app_file, File.expand_path(File.dirname(__FILE__) + '/../my_sinatra_app.rb') +set :public, File.expand_path(File.dirname(__FILE__) + '/../public') +set :views, File.expand_path(File.dirname(__FILE__) + '/../views') +set :env, :production +disable :run, :reload + +require File.dirname(__FILE__) + "/../my_sinatra_app" + +run Sinatra.application diff --git a/onTap.rb b/onTap.rb new file mode 100644 index 0000000..8d1e196 --- /dev/null +++ b/onTap.rb @@ -0,0 +1,145 @@ +require 'rubygems' +require 'sinatra' +require 'sequel' + +DB = Sequel.sqlite +DB.create_table :users do + primary_key :id + String :username + String :password + Boolean :over_21 + Boolean :terms_of_service +end + +get '/' do + haml :index +end + +# standard +get '/standard' do + @users = DB[:users] + haml :'standard/index', :layout => :'standard/layout' +end +get '/standard/terms_of_service' do + haml :'standard/terms_of_service', :layout => :'standard/layout' +end +get '/standard/signup' do + haml :'standard/signup', :layout => :'standard/layout' +end +post '/standard/signup' do + @errors = verify + + if @errors.empty? + DB[:users].insert( + :username => params[:username], + :password => params[:password], + :over_21 => params[:over_21] == 'on', + :terms_of_service => params[:terms_of_service] == 'on' + ) + redirect '/standard' + else + haml :'standard/signup', :layout => :'standard/layout' + end +end + +# iui +get '/iui' do + @users = DB[:users] + haml :'iui/index', :layout => :'iui/layout' +end + +get '/iui/terms_of_service' do + haml :'iui/index', :layout => :'iui/layout' +end + +post '/iui/signup' do + @errors = verify + + if @errors.empty? + DB[:users].insert( + :username => params[:username], + :password => params[:password], + :over_21 => params[:over_21] == 'on', + :terms_of_service => params[:terms_of_service] == 'on' + ) + @users = DB[:users] + haml :'iui/success', :layout => false + else + haml :'iui/signup', :layout => false + end +end + +# ------------------------------------- +# verify methods +# ------------------------------------- + +def verify + errors = {} + if username_error = verify_username + errors[:username] = username_error + end + if password_error = verify_password + errors[:password] = password_error + end + if password_confirmation_error = verify_password_confirmation + errors[:password_confirmation] = password_confirmation_error + end + if statements_error = verify_statements + errors[:statements] = statements_error + end + return errors +end + +def verify_username + username = params[:username].strip + + if username.length == 0 + return 'Your username can not be blank' + end + + if username.length < 6 + return 'Your username must be at least 6 characters long' + end + + if DB[:users].filter(:username => username).count > 0 + return 'This username is taken' + end + + return false +end + +def verify_password + password = params[:password].strip + + if password.length == 0 + return 'Your password can not be blank' + end + + if password.length < 6 + return 'Your password must be at least 6 characters long' + end + + return false +end + +def verify_password_confirmation + password = params[:password].strip + password_confirmation = params[:password_confirmation].strip + + if password != password_confirmation + return 'Your passwords do not match' + end + + return false +end + +def verify_statements + over_21 = params[:over_21] == 'on', + terms_of_service = params[:terms_of_service] == 'on' + + if !over_21 || !terms_of_service + return 'You must agree with both of the statements, above.' + end + + return false +end diff --git a/public/css/iui.css b/public/css/iui.css new file mode 100644 index 0000000..90e4d87 --- /dev/null +++ b/public/css/iui.css @@ -0,0 +1,399 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ +body { + margin: 0; + font-family: Helvetica; + background: #FFFFFF; + color: #000000; + overflow-x: hidden; + -webkit-user-select: none; + -webkit-text-size-adjust: none; +} + +body > *:not(.toolbar) { + display: none; + position: absolute; + margin: 0; + padding: 0; + left: 0; + top: 45px; + width: 100%; + height: auto; + min-height: 415px; + -webkit-transition-duration: 300ms; + -webkit-transition-property: -webkit-transform; + -webkit-transform: translateX(0%); +} + +body[orient="landscape"] > *:not(.toolbar) { + height: auto; + min-height: 268px; +} + +body > *[selected="true"] { + display: block; +} + +li > a[selected], li > a:active { + background-color: #194fdb !important; + background-repeat: no-repeat, repeat-x !important; /* TG: !important */ + background-position: right center, left top !important; /* TG: !important */ + color: #FFFFFF !important; +} + +li > a[selected="progress"] { +} + +/************************************************************************************************/ + +body > .toolbar { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + border-top: 1px solid #6d84a2; + padding: 0 10px 10px 10px; + height: 45px; +} + +.toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + margin: 1px 0 0 -75px; + padding-top: 10px; + height: 45px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #FFFFFF; +} + +body[orient="landscape"] > .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +.button { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; +} + +.blueButton { + border-width: 0 5px; +} + +.leftButton { + left: 6px; + right: auto; +} + +#backButton { + display: none; + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; +} + +.whiteButton, +.redButton, +.grayButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +/* TG */ .grayButton[selected], .grayButton:active, +.whiteButton { + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +/* TG */ background:transparent !important; +} + +.redButton { +/* TG */ background:transparent !important; + color:#fff; + text-shadow: #7a0001 0 -1px 0; +} + +/* TG */ .whiteButton[selected], .whiteButton:active, +.grayButton { + color: #FFFFFF; +/* TG */ background:transparent !important; +} + +/************************************************************************************************/ + +body > ul > li { + position: relative; + margin: 0; + border-bottom: 1px solid #E0E0E0; + padding: 8px 0 8px 10px; + font-size: 20px; + font-weight: bold; + list-style: none; +} + +body > ul > li.group { + position: relative; + top: -1px; + margin-bottom: -2px; + border-top: 1px solid #7d7d7d; + border-bottom: 1px solid #999999; + padding: 1px 10px; + font-size: 17px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; + color: #FFFFFF; +} + +body > ul > li.group:first-child { + top: 0; + border-top: none; +} + +body > ul > li > a { + display: block; + margin: -8px 0 -8px -10px; + padding: 8px 32px 8px 10px; + text-decoration: none; + color: inherit; +} + +a[target="_replace"] { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding-top: 25px; + padding-bottom: 25px; + font-size: 18px; + color: cornflowerblue; + background-color: #FFFFFF; + background-image: none; +} + +/************************************************************************************************/ + +body > .dialog { + top: 0; + width: 100%; + min-height: 417px; + z-index: 2; + background: rgba(0, 0, 0, 0.8); + padding: 0; + text-align: right; +} + +.dialog > fieldset { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 0; + border: none; + border-top: 1px solid #6d84a2; + padding: 10px 6px; +} + +.dialog > fieldset > h1 { + margin: 0 10px 0 10px; + padding: 0; + font-size: 20px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; +} + +.dialog > fieldset > label { + position: absolute; + margin: 16px 0 0 6px; + font-size: 14px; + color: #999999; +} + +input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 8px 0 0 0; + padding: 6px 6px 6px 44px; + font-size: 16px; + font-weight: normal; +} + +/************************************************************************************************/ + +body > .panel { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding: 10px; +} + +.panel > ul, +.panel > fieldset { + position: relative; + margin: 0 0 20px 0; + padding: 0; + background: #FFFFFF; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border: 1px solid #999999; + text-align: right; + font-size: 16px; +} + +.panel > ul li, +.row { + position: relative; + min-height: 42px; + border-bottom: 1px solid #999999; + -webkit-border-radius: 0; + -moz-border-radius: 0; + text-align: right; +} + +.panel > ul li:last-child, +fieldset > .row:last-child { + border-bottom: none !important; +} + +.row > input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + margin: 0; + border: none; + padding: 12px 10px 0 110px; + height: 42px; + background: none; +} +.row > input[type|=radio], .row > input[type|=checkbox] { + margin: 7px 7px 0 0; + height: 25px; + width: 25px; +} + +.row > label { + position: absolute; + margin: 0 0 0 14px; + line-height: 42px; + font-weight: bold; +} + +.row > span { + position: absolute; + padding: 12px 10px 0 110px; + margin: 0; +} + +.row > .toggle { + position: absolute; + top: 6px; + right: 6px; + width: 100px; + height: 28px; +} + +.toggle { + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + font-size: 19px; + font-weight: bold; + line-height: 30px; +} + +.toggle[toggled="true"] { + border: 1px solid #143fae; +} + +.toggleOn { + display: none; + position: absolute; + width: 60px; + text-align: center; + left: 0; + top: 0; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; +} + +.toggleOff { + position: absolute; + width: 60px; + text-align: center; + right: 0; + top: 0; + color: #666666; +} + +.toggle[toggled="true"] > .toggleOn { + display: block; +} + +.toggle[toggled="true"] > .toggleOff { + display: none; +} + +.thumb { + position: absolute; + top: -1px; + left: -1px; + width: 40px; + height: 28px; + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; +} + +.toggle[toggled="true"] > .thumb { + left: auto; + right: -1px; +} + +.panel > h2 { + margin: 0 0 8px 14px; + font-size: inherit; + font-weight: bold; + color: #4d4d70; + text-shadow: rgba(255, 255, 255, 0.75) 2px 2px 0; +} + +/************************************************************************************************/ + +#preloader { + display: none; +} diff --git a/public/css/iui_default_theme/back-img.png b/public/css/iui_default_theme/back-img.png new file mode 100644 index 0000000..9df2d7f Binary files /dev/null and b/public/css/iui_default_theme/back-img.png differ diff --git a/public/css/iui_default_theme/backButton.png b/public/css/iui_default_theme/backButton.png new file mode 100644 index 0000000..e27ea8c Binary files /dev/null and b/public/css/iui_default_theme/backButton.png differ diff --git a/public/css/iui_default_theme/backButtonBack.png b/public/css/iui_default_theme/backButtonBack.png new file mode 100644 index 0000000..f38e2d0 Binary files /dev/null and b/public/css/iui_default_theme/backButtonBack.png differ diff --git a/public/css/iui_default_theme/backButtonBrdr.png b/public/css/iui_default_theme/backButtonBrdr.png new file mode 100644 index 0000000..9017168 Binary files /dev/null and b/public/css/iui_default_theme/backButtonBrdr.png differ diff --git a/public/css/iui_default_theme/blueButton.png b/public/css/iui_default_theme/blueButton.png new file mode 100644 index 0000000..0f92dfd Binary files /dev/null and b/public/css/iui_default_theme/blueButton.png differ diff --git a/public/css/iui_default_theme/cancel.png b/public/css/iui_default_theme/cancel.png new file mode 100644 index 0000000..5f6dcc8 Binary files /dev/null and b/public/css/iui_default_theme/cancel.png differ diff --git a/public/css/iui_default_theme/default-theme.css b/public/css/iui_default_theme/default-theme.css new file mode 100644 index 0000000..1a866d9 --- /dev/null +++ b/public/css/iui_default_theme/default-theme.css @@ -0,0 +1,107 @@ +/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ +body { + color: #000000; +} + +li > a[selected], li > a:active { + background-image: url(listArrowSel.png), url(selection.png) !important; +} + +li > a[selected="progress"] { + background-image: url(../default/loading.gif), url(selection.png) !important; +} + +/************************************************************************************************/ + +body > .toolbar { + background: url(toolbar.png) #6d84a2 repeat-x; +} + +.button { + -webkit-border-image: url(toolButton.png) 0 5 0 5; + -moz-border-image: url(toolButton.png) 0 5 0 5; +} + +.blueButton { + -webkit-border-image: url(blueButton.png) 0 5 0 5; + -moz-border-image: url(blueButton.png) 0 5 0 5; +} + +#backButton { + -webkit-border-image: url(backButtonBrdr.png) 0 8 0 14; + -moz-border-image: url(backButtonBrdr.png) 0 8 0 14; + background: url(backButtonBack.png) repeat-x; +} + + +.whiteButton { + -webkit-border-image: url(whiteButton.png) 0 12 0 12; + -moz-border-image: url(whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +.redButton { + -webkit-border-image: url(redButton.png) 0 12 0 12; + -moz-border-image: url(redButton.png) 0 12 0 12; +} + +.grayButton { + -webkit-border-image: url(grayButton.png) 0 12 0 12; + -moz-border-image: url(grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/************************************************************************************************/ + +body > ul > li.group { + opacity:0.7; + background: url(listGroup.png) repeat-x; +} + +body > ul > li > a { + background: url(listArrow.png) no-repeat right center; +} + +/************************************************************************************************/ + +.dialog > fieldset { + background: url(toolbar.png) #7388a5 repeat-x; +} + +/************************************************************************************************/ + +body > .panel { + background: #c8c8c8 url(pinstripes.png); +} + +.toggle { + border: 1px solid #888888; + background: #FFFFFF url(toggle.png) repeat-x; +} + +.toggle[toggled="true"] { + background: #194fdb url(toggleOn.png) repeat-x; +} + +.thumb { + background: #ffffff url(thumb.png) repeat-x; +} + +/************************************************************************************************/ +#preloader { + display: none; + background-image: url(loading.gif), url(selection.png), + url(blueButton.png), url(listArrowSel.png), url(listGroup.png); +} + +.toolbar > h1.titleImg { + background: url(title-img.png) no-repeat top center; + color: rgba(0,0,0,0); +} + +.backButtonImg { + width: 50px; + background: url(back-img.png) no-repeat center left, + url(backButtonBack.png) repeat-x top left !important; + color: rgba(0,0,0,0); +} diff --git a/public/css/iui_default_theme/grayButton.png b/public/css/iui_default_theme/grayButton.png new file mode 100644 index 0000000..0ce6a30 Binary files /dev/null and b/public/css/iui_default_theme/grayButton.png differ diff --git a/public/css/iui_default_theme/listArrow.png b/public/css/iui_default_theme/listArrow.png new file mode 100644 index 0000000..6421a16 Binary files /dev/null and b/public/css/iui_default_theme/listArrow.png differ diff --git a/public/css/iui_default_theme/listArrowSel.png b/public/css/iui_default_theme/listArrowSel.png new file mode 100644 index 0000000..86832eb Binary files /dev/null and b/public/css/iui_default_theme/listArrowSel.png differ diff --git a/public/css/iui_default_theme/listGroup.png b/public/css/iui_default_theme/listGroup.png new file mode 100644 index 0000000..221553a Binary files /dev/null and b/public/css/iui_default_theme/listGroup.png differ diff --git a/public/css/iui_default_theme/loading.gif b/public/css/iui_default_theme/loading.gif new file mode 100644 index 0000000..8522ddf Binary files /dev/null and b/public/css/iui_default_theme/loading.gif differ diff --git a/public/css/iui_default_theme/pinstripes.png b/public/css/iui_default_theme/pinstripes.png new file mode 100644 index 0000000..c997775 Binary files /dev/null and b/public/css/iui_default_theme/pinstripes.png differ diff --git a/public/css/iui_default_theme/redButton.png b/public/css/iui_default_theme/redButton.png new file mode 100644 index 0000000..210f156 Binary files /dev/null and b/public/css/iui_default_theme/redButton.png differ diff --git a/public/css/iui_default_theme/selection.png b/public/css/iui_default_theme/selection.png new file mode 100644 index 0000000..537e3f0 Binary files /dev/null and b/public/css/iui_default_theme/selection.png differ diff --git a/public/css/iui_default_theme/thumb.png b/public/css/iui_default_theme/thumb.png new file mode 100644 index 0000000..cefa8fc Binary files /dev/null and b/public/css/iui_default_theme/thumb.png differ diff --git a/public/css/iui_default_theme/title-img.png b/public/css/iui_default_theme/title-img.png new file mode 100644 index 0000000..05c10a6 Binary files /dev/null and b/public/css/iui_default_theme/title-img.png differ diff --git a/public/css/iui_default_theme/toggle.png b/public/css/iui_default_theme/toggle.png new file mode 100644 index 0000000..3b62ebf Binary files /dev/null and b/public/css/iui_default_theme/toggle.png differ diff --git a/public/css/iui_default_theme/toggleOn.png b/public/css/iui_default_theme/toggleOn.png new file mode 100644 index 0000000..b016814 Binary files /dev/null and b/public/css/iui_default_theme/toggleOn.png differ diff --git a/public/css/iui_default_theme/toolButton.png b/public/css/iui_default_theme/toolButton.png new file mode 100644 index 0000000..afe4d7a Binary files /dev/null and b/public/css/iui_default_theme/toolButton.png differ diff --git a/public/css/iui_default_theme/toolbar.png b/public/css/iui_default_theme/toolbar.png new file mode 100644 index 0000000..3dde94c Binary files /dev/null and b/public/css/iui_default_theme/toolbar.png differ diff --git a/public/css/iui_default_theme/whiteButton.png b/public/css/iui_default_theme/whiteButton.png new file mode 100644 index 0000000..5514b27 Binary files /dev/null and b/public/css/iui_default_theme/whiteButton.png differ diff --git a/public/js/iui.js b/public/js/iui.js new file mode 100644 index 0000000..5cbe4bb --- /dev/null +++ b/public/js/iui.js @@ -0,0 +1,663 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ + + +(function() { + +var slideSpeed = 20; +var slideInterval = 0; + +var currentPage = null; +var currentDialog = null; +var currentWidth = 0; +var currentHeight = 0; +var currentHash = location.hash; +var hashPrefix = "#_"; +var pageHistory = []; +var newPageCount = 0; +var checkTimer; +var hasOrientationEvent = false; +var portraitVal = "portrait"; +var landscapeVal = "landscape"; + +// ************************************************************************************************* + +window.iui = +{ + animOn: true, // Slide animation with CSS transition is now enabled by default where supported + + httpHeaders: { + "X-Requested-With" : "XMLHttpRequest" + }, + + showPage: function(page, backwards) + { + if (page) + { +// if (window.iui_ext) window.iui_ext.injectEventMethods(page); // TG + + if (currentDialog) + { + currentDialog.removeAttribute("selected"); + // EVENT blur->currentDialog + sendEvent("blur", currentDialog); + currentDialog = null; + } + + if (hasClass(page, "dialog")) + { + // EVENT focus->page + sendEvent("focus", page); + showDialog(page); + } + else + { + sendEvent("load", page); // 127(stylesheet), 128(script), 129(onload) + // 130(onFocus), 133(loadActionButton) + var fromPage = currentPage; + // EVENT blur->currentPage + sendEvent("blur", currentPage); + currentPage = page; + // EVENT focus->currentPage + sendEvent("focus", page); + + if (fromPage) + { + if (backwards) sendEvent("unload", fromPage); + setTimeout(slidePages, 0, fromPage, page, backwards); + } + else + { + updatePage(page, fromPage); + } + + } + } + }, + + showPageById: function(pageId) + { + var page = $(pageId); + if (page) + { + var index = pageHistory.indexOf(pageId); + var backwards = index != -1; + if (backwards) + { + // we're going back, remove history from index on + // remember - pageId will be added again in updatePage + pageHistory.splice(index); + } + + iui.showPage(page, backwards); + } + }, + + goBack: function() + { + pageHistory.pop(); // pop current page + var pageID = pageHistory.pop(); // pop/get parent + var page = $(pageID); + iui.showPage(page, true); + }, + + showPageByHref: function(href, args, method, replace, cb) + { + // I don't think we need onerror, because readstate will still go to 4 in that case + function spbhCB(xhr) + { + if (xhr.readyState == 4) + { + // Add 'if (xhr.responseText)' to make sure we have something??? + var frag = document.createElement("div"); + frag.innerHTML = xhr.responseText; + // EVENT beforeInsert->body + sendEvent("beforeinsert", document.body, {fragment:frag}) + if (replace) + { + replaceElementWithFrag(replace, frag); + } + else + { + iui.insertPages(frag); + } + if (cb) + setTimeout(cb, 1000, true); + } + }; + iui.ajax(href, args, method, spbhCB); + }, + + // Callback function gets a single argument, the XHR + ajax: function(url, args, method, cb) + { + var xhr = new XMLHttpRequest(); + method = method ? method.toUpperCase() : "GET"; + if (args && method == "GET") + { + url = url + "?" + iui.param(args); + } + xhr.open(method, url, true); + if (cb) + { + xhr.onreadystatechange = function() { cb(xhr); }; + } + var data = null; + if (args && method != "GET") + { + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + data = iui.param(args); + } + for (var header in iui.httpHeaders) + { + xhr.setRequestHeader(header, iui.httpHeaders[header]); + } + xhr.send(data); + }, + + // Thanks, jQuery + // stripped-down, simplified, object-only version + param: function( o ) + { + var s = [ ]; + + // Serialize the key/values + for ( var key in o ) + s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(o[key]); + + // Return the resulting serialization + return s.join("&").replace(/%20/g, "+"); + }, + + insertPages: function(frag) + { + var nodes = frag.childNodes; + var targetPage; + for (var i = 0; i < nodes.length; ++i) + { + var child = nodes[i]; + if (child.nodeType == 1) + { + if (!child.id) + child.id = "__" + (++newPageCount) + "__"; + + var clone = $(child.id); + var docNode; + if (clone) { + clone.parentNode.replaceChild(child, clone); + docNode = $(child.id); + } + else + docNode = document.body.appendChild(child); + + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + + + if (child.getAttribute("selected") == "true" || !targetPage) + targetPage = child; + + --i; + } + } + if (targetPage) + iui.showPage(targetPage); + + }, + + getSelectedPage: function() + { + for (var child = document.body.firstChild; child; child = child.nextSibling) + { + if (child.nodeType == 1 && child.getAttribute("selected") == "true") + return child; + } + }, + isNativeUrl: function(href) + { + for(var i = 0; i < iui.nativeUrlPatterns.length; i++) + { + if(href.match(iui.nativeUrlPatterns[i])) return true; + } + return false; + }, + nativeUrlPatterns: [ + new RegExp("^http:\/\/maps.google.com\/maps\?"), + new RegExp("^mailto:"), + new RegExp("^tel:"), + new RegExp("^http:\/\/www.youtube.com\/watch\\?v="), + new RegExp("^http:\/\/www.youtube.com\/v\/"), + new RegExp("^javascript:"), + + ], + hasClass: function(self, name) + { + var re = new RegExp("(^|\\s)"+name+"($|\\s)"); + return re.exec(self.getAttribute("class")) != null; + }, + + addClass: function(self, name) + { + if (!iui.hasClass(self,name)) self.className += " "+name; + }, + + removeClass: function(self, name) + { + if (iui.hasClass(self,name)) { + var reg = new RegExp('(\\s|^)'+name+'(\\s|$)'); + self.className=self.className.replace(reg,' '); + } + } +}; + +// ************************************************************************************************* + +addEventListener("load", function(event) +{ + var page = iui.getSelectedPage(); + var locPage = getPageFromLoc(); + + if (page) + iui.showPage(page); + + if (locPage && (locPage != page)) + iui.showPage(locPage); + + setTimeout(preloadImages, 0); + if (typeof window.onorientationchange == "object") + { + window.onorientationchange=orientChangeHandler; + hasOrientationEvent = true; + setTimeout(orientChangeHandler, 0); + } + setTimeout(checkOrientAndLocation, 0); + checkTimer = setInterval(checkOrientAndLocation, 300); +}, false); + +addEventListener("unload", function(event) +{ + return; +}, false); + +addEventListener("click", function(event) +{ + var link = findParent(event.target, "a"); + if (link) + { + function unselect() { link.removeAttribute("selected"); } + + if (link.href && link.hash && link.hash != "#" && !link.target) + { + link.setAttribute("selected", "true"); + iui.showPage($(link.hash.substr(1))); + setTimeout(unselect, 500); + } + else if (link == $("backButton")) + { + iui.goBack(); + } + else if (link.getAttribute("type") == "submit") + { + var form = findParent(link, "form"); + if (form.target == "_self") + { + form.submit(); + return; // allow default + } + submitForm(form); + } + else if (link.getAttribute("type") == "cancel") + { + cancelDialog(findParent(link, "form")); + } + else if (link.target == "_replace") + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", link, unselect); + } + else if (iui.isNativeUrl(link.href)) + { + return; + } + else if (link.target == "_webapp") + { + location.href = link.href; + } + else if (!link.target) + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", null, unselect); + } + else + return; + + event.preventDefault(); + } +}, true); + +addEventListener("click", function(event) +{ + var div = findParent(event.target, "div"); + if (div && hasClass(div, "toggle")) + { + div.setAttribute("toggled", div.getAttribute("toggled") != "true"); + event.preventDefault(); + } +}, true); + + +function sendEvent(type, node, props) +{ + if (node) + { + var event = document.createEvent("UIEvent"); + event.initEvent(type, false, false); // no bubble, no cancel + if (props) + { + for (i in props) + { + event[i] = props[i]; + } + } + node.dispatchEvent(event); + } +} + +function getPageFromLoc() +{ + var page; + var result = location.hash.match(/#_([^\?_]+)/); + if (result) + page = result[1]; + if (page) + page = $(page); + return page; +} + +function orientChangeHandler() +{ + var orientation=window.orientation; + switch(orientation) + { + case 0: + setOrientation(portraitVal); + break; + + case 90: + case -90: + setOrientation(landscapeVal); + break; + } +} + + +function checkOrientAndLocation() +{ + if (!hasOrientationEvent) + { + if ((window.innerWidth != currentWidth) || (window.innerHeight != currentHeight)) + { + currentWidth = window.innerWidth; + currentHeight = window.innerHeight; + var orient = (currentWidth < currentHeight) ? portraitVal : landscapeVal; + setOrientation(orient); + } + } + + if (location.hash != currentHash) + { + var pageId = location.hash.substr(hashPrefix.length); + iui.showPageById(pageId); + } +} + +function setOrientation(orient) +{ + document.body.setAttribute("orient", orient); +// Set class in addition to orient attribute: + if (orient == portraitVal) + { + iui.removeClass(document.body, landscapeVal); + iui.addClass(document.body, portraitVal); + } + else if (orient == landscapeVal) + { + iui.removeClass(document.body, portraitVal); + iui.addClass(document.body, landscapeVal); + } + else + { + iui.removeClass(document.body, portraitVal); + iui.removeClass(document.body, landscapeVal); + } + setTimeout(scrollTo, 100, 0, 1); +} + +function showDialog(page) +{ + currentDialog = page; + page.setAttribute("selected", "true"); + + if (hasClass(page, "dialog")) + showForm(page); +} + +function showForm(form) +{ + form.onsubmit = function(event) + { +// submitForm and preventDefault are called in the click handler +// when the user clicks the submit a.button +// + event.preventDefault(); + submitForm(form); + }; + + form.onclick = function(event) + { +// Why is this code needed? cancelDialog is called from +// the click hander. When will this be called? + if (event.target == form && hasClass(form, "dialog")) + cancelDialog(form); + }; +} + +function cancelDialog(form) +{ + form.removeAttribute("selected"); +} + +function updatePage(page, fromPage) +{ + if (!page.id) + page.id = "__" + (++newPageCount) + "__"; + + location.hash = currentHash = hashPrefix + page.id; + pageHistory.push(page.id); + + var pageTitle = $("pageTitle"); + if (page.title) + pageTitle.innerHTML = page.title; + var ttlClass = page.getAttribute("ttlclass"); + pageTitle.className = ttlClass ? ttlClass : ""; + + if (page.localName.toLowerCase() == "form" && !page.target) + showForm(page); + + var backButton = $("backButton"); + if (backButton) + { + var prevPage = $(pageHistory[pageHistory.length-2]); + if (prevPage && !page.getAttribute("hideBackButton")) + { + backButton.style.display = "inline"; + backButton.innerHTML = prevPage.title ? prevPage.title : "Back"; + var bbClass = prevPage.getAttribute("bbclass"); + backButton.className = (bbClass) ? 'button ' + bbClass : 'button'; + } + else + backButton.style.display = "none"; + } +} + +function slidePages(fromPage, toPage, backwards) +{ + var axis = (backwards ? fromPage : toPage).getAttribute("axis"); + + clearInterval(checkTimer); + + sendEvent("beforetransition", fromPage, {out:true}); + sendEvent("beforetransition", toPage, {out:false}); + if (canDoSlideAnim() && axis != 'y') + { + slide2(fromPage, toPage, backwards, slideDone); + } + else + { + slide1(fromPage, toPage, backwards, axis, slideDone); + } + + function slideDone() + { + if (!hasClass(toPage, "dialog")) + fromPage.removeAttribute("selected"); + checkTimer = setInterval(checkOrientAndLocation, 300); + setTimeout(updatePage, 0, toPage, fromPage); + fromPage.removeEventListener('webkitTransitionEnd', slideDone, false); + sendEvent("aftertransition", fromPage, {out:true}); + sendEvent("aftertransition", toPage, {out:false}); + + } +} + +function canDoSlideAnim() +{ + return (iui.animOn) && (typeof WebKitCSSMatrix == "object"); +} + +function slide1(fromPage, toPage, backwards, axis, cb) +{ + if (axis == "y") + (backwards ? fromPage : toPage).style.top = "100%"; + else + toPage.style.left = "100%"; + + scrollTo(0, 1); + toPage.setAttribute("selected", "true"); + var percent = 100; + slide(); + var timer = setInterval(slide, slideInterval); + + function slide() + { + percent -= slideSpeed; + if (percent <= 0) + { + percent = 0; + clearInterval(timer); + cb(); + } + + if (axis == "y") + { + backwards + ? fromPage.style.top = (100-percent) + "%" + : toPage.style.top = percent + "%"; + } + else + { + fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%"; + toPage.style.left = (backwards ? -percent : percent) + "%"; + } + } +} + + +function slide2(fromPage, toPage, backwards, cb) +{ + toPage.style.webkitTransitionDuration = '0ms'; // Turn off transitions to set toPage start offset + // fromStart is always 0% and toEnd is always 0% + // iPhone won't take % width on toPage + var toStart = 'translateX(' + (backwards ? '-' : '') + window.innerWidth + 'px)'; + var fromEnd = 'translateX(' + (backwards ? '100%' : '-100%') + ')'; + toPage.style.webkitTransform = toStart; + toPage.setAttribute("selected", "true"); + toPage.style.webkitTransitionDuration = ''; // Turn transitions back on + function startTrans() + { + fromPage.style.webkitTransform = fromEnd; + toPage.style.webkitTransform = 'translateX(0%)'; //toEnd + } + fromPage.addEventListener('webkitTransitionEnd', cb, false); + setTimeout(startTrans, 0); +} + +function preloadImages() +{ + var preloader = document.createElement("div"); + preloader.id = "preloader"; + document.body.appendChild(preloader); +} + +function submitForm(form) +{ + iui.addClass(form, "progress"); + iui.showPageByHref(form.action, encodeForm(form), form.method || "GET", null, clear); + function clear() { iui.removeClass(form, "progress"); } +} + +function encodeForm(form) +{ + function encode(inputs) + { + for (var i = 0; i < inputs.length; ++i) + { + if (inputs[i].name) + args[inputs[i].name] = inputs[i].value; + } + } + + var args = {}; + encode(form.getElementsByTagName("input")); + encode(form.getElementsByTagName("textarea")); + encode(form.getElementsByTagName("select")); + encode(form.getElementsByTagName("button")); + return args; +} + +function findParent(node, localName) +{ + while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName)) + node = node.parentNode; + return node; +} + +function hasClass(self, name) +{ + return iui.hasClass(self,name); +} + +function replaceElementWithFrag(replace, frag) +{ + var page = replace.parentNode; + var parent = replace; + while (page.parentNode != document.body) + { + page = page.parentNode; + parent = parent.parentNode; + } + page.removeChild(parent); + + var docNode; + while (frag.firstChild) { + docNode = page.appendChild(frag.firstChild); + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + } +} + +function $(id) { return document.getElementById(id); } +function ddd() { console.log.apply(console, arguments); } + +})(); diff --git a/views/index.haml b/views/index.haml new file mode 100644 index 0000000..93a5e26 --- /dev/null +++ b/views/index.haml @@ -0,0 +1,2 @@ +%a{ :href => '/standard' }stander version +%a{ :href => '/iui' }iui version diff --git a/views/iui/index.haml b/views/iui/index.haml new file mode 100644 index 0000000..20a8f5f --- /dev/null +++ b/views/iui/index.haml @@ -0,0 +1,40 @@ +.toolbar + %h1#pageTitle + %a#backButton.button{ :href => '#' } + +%ul#index{ :title => 'Factual Demo', :selected => 'true' } + %li + %a{ :href => '#users' } Users + %li + %a{ :href => '#signup' } Signup + +%ul#users{ :title => 'Users' } + - @users.each do |u| + %li + %a= u[:username] + +%form#signup.panel{ :title => 'Signup', :action => '/iui/signup', :method => 'POST' } + %h2 Register a new account + %fieldset + .row + %label username + %input{ :name => 'username', :type => 'text' }/ + .row + %label password + %input{ :name => 'password', :type => 'password' }/ + .row + %label repassword + %input{ :name => 'password_confirmation', :type => 'password' }/ + .row + %label I am at least 21 years old + %input{ :name => 'over_21', :type => 'checkbox' }/ + .row + %label + I accept the Factual + %a{ :href => '#terms_of_service' } Terms of Service + %input{ :name => 'terms_of_service', :type => 'checkbox' }/ + %a.whiteButton{ :href => '#', :type => 'submit' } Done + +%ul#terms_of_service{ :title => 'Terms of Service' } + %li + All legal text as required by our attorney diff --git a/views/iui/layout.haml b/views/iui/layout.haml new file mode 100644 index 0000000..904e14f --- /dev/null +++ b/views/iui/layout.haml @@ -0,0 +1,17 @@ +!!! +%html + %head + %meta{ 'http-equiv' => 'Content-Type', :content => 'text/html'}/ + %meta{ :name => "viewport", :content => "width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" }/ + %meta{ :name => "apple-mobile-web-app-capable", :content => "yes" }/ + -#%link{ :rel => "icon", :type => "image/png", :href => "TODO" } + -#%link{ :rel => "apple-touch-icon", :href => "TODO" } + %style{ :type => "text/css", :media => "screen" } @import "/css/iui.css"; + %style{ :type => "text/css", :media => "screen" } @import "/css/iui_default_theme/default-theme.css"; + %script{ :type => "application/x-javascript", :src => "/js/iui.js" } + %style{ :type => "text/css", :media => "screen" } + :sass + h2.error + :color red + %body + = yield diff --git a/views/iui/signup.haml b/views/iui/signup.haml new file mode 100644 index 0000000..33dab68 --- /dev/null +++ b/views/iui/signup.haml @@ -0,0 +1,25 @@ +%form#signup.panel{ :title => 'Signup', :action => '/iui/signup', :method => 'POST' } + %h2 Register a new account + %h2.error + %ul + - @errors.each_value do |value| + %li=value + %fieldset + .row + %label username + %input{ :name => 'username', :type => 'text' }/ + .row + %label password + %input{ :name => 'password', :type => 'password' }/ + .row + %label repassword + %input{ :name => 'password_confirmation', :type => 'password' }/ + .row + %label I am at least 21 years old + %input{ :name => 'over_21', :type => 'checkbox' }/ + .row + %label + I accept the Factual + %a{ :href => '#terms_of_service' } Terms of Service + %input{ :name => 'terms_of_service', :type => 'checkbox' }/ + %a.whiteButton{ :href => '#', :type => 'submit' } Done diff --git a/views/iui/success.haml b/views/iui/success.haml new file mode 100644 index 0000000..d941324 --- /dev/null +++ b/views/iui/success.haml @@ -0,0 +1,25 @@ +#success + .toolbar + %h1 Success + %a.back{ :href => '#index' } Back + .message + Thanks for you registion. + +#index + .toolbar + %h1 Factual Demo + %ul.links + %li.arrow + %a{ :href => '#users' } Users + %small.counter= @users.count + %li.arrow + %a{ :href => '#signup' } Signup + +#users + .toolbar + %h1 Users + %a.back{ :href => '#index' } Back + %ul.edgetoedge + - @users.each do |u| + %li + %a= u[:username] diff --git a/views/standard/index.haml b/views/standard/index.haml new file mode 100644 index 0000000..44f6b35 --- /dev/null +++ b/views/standard/index.haml @@ -0,0 +1,5 @@ +%h1 users +%ul + - @users.each do |u| + %li= u[:username] +%a{ :href => '/standard/signup' } signup diff --git a/views/standard/layout.haml b/views/standard/layout.haml new file mode 100644 index 0000000..b6c41ec --- /dev/null +++ b/views/standard/layout.haml @@ -0,0 +1,11 @@ +!!! +%html + %head + %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/ + %meta{ :id => 'viewport', :name => 'viewport', :content => 'width=320', :"initial-scale" => '1.0', :"maximum-scale" => '1.0', :"user-scalable" =>"0" }/ + %style{ :type => "text/css", :media => "screen" } + :sass + .error + :color red + %body + = yield diff --git a/views/standard/signup.haml b/views/standard/signup.haml new file mode 100644 index 0000000..9ee2dcd --- /dev/null +++ b/views/standard/signup.haml @@ -0,0 +1,37 @@ +- @errors ||= {} +%h1 Register a new account: +%form{ :method => 'post' } + %label username: + - if @errors[:username] + %br/ + %span.error=@errors[:username] + %br/ + %input{ :name => 'username' }/ + %br/ + %label password: + - if @errors[:password] + %br/ + %span.error=@errors[:password] + %br/ + %input{ :name => 'password', :type => 'password' }/ + %br/ + %label verify password: + - if @errors[:password_confirmation] + %br/ + %span.error=@errors[:password_confirmation] + %br/ + %input{ :name => 'password_confirmation', :type => 'password' }/ + %br/ + %input{ :name => 'over_21', :type => 'checkbox' }/ + I am at least 21 years old. + %br/ + %input{ :name => 'terms_of_service', :type => 'checkbox' }/ + I accept the Factual + %a{ :href => '/standard/terms_of_service' } Terms of Service + - if @errors[:statements] + %br/ + %span.error=@errors[:statements] + %br/ + %br/ + %input{ :type => 'submit', :value => 'done' } + %input{ :type => 'reset', :value => 'reset' } diff --git a/views/standard/terms_of_service.haml b/views/standard/terms_of_service.haml new file mode 100644 index 0000000..7a86147 --- /dev/null +++ b/views/standard/terms_of_service.haml @@ -0,0 +1,3 @@ +%h1 Terms of Service +%p + All legal text as required by our attorney
agate/onTap
5afd32e320b98dcc3def76c9dbc5449b0d698cb7
1. added shadow account token helper function 2. changed some ajax-iui files to meke it works
diff --git a/ajax-iui/main.rb b/ajax-iui/main.rb new file mode 100644 index 0000000..071be8c --- /dev/null +++ b/ajax-iui/main.rb @@ -0,0 +1,113 @@ +require 'rubygems' +require 'sinatra' +require 'sequel' + +DB = Sequel.sqlite +DB.create_table :users do + primary_key :id + String :username + String :password + Boolean :over_21 + Boolean :terms_of_service +end + +get '/' do + @users = DB[:users] + haml :index +end + +get '/terms_of_service' do + haml :terms_of_service +end + +post '/signup' do + @errors = verify + + if @errors.empty? + DB[:users].insert( + :username => params[:username], + :password => params[:password], + :over_21 => params[:over_21] == 'on', + :terms_of_service => params[:terms_of_service] == 'on' + ) + @users = DB[:users] + haml :success, :layout => false + else + haml :signup, :layout => false + end +end + +# ------------------------------------- +# verify methods +# ------------------------------------- + +def verify + errors = {} + if username_error = verify_username + errors[:username] = username_error + end + if password_error = verify_password + errors[:password] = password_error + end + if password_confirmation_error = verify_password_confirmation + errors[:password_confirmation] = password_confirmation_error + end + if statements_error = verify_statements + errors[:statements] = statements_error + end + return errors +end + +def verify_username + username = params[:username].to_s.strip + + if username.length == 0 + return 'Your username can not be blank' + end + + if username.length < 6 + return 'Your username must be at least 6 characters long' + end + + if DB[:users].filter(:username => username).count > 0 + return 'This username is taken' + end + + return false +end + +def verify_password + password = params[:password].to_s.strip + + if password.length == 0 + return 'Your password can not be blank' + end + + if password.length < 6 + return 'Your password must be at least 6 characters long' + end + + return false +end + +def verify_password_confirmation + password = params[:password].to_s.strip + password_confirmation = params[:password_confirmation].to_s.strip + + if password != password_confirmation + return 'Your passwords do not match' + end + + return false +end + +def verify_statements + over_21 = params[:over_21].to_s == 'on', + terms_of_service = params[:terms_of_service].to_s == 'on' + + if !over_21 || !terms_of_service + return 'You must agree with both of the statements, above.' + end + + return false +end diff --git a/ajax-iui/public/css/default/back-img.png b/ajax-iui/public/css/default/back-img.png new file mode 100644 index 0000000..9df2d7f Binary files /dev/null and b/ajax-iui/public/css/default/back-img.png differ diff --git a/ajax-iui/public/css/default/backButton.png b/ajax-iui/public/css/default/backButton.png new file mode 100644 index 0000000..e27ea8c Binary files /dev/null and b/ajax-iui/public/css/default/backButton.png differ diff --git a/ajax-iui/public/css/default/backButtonBack.png b/ajax-iui/public/css/default/backButtonBack.png new file mode 100644 index 0000000..f38e2d0 Binary files /dev/null and b/ajax-iui/public/css/default/backButtonBack.png differ diff --git a/ajax-iui/public/css/default/backButtonBrdr.png b/ajax-iui/public/css/default/backButtonBrdr.png new file mode 100644 index 0000000..9017168 Binary files /dev/null and b/ajax-iui/public/css/default/backButtonBrdr.png differ diff --git a/ajax-iui/public/css/default/blueButton.png b/ajax-iui/public/css/default/blueButton.png new file mode 100644 index 0000000..0f92dfd Binary files /dev/null and b/ajax-iui/public/css/default/blueButton.png differ diff --git a/ajax-iui/public/css/default/cancel.png b/ajax-iui/public/css/default/cancel.png new file mode 100644 index 0000000..5f6dcc8 Binary files /dev/null and b/ajax-iui/public/css/default/cancel.png differ diff --git a/ajax-iui/public/css/default/default-theme.css b/ajax-iui/public/css/default/default-theme.css new file mode 100644 index 0000000..1a866d9 --- /dev/null +++ b/ajax-iui/public/css/default/default-theme.css @@ -0,0 +1,107 @@ +/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ +body { + color: #000000; +} + +li > a[selected], li > a:active { + background-image: url(listArrowSel.png), url(selection.png) !important; +} + +li > a[selected="progress"] { + background-image: url(../default/loading.gif), url(selection.png) !important; +} + +/************************************************************************************************/ + +body > .toolbar { + background: url(toolbar.png) #6d84a2 repeat-x; +} + +.button { + -webkit-border-image: url(toolButton.png) 0 5 0 5; + -moz-border-image: url(toolButton.png) 0 5 0 5; +} + +.blueButton { + -webkit-border-image: url(blueButton.png) 0 5 0 5; + -moz-border-image: url(blueButton.png) 0 5 0 5; +} + +#backButton { + -webkit-border-image: url(backButtonBrdr.png) 0 8 0 14; + -moz-border-image: url(backButtonBrdr.png) 0 8 0 14; + background: url(backButtonBack.png) repeat-x; +} + + +.whiteButton { + -webkit-border-image: url(whiteButton.png) 0 12 0 12; + -moz-border-image: url(whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +.redButton { + -webkit-border-image: url(redButton.png) 0 12 0 12; + -moz-border-image: url(redButton.png) 0 12 0 12; +} + +.grayButton { + -webkit-border-image: url(grayButton.png) 0 12 0 12; + -moz-border-image: url(grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/************************************************************************************************/ + +body > ul > li.group { + opacity:0.7; + background: url(listGroup.png) repeat-x; +} + +body > ul > li > a { + background: url(listArrow.png) no-repeat right center; +} + +/************************************************************************************************/ + +.dialog > fieldset { + background: url(toolbar.png) #7388a5 repeat-x; +} + +/************************************************************************************************/ + +body > .panel { + background: #c8c8c8 url(pinstripes.png); +} + +.toggle { + border: 1px solid #888888; + background: #FFFFFF url(toggle.png) repeat-x; +} + +.toggle[toggled="true"] { + background: #194fdb url(toggleOn.png) repeat-x; +} + +.thumb { + background: #ffffff url(thumb.png) repeat-x; +} + +/************************************************************************************************/ +#preloader { + display: none; + background-image: url(loading.gif), url(selection.png), + url(blueButton.png), url(listArrowSel.png), url(listGroup.png); +} + +.toolbar > h1.titleImg { + background: url(title-img.png) no-repeat top center; + color: rgba(0,0,0,0); +} + +.backButtonImg { + width: 50px; + background: url(back-img.png) no-repeat center left, + url(backButtonBack.png) repeat-x top left !important; + color: rgba(0,0,0,0); +} diff --git a/ajax-iui/public/css/default/grayButton.png b/ajax-iui/public/css/default/grayButton.png new file mode 100644 index 0000000..0ce6a30 Binary files /dev/null and b/ajax-iui/public/css/default/grayButton.png differ diff --git a/ajax-iui/public/css/default/listArrow.png b/ajax-iui/public/css/default/listArrow.png new file mode 100644 index 0000000..6421a16 Binary files /dev/null and b/ajax-iui/public/css/default/listArrow.png differ diff --git a/ajax-iui/public/css/default/listArrowSel.png b/ajax-iui/public/css/default/listArrowSel.png new file mode 100644 index 0000000..86832eb Binary files /dev/null and b/ajax-iui/public/css/default/listArrowSel.png differ diff --git a/ajax-iui/public/css/default/listGroup.png b/ajax-iui/public/css/default/listGroup.png new file mode 100644 index 0000000..221553a Binary files /dev/null and b/ajax-iui/public/css/default/listGroup.png differ diff --git a/ajax-iui/public/css/default/loading.gif b/ajax-iui/public/css/default/loading.gif new file mode 100644 index 0000000..8522ddf Binary files /dev/null and b/ajax-iui/public/css/default/loading.gif differ diff --git a/ajax-iui/public/css/default/pinstripes.png b/ajax-iui/public/css/default/pinstripes.png new file mode 100644 index 0000000..c997775 Binary files /dev/null and b/ajax-iui/public/css/default/pinstripes.png differ diff --git a/ajax-iui/public/css/default/redButton.png b/ajax-iui/public/css/default/redButton.png new file mode 100644 index 0000000..210f156 Binary files /dev/null and b/ajax-iui/public/css/default/redButton.png differ diff --git a/ajax-iui/public/css/default/selection.png b/ajax-iui/public/css/default/selection.png new file mode 100644 index 0000000..537e3f0 Binary files /dev/null and b/ajax-iui/public/css/default/selection.png differ diff --git a/ajax-iui/public/css/default/thumb.png b/ajax-iui/public/css/default/thumb.png new file mode 100644 index 0000000..cefa8fc Binary files /dev/null and b/ajax-iui/public/css/default/thumb.png differ diff --git a/ajax-iui/public/css/default/title-img.png b/ajax-iui/public/css/default/title-img.png new file mode 100644 index 0000000..05c10a6 Binary files /dev/null and b/ajax-iui/public/css/default/title-img.png differ diff --git a/ajax-iui/public/css/default/toggle.png b/ajax-iui/public/css/default/toggle.png new file mode 100644 index 0000000..3b62ebf Binary files /dev/null and b/ajax-iui/public/css/default/toggle.png differ diff --git a/ajax-iui/public/css/default/toggleOn.png b/ajax-iui/public/css/default/toggleOn.png new file mode 100644 index 0000000..b016814 Binary files /dev/null and b/ajax-iui/public/css/default/toggleOn.png differ diff --git a/ajax-iui/public/css/default/toolButton.png b/ajax-iui/public/css/default/toolButton.png new file mode 100644 index 0000000..afe4d7a Binary files /dev/null and b/ajax-iui/public/css/default/toolButton.png differ diff --git a/ajax-iui/public/css/default/toolbar.png b/ajax-iui/public/css/default/toolbar.png new file mode 100644 index 0000000..3dde94c Binary files /dev/null and b/ajax-iui/public/css/default/toolbar.png differ diff --git a/ajax-iui/public/css/default/whiteButton.png b/ajax-iui/public/css/default/whiteButton.png new file mode 100644 index 0000000..5514b27 Binary files /dev/null and b/ajax-iui/public/css/default/whiteButton.png differ diff --git a/ajax-iui/public/css/iui.css b/ajax-iui/public/css/iui.css new file mode 100644 index 0000000..90e4d87 --- /dev/null +++ b/ajax-iui/public/css/iui.css @@ -0,0 +1,399 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ +body { + margin: 0; + font-family: Helvetica; + background: #FFFFFF; + color: #000000; + overflow-x: hidden; + -webkit-user-select: none; + -webkit-text-size-adjust: none; +} + +body > *:not(.toolbar) { + display: none; + position: absolute; + margin: 0; + padding: 0; + left: 0; + top: 45px; + width: 100%; + height: auto; + min-height: 415px; + -webkit-transition-duration: 300ms; + -webkit-transition-property: -webkit-transform; + -webkit-transform: translateX(0%); +} + +body[orient="landscape"] > *:not(.toolbar) { + height: auto; + min-height: 268px; +} + +body > *[selected="true"] { + display: block; +} + +li > a[selected], li > a:active { + background-color: #194fdb !important; + background-repeat: no-repeat, repeat-x !important; /* TG: !important */ + background-position: right center, left top !important; /* TG: !important */ + color: #FFFFFF !important; +} + +li > a[selected="progress"] { +} + +/************************************************************************************************/ + +body > .toolbar { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + border-top: 1px solid #6d84a2; + padding: 0 10px 10px 10px; + height: 45px; +} + +.toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + margin: 1px 0 0 -75px; + padding-top: 10px; + height: 45px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #FFFFFF; +} + +body[orient="landscape"] > .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +.button { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; +} + +.blueButton { + border-width: 0 5px; +} + +.leftButton { + left: 6px; + right: auto; +} + +#backButton { + display: none; + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; +} + +.whiteButton, +.redButton, +.grayButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +/* TG */ .grayButton[selected], .grayButton:active, +.whiteButton { + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +/* TG */ background:transparent !important; +} + +.redButton { +/* TG */ background:transparent !important; + color:#fff; + text-shadow: #7a0001 0 -1px 0; +} + +/* TG */ .whiteButton[selected], .whiteButton:active, +.grayButton { + color: #FFFFFF; +/* TG */ background:transparent !important; +} + +/************************************************************************************************/ + +body > ul > li { + position: relative; + margin: 0; + border-bottom: 1px solid #E0E0E0; + padding: 8px 0 8px 10px; + font-size: 20px; + font-weight: bold; + list-style: none; +} + +body > ul > li.group { + position: relative; + top: -1px; + margin-bottom: -2px; + border-top: 1px solid #7d7d7d; + border-bottom: 1px solid #999999; + padding: 1px 10px; + font-size: 17px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; + color: #FFFFFF; +} + +body > ul > li.group:first-child { + top: 0; + border-top: none; +} + +body > ul > li > a { + display: block; + margin: -8px 0 -8px -10px; + padding: 8px 32px 8px 10px; + text-decoration: none; + color: inherit; +} + +a[target="_replace"] { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding-top: 25px; + padding-bottom: 25px; + font-size: 18px; + color: cornflowerblue; + background-color: #FFFFFF; + background-image: none; +} + +/************************************************************************************************/ + +body > .dialog { + top: 0; + width: 100%; + min-height: 417px; + z-index: 2; + background: rgba(0, 0, 0, 0.8); + padding: 0; + text-align: right; +} + +.dialog > fieldset { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 0; + border: none; + border-top: 1px solid #6d84a2; + padding: 10px 6px; +} + +.dialog > fieldset > h1 { + margin: 0 10px 0 10px; + padding: 0; + font-size: 20px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; +} + +.dialog > fieldset > label { + position: absolute; + margin: 16px 0 0 6px; + font-size: 14px; + color: #999999; +} + +input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 8px 0 0 0; + padding: 6px 6px 6px 44px; + font-size: 16px; + font-weight: normal; +} + +/************************************************************************************************/ + +body > .panel { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding: 10px; +} + +.panel > ul, +.panel > fieldset { + position: relative; + margin: 0 0 20px 0; + padding: 0; + background: #FFFFFF; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border: 1px solid #999999; + text-align: right; + font-size: 16px; +} + +.panel > ul li, +.row { + position: relative; + min-height: 42px; + border-bottom: 1px solid #999999; + -webkit-border-radius: 0; + -moz-border-radius: 0; + text-align: right; +} + +.panel > ul li:last-child, +fieldset > .row:last-child { + border-bottom: none !important; +} + +.row > input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + margin: 0; + border: none; + padding: 12px 10px 0 110px; + height: 42px; + background: none; +} +.row > input[type|=radio], .row > input[type|=checkbox] { + margin: 7px 7px 0 0; + height: 25px; + width: 25px; +} + +.row > label { + position: absolute; + margin: 0 0 0 14px; + line-height: 42px; + font-weight: bold; +} + +.row > span { + position: absolute; + padding: 12px 10px 0 110px; + margin: 0; +} + +.row > .toggle { + position: absolute; + top: 6px; + right: 6px; + width: 100px; + height: 28px; +} + +.toggle { + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + font-size: 19px; + font-weight: bold; + line-height: 30px; +} + +.toggle[toggled="true"] { + border: 1px solid #143fae; +} + +.toggleOn { + display: none; + position: absolute; + width: 60px; + text-align: center; + left: 0; + top: 0; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; +} + +.toggleOff { + position: absolute; + width: 60px; + text-align: center; + right: 0; + top: 0; + color: #666666; +} + +.toggle[toggled="true"] > .toggleOn { + display: block; +} + +.toggle[toggled="true"] > .toggleOff { + display: none; +} + +.thumb { + position: absolute; + top: -1px; + left: -1px; + width: 40px; + height: 28px; + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; +} + +.toggle[toggled="true"] > .thumb { + left: auto; + right: -1px; +} + +.panel > h2 { + margin: 0 0 8px 14px; + font-size: inherit; + font-weight: bold; + color: #4d4d70; + text-shadow: rgba(255, 255, 255, 0.75) 2px 2px 0; +} + +/************************************************************************************************/ + +#preloader { + display: none; +} diff --git a/ajax-iui/public/css/iuix.css b/ajax-iui/public/css/iuix.css new file mode 100644 index 0000000..ab0001c --- /dev/null +++ b/ajax-iui/public/css/iuix.css @@ -0,0 +1 @@ +body{margin:0;font-family:Helvetica;background:#FFF;color:#000;overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;}body>*:not(.toolbar){display:none;position:absolute;margin:0;padding:0;left:0;top:45px;width:100%;height:auto;min-height:415px;-webkit-transition-duration:300ms;-webkit-transition-property:-webkit-transform;-webkit-transform:translateX(0%);}body[orient="landscape"]>*:not(.toolbar){height:auto;min-height:268px;}body>*[selected="true"]{display:block;}li>a[selected],li>a:active{background-color:#194fdb!important;background-repeat:no-repeat,repeat-x!important;background-position:right center,left top!important;color:#FFF!important;}body>.toolbar{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border-bottom:1px solid #2d3642;border-top:1px solid #6d84a2;padding:0 10px 10px 10px;height:45px;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;margin:1px 0 0 -75px;padding-top:10px;height:45px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#FFF;}body[orient="landscape"]>.toolbar>h1{margin-left:-125px;width:250px;}.button{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.6) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;}.blueButton{border-width:0 5px;}.leftButton{left:6px;right:auto;}#backButton{display:none;left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;}.whiteButton,.redButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.grayButton[selected],.grayButton:active,.whiteButton{text-shadow:rgba(255,255,255,0.7) 0 1px 0;background:transparent!important;}.redButton{background:transparent!important;color:#fff;text-shadow:#7a0001 0 -1px 0;}.whiteButton[selected],.whiteButton:active,.grayButton{color:#FFF;background:transparent!important;}body>ul>li{position:relative;margin:0;border-bottom:1px solid #E0E0E0;padding:8px 0 8px 10px;font-size:20px;font-weight:bold;list-style:none;}body>ul>li.group{position:relative;top:-1px;margin-bottom:-2px;border-top:1px solid #7d7d7d;border-bottom:1px solid #999;padding:1px 10px;font-size:17px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 1px 0;color:#FFF;}body>ul>li.group:first-child{top:0;border-top:none;}body>ul>li>a{display:block;margin:-8px 0 -8px -10px;padding:8px 32px 8px 10px;text-decoration:none;color:inherit;}a[target="_replace"]{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding-top:25px;padding-bottom:25px;font-size:18px;color:cornflowerblue;background-color:#FFF;background-image:none;}body>.dialog{top:0;width:100%;min-height:417px;z-index:2;background:rgba(0,0,0,0.8);padding:0;text-align:right;}.dialog>fieldset{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;width:100%;margin:0;border:none;border-top:1px solid #6d84a2;padding:10px 6px;}.dialog>fieldset>h1{margin:0 10px 0 10px;padding:0;font-size:20px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;}.dialog>fieldset>label{position:absolute;margin:16px 0 0 6px;font-size:14px;color:#999;}input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;width:100%;margin:8px 0 0 0;padding:6px 6px 6px 44px;font-size:16px;font-weight:normal;}body>.panel{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:10px;}.panel>ul,.panel>fieldset{position:relative;margin:0 0 20px 0;padding:0;background:#FFF;-webkit-border-radius:10px;-moz-border-radius:10px;border:1px solid #999;text-align:right;font-size:16px;}.panel>ul li,.row{position:relative;min-height:42px;border-bottom:1px solid #999;-webkit-border-radius:0;-moz-border-radius:0;text-align:right;}.panel>ul li:last-child,fieldset>.row:last-child{border-bottom:none!important;}.row>input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;margin:0;border:none;padding:12px 10px 0 110px;height:42px;background:none;}.row>input[type|=radio],.row>input[type|=checkbox]{margin:7px 7px 0 0;height:25px;width:25px;}.row>label{position:absolute;margin:0 0 0 14px;line-height:42px;font-weight:bold;}.row>span{position:absolute;padding:12px 10px 0 110px;margin:0;}.row>.toggle{position:absolute;top:6px;right:6px;width:100px;height:28px;}.toggle{border:1px solid #888;-webkit-border-radius:6px;-moz-border-radius:6px;font-size:19px;font-weight:bold;line-height:30px;}.toggle[toggled="true"]{border:1px solid #143fae;}.toggleOn{display:none;position:absolute;width:60px;text-align:center;left:0;top:0;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}.toggleOff{position:absolute;width:60px;text-align:center;right:0;top:0;color:#666;}.toggle[toggled="true"]>.toggleOn{display:block;}.toggle[toggled="true"]>.toggleOff{display:none;}.thumb{position:absolute;top:-1px;left:-1px;width:40px;height:28px;border:1px solid #888;-webkit-border-radius:6px;-moz-border-radius:6px;}.toggle[toggled="true"]>.thumb{left:auto;right:-1px;}.panel>h2{margin:0 0 8px 14px;font-size:inherit;font-weight:bold;color:#4d4d70;text-shadow:rgba(255,255,255,0.75) 2px 2px 0;}#preloader{display:none;} \ No newline at end of file diff --git a/ajax-iui/public/js/iui.js b/ajax-iui/public/js/iui.js new file mode 100644 index 0000000..5cbe4bb --- /dev/null +++ b/ajax-iui/public/js/iui.js @@ -0,0 +1,663 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ + + +(function() { + +var slideSpeed = 20; +var slideInterval = 0; + +var currentPage = null; +var currentDialog = null; +var currentWidth = 0; +var currentHeight = 0; +var currentHash = location.hash; +var hashPrefix = "#_"; +var pageHistory = []; +var newPageCount = 0; +var checkTimer; +var hasOrientationEvent = false; +var portraitVal = "portrait"; +var landscapeVal = "landscape"; + +// ************************************************************************************************* + +window.iui = +{ + animOn: true, // Slide animation with CSS transition is now enabled by default where supported + + httpHeaders: { + "X-Requested-With" : "XMLHttpRequest" + }, + + showPage: function(page, backwards) + { + if (page) + { +// if (window.iui_ext) window.iui_ext.injectEventMethods(page); // TG + + if (currentDialog) + { + currentDialog.removeAttribute("selected"); + // EVENT blur->currentDialog + sendEvent("blur", currentDialog); + currentDialog = null; + } + + if (hasClass(page, "dialog")) + { + // EVENT focus->page + sendEvent("focus", page); + showDialog(page); + } + else + { + sendEvent("load", page); // 127(stylesheet), 128(script), 129(onload) + // 130(onFocus), 133(loadActionButton) + var fromPage = currentPage; + // EVENT blur->currentPage + sendEvent("blur", currentPage); + currentPage = page; + // EVENT focus->currentPage + sendEvent("focus", page); + + if (fromPage) + { + if (backwards) sendEvent("unload", fromPage); + setTimeout(slidePages, 0, fromPage, page, backwards); + } + else + { + updatePage(page, fromPage); + } + + } + } + }, + + showPageById: function(pageId) + { + var page = $(pageId); + if (page) + { + var index = pageHistory.indexOf(pageId); + var backwards = index != -1; + if (backwards) + { + // we're going back, remove history from index on + // remember - pageId will be added again in updatePage + pageHistory.splice(index); + } + + iui.showPage(page, backwards); + } + }, + + goBack: function() + { + pageHistory.pop(); // pop current page + var pageID = pageHistory.pop(); // pop/get parent + var page = $(pageID); + iui.showPage(page, true); + }, + + showPageByHref: function(href, args, method, replace, cb) + { + // I don't think we need onerror, because readstate will still go to 4 in that case + function spbhCB(xhr) + { + if (xhr.readyState == 4) + { + // Add 'if (xhr.responseText)' to make sure we have something??? + var frag = document.createElement("div"); + frag.innerHTML = xhr.responseText; + // EVENT beforeInsert->body + sendEvent("beforeinsert", document.body, {fragment:frag}) + if (replace) + { + replaceElementWithFrag(replace, frag); + } + else + { + iui.insertPages(frag); + } + if (cb) + setTimeout(cb, 1000, true); + } + }; + iui.ajax(href, args, method, spbhCB); + }, + + // Callback function gets a single argument, the XHR + ajax: function(url, args, method, cb) + { + var xhr = new XMLHttpRequest(); + method = method ? method.toUpperCase() : "GET"; + if (args && method == "GET") + { + url = url + "?" + iui.param(args); + } + xhr.open(method, url, true); + if (cb) + { + xhr.onreadystatechange = function() { cb(xhr); }; + } + var data = null; + if (args && method != "GET") + { + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + data = iui.param(args); + } + for (var header in iui.httpHeaders) + { + xhr.setRequestHeader(header, iui.httpHeaders[header]); + } + xhr.send(data); + }, + + // Thanks, jQuery + // stripped-down, simplified, object-only version + param: function( o ) + { + var s = [ ]; + + // Serialize the key/values + for ( var key in o ) + s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(o[key]); + + // Return the resulting serialization + return s.join("&").replace(/%20/g, "+"); + }, + + insertPages: function(frag) + { + var nodes = frag.childNodes; + var targetPage; + for (var i = 0; i < nodes.length; ++i) + { + var child = nodes[i]; + if (child.nodeType == 1) + { + if (!child.id) + child.id = "__" + (++newPageCount) + "__"; + + var clone = $(child.id); + var docNode; + if (clone) { + clone.parentNode.replaceChild(child, clone); + docNode = $(child.id); + } + else + docNode = document.body.appendChild(child); + + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + + + if (child.getAttribute("selected") == "true" || !targetPage) + targetPage = child; + + --i; + } + } + if (targetPage) + iui.showPage(targetPage); + + }, + + getSelectedPage: function() + { + for (var child = document.body.firstChild; child; child = child.nextSibling) + { + if (child.nodeType == 1 && child.getAttribute("selected") == "true") + return child; + } + }, + isNativeUrl: function(href) + { + for(var i = 0; i < iui.nativeUrlPatterns.length; i++) + { + if(href.match(iui.nativeUrlPatterns[i])) return true; + } + return false; + }, + nativeUrlPatterns: [ + new RegExp("^http:\/\/maps.google.com\/maps\?"), + new RegExp("^mailto:"), + new RegExp("^tel:"), + new RegExp("^http:\/\/www.youtube.com\/watch\\?v="), + new RegExp("^http:\/\/www.youtube.com\/v\/"), + new RegExp("^javascript:"), + + ], + hasClass: function(self, name) + { + var re = new RegExp("(^|\\s)"+name+"($|\\s)"); + return re.exec(self.getAttribute("class")) != null; + }, + + addClass: function(self, name) + { + if (!iui.hasClass(self,name)) self.className += " "+name; + }, + + removeClass: function(self, name) + { + if (iui.hasClass(self,name)) { + var reg = new RegExp('(\\s|^)'+name+'(\\s|$)'); + self.className=self.className.replace(reg,' '); + } + } +}; + +// ************************************************************************************************* + +addEventListener("load", function(event) +{ + var page = iui.getSelectedPage(); + var locPage = getPageFromLoc(); + + if (page) + iui.showPage(page); + + if (locPage && (locPage != page)) + iui.showPage(locPage); + + setTimeout(preloadImages, 0); + if (typeof window.onorientationchange == "object") + { + window.onorientationchange=orientChangeHandler; + hasOrientationEvent = true; + setTimeout(orientChangeHandler, 0); + } + setTimeout(checkOrientAndLocation, 0); + checkTimer = setInterval(checkOrientAndLocation, 300); +}, false); + +addEventListener("unload", function(event) +{ + return; +}, false); + +addEventListener("click", function(event) +{ + var link = findParent(event.target, "a"); + if (link) + { + function unselect() { link.removeAttribute("selected"); } + + if (link.href && link.hash && link.hash != "#" && !link.target) + { + link.setAttribute("selected", "true"); + iui.showPage($(link.hash.substr(1))); + setTimeout(unselect, 500); + } + else if (link == $("backButton")) + { + iui.goBack(); + } + else if (link.getAttribute("type") == "submit") + { + var form = findParent(link, "form"); + if (form.target == "_self") + { + form.submit(); + return; // allow default + } + submitForm(form); + } + else if (link.getAttribute("type") == "cancel") + { + cancelDialog(findParent(link, "form")); + } + else if (link.target == "_replace") + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", link, unselect); + } + else if (iui.isNativeUrl(link.href)) + { + return; + } + else if (link.target == "_webapp") + { + location.href = link.href; + } + else if (!link.target) + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", null, unselect); + } + else + return; + + event.preventDefault(); + } +}, true); + +addEventListener("click", function(event) +{ + var div = findParent(event.target, "div"); + if (div && hasClass(div, "toggle")) + { + div.setAttribute("toggled", div.getAttribute("toggled") != "true"); + event.preventDefault(); + } +}, true); + + +function sendEvent(type, node, props) +{ + if (node) + { + var event = document.createEvent("UIEvent"); + event.initEvent(type, false, false); // no bubble, no cancel + if (props) + { + for (i in props) + { + event[i] = props[i]; + } + } + node.dispatchEvent(event); + } +} + +function getPageFromLoc() +{ + var page; + var result = location.hash.match(/#_([^\?_]+)/); + if (result) + page = result[1]; + if (page) + page = $(page); + return page; +} + +function orientChangeHandler() +{ + var orientation=window.orientation; + switch(orientation) + { + case 0: + setOrientation(portraitVal); + break; + + case 90: + case -90: + setOrientation(landscapeVal); + break; + } +} + + +function checkOrientAndLocation() +{ + if (!hasOrientationEvent) + { + if ((window.innerWidth != currentWidth) || (window.innerHeight != currentHeight)) + { + currentWidth = window.innerWidth; + currentHeight = window.innerHeight; + var orient = (currentWidth < currentHeight) ? portraitVal : landscapeVal; + setOrientation(orient); + } + } + + if (location.hash != currentHash) + { + var pageId = location.hash.substr(hashPrefix.length); + iui.showPageById(pageId); + } +} + +function setOrientation(orient) +{ + document.body.setAttribute("orient", orient); +// Set class in addition to orient attribute: + if (orient == portraitVal) + { + iui.removeClass(document.body, landscapeVal); + iui.addClass(document.body, portraitVal); + } + else if (orient == landscapeVal) + { + iui.removeClass(document.body, portraitVal); + iui.addClass(document.body, landscapeVal); + } + else + { + iui.removeClass(document.body, portraitVal); + iui.removeClass(document.body, landscapeVal); + } + setTimeout(scrollTo, 100, 0, 1); +} + +function showDialog(page) +{ + currentDialog = page; + page.setAttribute("selected", "true"); + + if (hasClass(page, "dialog")) + showForm(page); +} + +function showForm(form) +{ + form.onsubmit = function(event) + { +// submitForm and preventDefault are called in the click handler +// when the user clicks the submit a.button +// + event.preventDefault(); + submitForm(form); + }; + + form.onclick = function(event) + { +// Why is this code needed? cancelDialog is called from +// the click hander. When will this be called? + if (event.target == form && hasClass(form, "dialog")) + cancelDialog(form); + }; +} + +function cancelDialog(form) +{ + form.removeAttribute("selected"); +} + +function updatePage(page, fromPage) +{ + if (!page.id) + page.id = "__" + (++newPageCount) + "__"; + + location.hash = currentHash = hashPrefix + page.id; + pageHistory.push(page.id); + + var pageTitle = $("pageTitle"); + if (page.title) + pageTitle.innerHTML = page.title; + var ttlClass = page.getAttribute("ttlclass"); + pageTitle.className = ttlClass ? ttlClass : ""; + + if (page.localName.toLowerCase() == "form" && !page.target) + showForm(page); + + var backButton = $("backButton"); + if (backButton) + { + var prevPage = $(pageHistory[pageHistory.length-2]); + if (prevPage && !page.getAttribute("hideBackButton")) + { + backButton.style.display = "inline"; + backButton.innerHTML = prevPage.title ? prevPage.title : "Back"; + var bbClass = prevPage.getAttribute("bbclass"); + backButton.className = (bbClass) ? 'button ' + bbClass : 'button'; + } + else + backButton.style.display = "none"; + } +} + +function slidePages(fromPage, toPage, backwards) +{ + var axis = (backwards ? fromPage : toPage).getAttribute("axis"); + + clearInterval(checkTimer); + + sendEvent("beforetransition", fromPage, {out:true}); + sendEvent("beforetransition", toPage, {out:false}); + if (canDoSlideAnim() && axis != 'y') + { + slide2(fromPage, toPage, backwards, slideDone); + } + else + { + slide1(fromPage, toPage, backwards, axis, slideDone); + } + + function slideDone() + { + if (!hasClass(toPage, "dialog")) + fromPage.removeAttribute("selected"); + checkTimer = setInterval(checkOrientAndLocation, 300); + setTimeout(updatePage, 0, toPage, fromPage); + fromPage.removeEventListener('webkitTransitionEnd', slideDone, false); + sendEvent("aftertransition", fromPage, {out:true}); + sendEvent("aftertransition", toPage, {out:false}); + + } +} + +function canDoSlideAnim() +{ + return (iui.animOn) && (typeof WebKitCSSMatrix == "object"); +} + +function slide1(fromPage, toPage, backwards, axis, cb) +{ + if (axis == "y") + (backwards ? fromPage : toPage).style.top = "100%"; + else + toPage.style.left = "100%"; + + scrollTo(0, 1); + toPage.setAttribute("selected", "true"); + var percent = 100; + slide(); + var timer = setInterval(slide, slideInterval); + + function slide() + { + percent -= slideSpeed; + if (percent <= 0) + { + percent = 0; + clearInterval(timer); + cb(); + } + + if (axis == "y") + { + backwards + ? fromPage.style.top = (100-percent) + "%" + : toPage.style.top = percent + "%"; + } + else + { + fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%"; + toPage.style.left = (backwards ? -percent : percent) + "%"; + } + } +} + + +function slide2(fromPage, toPage, backwards, cb) +{ + toPage.style.webkitTransitionDuration = '0ms'; // Turn off transitions to set toPage start offset + // fromStart is always 0% and toEnd is always 0% + // iPhone won't take % width on toPage + var toStart = 'translateX(' + (backwards ? '-' : '') + window.innerWidth + 'px)'; + var fromEnd = 'translateX(' + (backwards ? '100%' : '-100%') + ')'; + toPage.style.webkitTransform = toStart; + toPage.setAttribute("selected", "true"); + toPage.style.webkitTransitionDuration = ''; // Turn transitions back on + function startTrans() + { + fromPage.style.webkitTransform = fromEnd; + toPage.style.webkitTransform = 'translateX(0%)'; //toEnd + } + fromPage.addEventListener('webkitTransitionEnd', cb, false); + setTimeout(startTrans, 0); +} + +function preloadImages() +{ + var preloader = document.createElement("div"); + preloader.id = "preloader"; + document.body.appendChild(preloader); +} + +function submitForm(form) +{ + iui.addClass(form, "progress"); + iui.showPageByHref(form.action, encodeForm(form), form.method || "GET", null, clear); + function clear() { iui.removeClass(form, "progress"); } +} + +function encodeForm(form) +{ + function encode(inputs) + { + for (var i = 0; i < inputs.length; ++i) + { + if (inputs[i].name) + args[inputs[i].name] = inputs[i].value; + } + } + + var args = {}; + encode(form.getElementsByTagName("input")); + encode(form.getElementsByTagName("textarea")); + encode(form.getElementsByTagName("select")); + encode(form.getElementsByTagName("button")); + return args; +} + +function findParent(node, localName) +{ + while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName)) + node = node.parentNode; + return node; +} + +function hasClass(self, name) +{ + return iui.hasClass(self,name); +} + +function replaceElementWithFrag(replace, frag) +{ + var page = replace.parentNode; + var parent = replace; + while (page.parentNode != document.body) + { + page = page.parentNode; + parent = parent.parentNode; + } + page.removeChild(parent); + + var docNode; + while (frag.firstChild) { + docNode = page.appendChild(frag.firstChild); + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + } +} + +function $(id) { return document.getElementById(id); } +function ddd() { console.log.apply(console, arguments); } + +})(); diff --git a/ajax-iui/public/js/iuix.js b/ajax-iui/public/js/iuix.js new file mode 100644 index 0000000..ff289e2 --- /dev/null +++ b/ajax-iui/public/js/iuix.js @@ -0,0 +1 @@ +(function(){var _1=20;var _2=0;var _3=null;var _4=null;var _5=0;var _6=0;var _7=location.hash;var _8="#_";var _9=[];var _a=0;var _b;var _c=false;var _d="portrait";var _e="landscape";window.iui={animOn:true,httpHeaders:{"X-Requested-With":"XMLHttpRequest"},showPage:function(_f,_10){if(_f){if(_4){_4.removeAttribute("selected");sendEvent("blur",_4);_4=null;}if(hasClass(_f,"dialog")){sendEvent("focus",_f);showDialog(_f);}else{sendEvent("load",_f);var _11=_3;sendEvent("blur",_3);_3=_f;sendEvent("focus",_f);if(_11){if(_10){sendEvent("unload",_11);}setTimeout(slidePages,0,_11,_f,_10);}else{updatePage(_f,_11);}}}},showPageById:function(_12){var _13=$(_12);if(_13){var _14=_9.indexOf(_12);var _15=_14!=-1;if(_15){_9.splice(_14);}iui.showPage(_13,_15);}},goBack:function(){_9.pop();var _16=_9.pop();var _17=$(_16);iui.showPage(_17,true);},showPageByHref:function(_18,_19,_1a,_1b,cb){function spbhCB(xhr){if(xhr.readyState==4){var _1e=document.createElement("div");_1e.innerHTML=xhr.responseText;sendEvent("beforeinsert",document.body,{fragment:_1e});if(_1b){replaceElementWithFrag(_1b,_1e);}else{iui.insertPages(_1e);}if(cb){setTimeout(cb,1000,true);}}}iui.ajax(_18,_19,_1a,spbhCB);},ajax:function(url,_20,_21,cb){var xhr=new XMLHttpRequest();_21=_21?_21.toUpperCase():"GET";if(_20&&_21=="GET"){url=url+"?"+iui.param(_20);}xhr.open(_21,url,true);if(cb){xhr.onreadystatechange=function(){cb(xhr);};}var _24=null;if(_20&&_21!="GET"){xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");_24=iui.param(_20);}for(var _25 in iui.httpHeaders){xhr.setRequestHeader(_25,iui.httpHeaders[_25]);}xhr.send(_24);},param:function(o){var s=[];for(var key in o){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(o[key]);}return s.join("&").replace(/%20/g,"+");},insertPages:function(_29){var _2a=_29.childNodes;var _2b;for(var i=0;i<_2a.length;++i){var _2d=_2a[i];if(_2d.nodeType==1){if(!_2d.id){_2d.id="__"+(++_a)+"__";}var _2e=$(_2d.id);var _2f;if(_2e){_2e.parentNode.replaceChild(_2d,_2e);_2f=$(_2d.id);}else{_2f=document.body.appendChild(_2d);}sendEvent("afterinsert",document.body,{insertedNode:_2f});if(_2d.getAttribute("selected")=="true"||!_2b){_2b=_2d;}--i;}}if(_2b){iui.showPage(_2b);}},getSelectedPage:function(){for(var _30=document.body.firstChild;_30;_30=_30.nextSibling){if(_30.nodeType==1&&_30.getAttribute("selected")=="true"){return _30;}}},isNativeUrl:function(_31){for(var i=0;i<iui.nativeUrlPatterns.length;i++){if(_31.match(iui.nativeUrlPatterns[i])){return true;}}return false;},nativeUrlPatterns:[new RegExp("^http://maps.google.com/maps?"),new RegExp("^mailto:"),new RegExp("^tel:"),new RegExp("^http://www.youtube.com/watch\\?v="),new RegExp("^http://www.youtube.com/v/"),new RegExp("^javascript:"),],hasClass:function(_33,_34){var re=new RegExp("(^|\\s)"+_34+"($|\\s)");return re.exec(_33.getAttribute("class"))!=null;},addClass:function(_36,_37){if(!iui.hasClass(_36,_37)){_36.className+=" "+_37;}},removeClass:function(_38,_39){if(iui.hasClass(_38,_39)){var reg=new RegExp("(\\s|^)"+_39+"(\\s|$)");_38.className=_38.className.replace(reg," ");}}};addEventListener("load",function(_3b){var _3c=iui.getSelectedPage();var _3d=getPageFromLoc();if(_3c){iui.showPage(_3c);}if(_3d&&(_3d!=_3c)){iui.showPage(_3d);}setTimeout(preloadImages,0);if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_c=true;setTimeout(orientChangeHandler,0);}setTimeout(checkOrientAndLocation,0);_b=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_3e){return;},false);addEventListener("click",function(_3f){var _40=findParent(_3f.target,"a");if(_40){function unselect(){_40.removeAttribute("selected");}if(_40.href&&_40.hash&&_40.hash!="#"&&!_40.target){_40.setAttribute("selected","true");iui.showPage($(_40.hash.substr(1)));setTimeout(unselect,500);}else{if(_40==$("backButton")){iui.goBack();}else{if(_40.getAttribute("type")=="submit"){var _41=findParent(_40,"form");if(_41.target=="_self"){_41.submit();return;}submitForm(_41);}else{if(_40.getAttribute("type")=="cancel"){cancelDialog(findParent(_40,"form"));}else{if(_40.target=="_replace"){_40.setAttribute("selected","progress");iui.showPageByHref(_40.href,null,"GET",_40,unselect);}else{if(iui.isNativeUrl(_40.href)){return;}else{if(_40.target=="_webapp"){location.href=_40.href;}else{if(!_40.target){_40.setAttribute("selected","progress");iui.showPageByHref(_40.href,null,"GET",null,unselect);}else{return;}}}}}}}}_3f.preventDefault();}},true);addEventListener("click",function(_42){var div=findParent(_42.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_42.preventDefault();}},true);function sendEvent(_44,_45,_46){if(_45){var _47=document.createEvent("UIEvent");_47.initEvent(_44,false,false);if(_46){for(i in _46){_47[i]=_46[i];}}_45.dispatchEvent(_47);}}function getPageFromLoc(){var _48;var _49=location.hash.match(/#_([^\?_]+)/);if(_49){_48=_49[1];}if(_48){_48=$(_48);}return _48;}function orientChangeHandler(){var _4a=window.orientation;switch(_4a){case 0:setOrientation(_d);break;case 90:case -90:setOrientation(_e);break;}}function checkOrientAndLocation(){if(!_c){if((window.innerWidth!=_5)||(window.innerHeight!=_6)){_5=window.innerWidth;_6=window.innerHeight;var _4b=(_5<_6)?_d:_e;setOrientation(_4b);}}if(location.hash!=_7){var _4c=location.hash.substr(_8.length);iui.showPageById(_4c);}}function setOrientation(_4d){document.body.setAttribute("orient",_4d);if(_4d==_d){iui.removeClass(document.body,_e);iui.addClass(document.body,_d);}else{if(_4d==_e){iui.removeClass(document.body,_d);iui.addClass(document.body,_e);}else{iui.removeClass(document.body,_d);iui.removeClass(document.body,_e);}}setTimeout(scrollTo,100,0,1);}function showDialog(_4e){_4=_4e;_4e.setAttribute("selected","true");if(hasClass(_4e,"dialog")){showForm(_4e);}}function showForm(_4f){_4f.onsubmit=function(_50){_50.preventDefault();submitForm(_4f);};_4f.onclick=function(_51){if(_51.target==_4f&&hasClass(_4f,"dialog")){cancelDialog(_4f);}};}function cancelDialog(_52){_52.removeAttribute("selected");}function updatePage(_53,_54){if(!_53.id){_53.id="__"+(++_a)+"__";}location.hash=_7=_8+_53.id;_9.push(_53.id);var _55=$("pageTitle");if(_53.title){_55.innerHTML=_53.title;}var _56=_53.getAttribute("ttlclass");_55.className=_56?_56:"";if(_53.localName.toLowerCase()=="form"&&!_53.target){showForm(_53);}var _57=$("backButton");if(_57){var _58=$(_9[_9.length-2]);if(_58&&!_53.getAttribute("hideBackButton")){_57.style.display="inline";_57.innerHTML=_58.title?_58.title:"Back";var _59=_58.getAttribute("bbclass");_57.className=(_59)?"button "+_59:"button";}else{_57.style.display="none";}}}function slidePages(_5a,_5b,_5c){var _5d=(_5c?_5a:_5b).getAttribute("axis");clearInterval(_b);sendEvent("beforetransition",_5a,{out:true});sendEvent("beforetransition",_5b,{out:false});if(canDoSlideAnim()&&_5d!="y"){slide2(_5a,_5b,_5c,slideDone);}else{slide1(_5a,_5b,_5c,_5d,slideDone);}function slideDone(){if(!hasClass(_5b,"dialog")){_5a.removeAttribute("selected");}_b=setInterval(checkOrientAndLocation,300);setTimeout(updatePage,0,_5b,_5a);_5a.removeEventListener("webkitTransitionEnd",slideDone,false);sendEvent("aftertransition",_5a,{out:true});sendEvent("aftertransition",_5b,{out:false});}}function canDoSlideAnim(){return (iui.animOn)&&(typeof WebKitCSSMatrix=="object");}function slide1(_5e,_5f,_60,_61,cb){if(_61=="y"){(_60?_5e:_5f).style.top="100%";}else{_5f.style.left="100%";}scrollTo(0,1);_5f.setAttribute("selected","true");var _63=100;slide();var _64=setInterval(slide,_2);function slide(){_63-=_1;if(_63<=0){_63=0;clearInterval(_64);cb();}if(_61=="y"){_60?_5e.style.top=(100-_63)+"%":_5f.style.top=_63+"%";}else{_5e.style.left=(_60?(100-_63):(_63-100))+"%";_5f.style.left=(_60?-_63:_63)+"%";}}}function slide2(_65,_66,_67,cb){_66.style.webkitTransitionDuration="0ms";var _69="translateX("+(_67?"-":"")+window.innerWidth+"px)";var _6a="translateX("+(_67?"100%":"-100%")+")";_66.style.webkitTransform=_69;_66.setAttribute("selected","true");_66.style.webkitTransitionDuration="";function startTrans(){_65.style.webkitTransform=_6a;_66.style.webkitTransform="translateX(0%)";}_65.addEventListener("webkitTransitionEnd",cb,false);setTimeout(startTrans,0);}function preloadImages(){var _6b=document.createElement("div");_6b.id="preloader";document.body.appendChild(_6b);}function submitForm(_6c){iui.addClass(_6c,"progress");iui.showPageByHref(_6c.action,encodeForm(_6c),_6c.method||"GET",null,clear);function clear(){iui.removeClass(_6c,"progress");}}function encodeForm(_6d){function encode(_6e){for(var i=0;i<_6e.length;++i){if(_6e[i].name){args[_6e[i].name]=_6e[i].value;}}}var _70={};encode(_6d.getElementsByTagName("input"));encode(_6d.getElementsByTagName("textarea"));encode(_6d.getElementsByTagName("select"));encode(_6d.getElementsByTagName("button"));return _70;}function findParent(_71,_72){while(_71&&(_71.nodeType!=1||_71.localName.toLowerCase()!=_72)){_71=_71.parentNode;}return _71;}function hasClass(_73,_74){return iui.hasClass(_73,_74);}function replaceElementWithFrag(_75,_76){var _77=_75.parentNode;var _78=_75;while(_77.parentNode!=document.body){_77=_77.parentNode;_78=_78.parentNode;}_77.removeChild(_78);var _79;while(_76.firstChild){_79=_77.appendChild(_76.firstChild);sendEvent("afterinsert",document.body,{insertedNode:_79});}}function $(id){return document.getElementById(id);}function ddd(){console.log.apply(console,arguments);}})(); \ No newline at end of file diff --git a/ajax-iui/views/index.haml b/ajax-iui/views/index.haml new file mode 100644 index 0000000..81df7a9 --- /dev/null +++ b/ajax-iui/views/index.haml @@ -0,0 +1,46 @@ +.toolbar + %h1#pageTitle + %a#backButton.button{ :href => '#' } + +%ul#index{ :title => 'Factual Demo', :selected => 'true' } + %li + %a{ :href => '#users' } Users + %li + %a{ :href => '#signup' } Signup + +%ul#users{ :title => 'Users' } + - @users.each do |u| + %li + %a= u[:username] + +%form#signup.panel{ :title => 'Signup', :action => '/signup', :method => 'POST' } + %h2 Register a new account + %fieldset + .row + %label username + %input{ :name => 'username', :type => 'text' }/ + .row + %label password + %input{ :name => 'password', :type => 'password' }/ + .row + %label repassword + %input{ :name => 'password_confirmation', :type => 'password' }/ + .row + %label I am at least 21 years old + .toggle + %span.thumb + %span.toggleOn YES + %span.toggleOff NO + .row + %label I accept the Factual + .toggle + %span.thumb + %span.toggleOn YES + %span.toggleOff NO + .row + %a{ :href => '#terms_of_service' } Terms of Service + %a.whiteButton{ :href => '#', :type => 'submit' } Done + +%ul#terms_of_service{ :title => 'Terms of Service' } + %li + All legal text as required by our attorney diff --git a/ajax-iui/views/layout.haml b/ajax-iui/views/layout.haml new file mode 100644 index 0000000..1591a6b --- /dev/null +++ b/ajax-iui/views/layout.haml @@ -0,0 +1,13 @@ +!!! +%html + %head + %meta{ 'http-equiv' => 'Content-Type', :content => 'text/html'}/ + %meta{ :name => "viewport", :content => "width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" }/ + %meta{ :name => "apple-mobile-web-app-capable", :content => "yes" }/ + -#%link{ :rel => "icon", :type => "image/png", :href => "TODO" } + -#%link{ :rel => "apple-touch-icon", :href => "TODO" } + %style{ :type => "text/css", :media => "screen" } @import "/css/iui.css"; + %style{ :type => "text/css", :media => "screen" } @import "/css/default/default-theme.css"; + %script{ :type => "application/x-javascript", :src => "/js/iui.js" } + %body + = yield diff --git a/ajax-iui/views/signup.haml b/ajax-iui/views/signup.haml new file mode 100644 index 0000000..0cab4fa --- /dev/null +++ b/ajax-iui/views/signup.haml @@ -0,0 +1,27 @@ +%form#signup.panel{ :title => 'Signup', :action => '/signup', :method => 'POST' } + %h2 Register a new account [error] + %fieldset + .row + %label username + %input{ :name => 'username', :type => 'text' }/ + .row + %label password + %input{ :name => 'password', :type => 'password' }/ + .row + %label repassword + %input{ :name => 'password_confirmation', :type => 'password' }/ + .row + %label I am at least 21 years old + .toggle + %span.thumb + %span.toggleOn YES + %span.toggleOff NO + .row + %label I accept the Factual + .toggle + %span.thumb + %span.toggleOn YES + %span.toggleOff NO + .row + %a{ :href => '#terms_of_service' } Terms of Service + %a.whiteButton{ :href => '#', :type => 'submit' } Done diff --git a/ajax-iui/views/success.haml b/ajax-iui/views/success.haml new file mode 100644 index 0000000..d941324 --- /dev/null +++ b/ajax-iui/views/success.haml @@ -0,0 +1,25 @@ +#success + .toolbar + %h1 Success + %a.back{ :href => '#index' } Back + .message + Thanks for you registion. + +#index + .toolbar + %h1 Factual Demo + %ul.links + %li.arrow + %a{ :href => '#users' } Users + %small.counter= @users.count + %li.arrow + %a{ :href => '#signup' } Signup + +#users + .toolbar + %h1 Users + %a.back{ :href => '#index' } Back + %ul.edgetoedge + - @users.each do |u| + %li + %a= u[:username] diff --git a/ajax-jqtouch/main.rb b/ajax-jqtouch/main.rb index c69cabf..071be8c 100644 --- a/ajax-jqtouch/main.rb +++ b/ajax-jqtouch/main.rb @@ -1,114 +1,113 @@ require 'rubygems' require 'sinatra' require 'sequel' -require 'activerecord' DB = Sequel.sqlite DB.create_table :users do primary_key :id String :username String :password Boolean :over_21 Boolean :terms_of_service end get '/' do @users = DB[:users] haml :index end get '/terms_of_service' do haml :terms_of_service end post '/signup' do @errors = verify if @errors.empty? DB[:users].insert( :username => params[:username], :password => params[:password], :over_21 => params[:over_21] == 'on', :terms_of_service => params[:terms_of_service] == 'on' ) @users = DB[:users] haml :success, :layout => false else haml :signup, :layout => false end end # ------------------------------------- # verify methods # ------------------------------------- def verify errors = {} if username_error = verify_username errors[:username] = username_error end if password_error = verify_password errors[:password] = password_error end if password_confirmation_error = verify_password_confirmation errors[:password_confirmation] = password_confirmation_error end if statements_error = verify_statements errors[:statements] = statements_error end return errors end def verify_username username = params[:username].to_s.strip if username.length == 0 return 'Your username can not be blank' end if username.length < 6 return 'Your username must be at least 6 characters long' end if DB[:users].filter(:username => username).count > 0 return 'This username is taken' end return false end def verify_password password = params[:password].to_s.strip if password.length == 0 return 'Your password can not be blank' end if password.length < 6 return 'Your password must be at least 6 characters long' end return false end def verify_password_confirmation password = params[:password].to_s.strip password_confirmation = params[:password_confirmation].to_s.strip if password != password_confirmation return 'Your passwords do not match' end return false end def verify_statements over_21 = params[:over_21].to_s == 'on', terms_of_service = params[:terms_of_service].to_s == 'on' if !over_21 || !terms_of_service return 'You must agree with both of the statements, above.' end return false end diff --git a/stander/core.rb b/stander/core.rb new file mode 100644 index 0000000..580a630 --- /dev/null +++ b/stander/core.rb @@ -0,0 +1,13 @@ +require 'rubygems' +require 'json' + +class Factual + @@API_KEY = 'RQUDw0JQVzIygq4a72vJfVzExopz2c8CvOVsTTToIUGgphCOhbgttGAYfXv8eiMC' + @@URL = 'http://branch.honghao.sci/api/v2/sessions/get_token' + + def self.get_token(username) + result = `curl -d api_key=#{@@API_KEY} -d unique_id=#{username} #{@@URL}` + token = JSON.parse(result)['string'] + return token + end +end
agate/onTap
e39685901cddeeae3b083a143c0fd12d4bd181c1
added iui version
diff --git a/ajax-iui/iui/ext-sandbox/masabi/iui_ext.js b/ajax-iui/iui/ext-sandbox/masabi/iui_ext.js new file mode 100644 index 0000000..8324b69 --- /dev/null +++ b/ajax-iui/iui/ext-sandbox/masabi/iui_ext.js @@ -0,0 +1,608 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + */ + +// requires iui.js +// requires querySelectorAll, therefore iPhone OS 2.x or later +// or Safari 3.x or later +// requires DOMContentLoaded event + +/* + Portions Copyright (c) 2009, Masabi Ltd + http://www.masabi.com/ + */ + + +(function() { + +var TODAY="Today"; +var DAYS=new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); +var MONTHS=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); + +var nameLabelLookup = new Array(); +var sesh = new Array(); + +// ************************************************************************************************* + +window.iui_ext = +{ + // replacements for HTML5 sessionStorage object, not implemented for iPhone Safari (<v4) + setItem: function(key,value) { sesh[key] = value; }, + getItem: function(key) { return sesh[key]; }, + removeItem: function(key) { sesh[key] = null; }, + clear: function() { sesh=new Array(); }, +}; + +addEventListener("DOMContentLoaded", function(event) +{ +// Use afterinsert to injectEventMethods on inserted (via ajax) nodes + document.body.addEventListener('afterinsert', afterInsert, false); +// This will register event handlers on all initial form nodes + nodes = document.querySelectorAll("body > form"); + for (var i = 0; i < nodes.length ; i++) + { + injectEventMethods(nodes[i]); + } +}, false); + +function injectEventMethods(page) +{ + // avoid recursion! + if (page.done) return; + page.done = true; + + // overriding methods in the prototype just didn't want to work... + if (page.tagName=="FORM") + { + // preserve any explicitly defined events in markup + page._onfocus = page.onfocus; + page._onblur = page.onblur; + page.onfocus = function(event) + { + setFormTags(page,"var"); + // swap out any special funky screen types (inputs first, because selects > inputs) + var fields = page.getElementsByTagName("input"); + for (var i=fields.length-1; i>=0; i--) + { + applyFormTagValue(fields[i]); + // if unsupported, html5 types are replaced with 'text' + if (hasClass(fields[i],"date") && fields[i].type!="date") + convertInputToDatePicker(fields[i]); + } + fields = page.getElementsByTagName("select"); + for (var i=fields.length-1; i>=0; i--) + { + applyFormTagValue(fields[i]); + if (hasClass(fields[i],"panel")) + convertSelectToPanel(fields[i]); + else if (hasClass(fields[i],"az")) + convertSelectToSortedList(fields[i]); + } + if (page._onfocus) page._onfocus(event); + }; + page.onblur = function(event) + { + storeFormTags(page,"input"); + storeFormTags(page,"select"); + if (page._onblur) page._onblur(event); + }; + } +} + +function afterInsert(e) +{ + injectEventMethods(e.insertedNode); // injectEventMethods on newly added node +} + +function back() +{ + history.back(); +} + +function storeFormTags(form,tagName) +{ + var fields = form.getElementsByTagName(tagName); + for (i=0; i<fields.length; i++) + storeFormTagValue(fields[i]); +} + +function storeFormTagValue(tag) +{ + try + { + if (tag.tagName=="SELECT") + window.iui_ext.setItem(tag.name, tag.options[tag.selectedIndex].value); + else if (tag.type=="radio") + { + if (tag.checked) window.iui_ext.setItem(tag.name, tag.value); + } + else if (tag.type=="checkbox") + { + if (tag.checked) window.iui_ext.setItem(tag.name, tag.value); + else window.iui_ext.removeItem(tag.name); + } + else + window.iui_ext.setItem(tag.name, tag.value); + } + catch (e) { } +} + +function setFormTags(form, tagName) +{ + var fields = form.getElementsByTagName(tagName); + for (i=0; i<fields.length; i++) + applyFormTagValue(fields[i]); +} + +function applyFormTagValue(tag) +{ + try + { + var value = window.iui_ext.getItem(tag.name?tag.name:tag.title); + if (value) + { + if (tag.tagName=="SELECT") + { + // TODO + } + else if (tag.tagName=="VAR") + { + if (hasClass(tag,"_lookup")) + { + // preserve class names before _lookup, but not after (and put the current value's class after) + tag.className = tag.className.substring(0,tag.className.indexOf("_lookup")+7)+" "+value; + var path = tag.id.split("-"); + tag.textContent = nameLabelLookup[path[0]][value]; + } + else tag.textContent = value; + } + else if (tag.type=="radio") + tag.checked = (tag.value==value); + else if (tag.type=="checkbox") + tag.checked = true; + else + tag.value = value; + } + else if (tag.type=="checkbox") + tag.checked = false; + } + catch (e) { alert(e); } +} + + +function convertSelectToSortedList(select) +{ + // note: assumes select is pre-sorted + var caption=findLabelForTag(select); + var name="az__"+select.id; + var generated=addChild(document.body,"ul","az",name),n,c,o; + generated.title=caption; + generated.name=select.name; + generated.addEventListener('focus',azFocus,true); + generated.addEventListener('blur',azBlur,true); + var nav=addChild(generated,"nav"); + + // build name/value map of children, adding radios to the new form + nameLabelLookup[select.name] = new Array(); + for (var i=0; i<select.options.length; i++) + { + o=select.options[i]; + nameLabelLookup[select.name][o.value] = o.textContent; + n=o.textContent.charAt(0).toUpperCase(); + if (n!=c) + { + c=n; + addChild(addChild(generated,"li","group"),"a",null,null,c).id=name+"_"+c; + n=addChild(nav,"div",null,null,c); + n.jump=name+"_"+c; + n.addEventListener("click",azNavClick,true); + } + n=addChild(generated,"li",null,null,o.textContent); + n._value=o.value; + n.onclick=azClick; + } + + // replace select with link + hidden tag + n = select.options[select.selectedIndex].value; + replaceField(select.parentNode,caption,select.name,n,"#"+name,select.name+"-"+select.id,nameLabelLookup[select.name][n]); +} + +var azNav; + +function azFocus(e) +{ + var a=this?this:e.target; + azSelectLi(window.iui_ext.getItem(a.name),a); + azNav=f(a,"nav"); + azNav.style.position="absolute"; + azScroll(); + document.addEventListener("scroll",azScroll,true); +} + +function azBlur() +{ + document.removeEventListener("scroll",azScroll,true); + azNav=null; +} + +function azScroll() +{ + azNav.style.top=(window.pageYOffset)+"px"; +} + +function azNavClick(e) +{ + // we can't just use a relative # link, because that would add itself to the history + var top=0, obj=$(e.target.jump); + do {top += obj.offsetTop; } + while (obj = obj.offsetParent); + document.body.scrollTop=top; + azScroll(); +} + +function azClick(e) +{ + azSelectLi(e.target._value,e.target.parentNode); + window.iui_ext.setItem(e.target.parentNode.name, e.target._value); + back(); +} + +function azSelectLi(sel,ul) +{ + if (!sel) return; + var lis=ul.getElementsByTagName("li"); + for (var i=0; i<lis.length; i++) + { + if (lis[i]._value==sel) lis[i].className = "selected"; + else if (lis[i]._value) lis[i].className = null; + } +} + + +function convertSelectToPanel(select) +{ + // add new panel to the DOM + var caption=findLabelForTag(select); + var generated=addChild(document.body,"form","panel","select__"+select.id), n; + generated.title = caption; + // add fieldset child + generated = addChild(generated,"fieldset","radiogroup"); + + // build name/value map of children, adding radios to the new form + nameLabelLookup[select.name] = new Array(); + for (var i=0; i<select.options.length; i++) + { + var o = select.options[i]; + nameLabelLookup[select.name][o.value] = o.textContent; + var m = addChild(addChild(generated,"div","row"),"label",o.value,null,o.textContent) + m.htmlFor = select.id+"_option_"+o.value; + n = addChild(m,"input",null,select.id+"_option_"+o.value); + n.type = "radio"; + n.value = o.value; + n.checked = (i==select.selectedIndex); + n.name = select.name; + m.onclick = n.onclick = function() { (this.lastChild ? this.lastChild : this).checked=true; back(); return false; }; + } + + // replace select with link + hidden tag + n = select.options[select.selectedIndex].value; + replaceField(select.parentNode,caption,select.name,n,"#select__"+select.id,select.name+"-"+select.id,nameLabelLookup[select.name][n]); +} + + + +function convertInputToDatePicker(input) +{ + // replace current field + var cal=replaceField(input.parentNode,findLabelForTag(input),input.name,input.value,"#_datepicker", + input.name,input.value,"date"); + cal.addEventListener('click',dpLaunch,true); + f(cal,"input").className=input.className.replace("date",""); + + if ($("_datepicker")) return; + // add date picker once + cal = addChild(document.body,"form","panel","_datepicker"); +// cal.onfocus = function(e){ dpLaunch(e); } + var t = addChild(cal,"p"); + addChild(t,"span","back","_dpback"," ").onclick=dpBack; + addChild(t,"span","month","_dpmonth").onclick=dpToday; + addChild(t,"input",null,"_dphidden").type="hidden"; // name set in dpLaunch + addChild(t,"span","fwd","_dpfwd"," ").onclick=dpFwd; + + // build empty contents + t = addChild(cal,"table",null,"_dptable"); + t.cellSpacing=0; + t.cellPadding=0; + t.border=0; + t=addChild(t,"colgroup"); + addChild(t,"col","sun"); addChild(t,"col","mon"); + addChild(t,"col","tue"); addChild(t,"col","wed"); + addChild(t,"col","thu"); addChild(t,"col","fri"); + addChild(t,"col","sat"); + t=addChild(t.parentNode,"thead"); + var i; + var tr = addChild(t,"tr","days"); + for (i=0; i<DAYS.length; i++) + addChild(tr,"th",null,null,DAYS[i]); + t=addChild(t.parentNode,"tbody"); + for (i=1; i<7; i++) + { + tr = addChild(t,"tr","wk"+i); + for (var day=0; day<7; day++) + addChild(tr,"td",null,null," "); + } +} + +function dpLaunch(e) +{ + var a = this?this:e.target; + while (a && a.tagName!="A") a=a.parentNode; + // set up calendar before we move to it + $("_datepicker").title = findLabelForTag(a); + // apply some end points? + var dp=$("_dptable"), v=f(a,"input"); + // clear selected date, so it is parsed from the hidden field in update + dp.minDate = hasClass(v,"future") ? new Date():null; + dp.maxDate = hasClass(v,"past") ? new Date():null; + a=$("_dphidden"); + a.className=v.className; + a.name=v.name; + a.value=v.value; + dp.date=s2d(a); + dp.marker=new Date(dp.date); + // now refresh + dpUpdate(); +} + +function dpBack() +{ + dpUpdate(-1); +} + +function dpFwd() +{ + dpUpdate(1); +} + +function dpToday() +{ + $("_dptable").marker = new Date(); + dpUpdate(); +} + +function dpUpdate(adjust) +{ + var t = $("_dptable"); + var d = t.marker; + // optional arg can be used to move back/forward a month + if (adjust) + d.setMonth(d.getMonth()+adjust); + t.marker = d; + // date comparisons include the time, so make sure we push min/max out to extreme ends of the day + if (t.maxDate) { t.maxDate.setHours(23); t.maxDate.setMinutes(59); } + if (t.minDate) { t.minDate.setHours(0); t.minDate.setMinutes(1); } + $("_dpmonth").textContent = MONTHS[d.getMonth()]+" "+(1900+d.getYear()); + // populate days from date + var cursor = new Date(d); + cursor.setDate(1); + $("_dpback").style.display = (t.minDate && t.minDate>cursor)?"none":"block"; + cursor.setDate(1-cursor.getDay()); + + var month = d.getMonth(); + var today = new Date(); + var trs = t.getElementsByTagName("tr"); + for (var wk=1; wk<trs.length; wk++) + { + for (var i=0; i<7; i++) + { + var td = trs[wk].childNodes[i]; + if ((t.minDate && cursor<t.minDate) || (t.maxDate && cursor>t.maxDate)) + { + td.className="outofrange"; + td.onclick=null; + td.date=null; + td.textContent=" "; + } + else + { + td.className = cursor.getMonth()==month?"current":"other"; + if (dpEquals(cursor,t.date)) + td.className=td.className+" selected"; + td.onclick=dpSelect; + td.date=new Date(cursor); + td.textContent = cursor.getDate(); + } + if (dpEquals(cursor,today)) + td.className=td.className+" today"; + cursor.setDate(cursor.getDate()+1); + } + } + $("_dpfwd").style.display = (t.maxDate && t.maxDate<cursor)?"none":"block"; +} + +function dpSelect() +{ + // make initial selection + var tds = this.parentNode.parentNode.getElementsByTagName("td"); + for (var i=0; i<tds.length; i++) + { + if (hasClass(tds[i],"selected")) + { + tds[i].className = tds[i].className.replace("selected",""); + break; + } + } + this.className = "selected "+this.className; + $("_dptable").date = this.date; + tds=$("_dphidden"); + tds.value = d2s(this.date,tds.className); + iui_ext.setItem(tds.name,tds.value); + back(); +} + +function dpEquals(a,b) +{ + return (a.getDate()==b.getDate() && a.getMonth()==b.getMonth() && a.getFullYear()==b.getFullYear()); +} + + + + +function replaceField(row,caption,name,value,link,varId,varValue,varClass) +{ + while (row.hasChildNodes()) + row.removeChild(row.firstChild); + var n = document.createElement("a"); + n.href = link; + n.textContent = caption; + row.appendChild(n); + row = n; + n = document.createElement("input"); + n.type = "hidden"; + n.name = name; + n.value = value; + row.appendChild(n); + addChild(row,"var",varClass?varClass:"_lookup "+value,varId,varValue).name=name; // note: name not part of standard DOM, we're adding for convenience + return row; +} + +function addChild(parent,tagName,className,id,contents) +{ + var c = document.createElement(tagName); + if (className) c.className = className; + if (id) c.id = id; + if (contents) c.textContent = contents; + parent.appendChild(c); + return c; +} + +function findLabelForTag(tag) +{ + // if parent has a label, go with it, else try any text in the parent + var l = tag.parentNode.getElementsByTagName("label"); + if (l && l.length>0) return l[0].textContent; + // probably we only want the *immediate* first bit of text, rather than all text in all child tags merged together + for (var i=0; i<tag.childNodes.length; i++) + if (tag.childNodes[i].nodeType==3) + return tag.childNodes[i].textContent; + return tag.parentNode.textContent; +} + + +function s2d(s,format) +{ + // may just have passed in an input tag + if (!format && s.value) + { + format=s.className; + s=s.value; + } + var d=new Date(); + if (eqic(s,TODAY)) return d; + format=dfGetFormat(format); + s=s.replace(/[_\/\-]/g," ").split(" "); + var j=0; + for (var i=0; i<format.length&&j<s.length; i++) + { + if (s.length>0 && s[j].charAt(s.length-1)==',') + s[j]=s[j].substring(0,s[j].length-1); + switch (format.charAt(i)) + { + case 'd': + d.setDate(pInt(s[j++])); + break; + case 'D': + j++; + break; + case 'm': + d.setMonth(pInt(s[j++])-1); + break; + case 'M': + { + var n=0; + for (var m=0;m<MONTHS.length;m++) + { + if (eqic(s[j],MONTHS[m].substring(0,3))) + { + n=m; + break; + } + } + d.setMonth(n); + j++; + } + break; + case 'y': + case 'Y': + d.setYear((pInt(s[j++])%100)+2000); // safe for a few years :) + break; + } + } + return d; +} + + +function d2s(d,format) +{ + if (hasClass(format,"today") && dpEquals(d,new Date())) return TODAY; + format=dfGetFormat(format); + var s=""; + for (var i=0; i<format.length; i++) + { + switch (format.charAt(i)) + { + case 'd': + s+=d.getDate(); + break; + case 'D': + s+=DAYS[d.getDay()]; + break; + case 'm': + s+=(d.getMonth()+1); + break; + case 'M': + s+=MONTHS[d.getMonth()].substring(0,3); + break; + case 'y': + s+=(""+d.getFullYear()).substring(2); + break; + case 'Y': + s+=d.getFullYear(); + break; + case 'c': s+=','; break; + case '-': s+='-'; break; + case '_': s+=' '; break; + case '/': s+='/'; break; + } + } + return s; +} + +function dfGetFormat(classList) +{ + var c=classList.split(" "); + for (var i=0; i<c.length; i++) + if (c[i].indexOf("/")>-1 || c[i].indexOf("_")>-1 || c[i].indexOf("-")>-1) + return c[i]; + return "D_d_Mc_y"; +} + + + +function pInt(s) +{ + // on Safari, parseInt("09") returns 0. right. + while (s.charAt(0)=='0' || s.charAt(0)==' ') s=s.substring(1); + return parseInt(s); +} + +function eqic(a,b) +{ + return (new String(a.toLowerCase())==(new String(b)).toLowerCase()); +} + +function $(i) { return document.getElementById(i); } +function f(e,t) { return e.getElementsByTagName(t)[0]; } +function hasClass(t,c) { return (" "+(t.className?t.className:t)+" ").indexOf(" "+c+" ")>-1; } +})(); diff --git a/ajax-iui/iui/ext-sandbox/masabi/t/default/dpBack.png b/ajax-iui/iui/ext-sandbox/masabi/t/default/dpBack.png new file mode 100644 index 0000000..cfada11 Binary files /dev/null and b/ajax-iui/iui/ext-sandbox/masabi/t/default/dpBack.png differ diff --git a/ajax-iui/iui/ext-sandbox/masabi/t/default/dpFwd.png b/ajax-iui/iui/ext-sandbox/masabi/t/default/dpFwd.png new file mode 100644 index 0000000..1bba299 Binary files /dev/null and b/ajax-iui/iui/ext-sandbox/masabi/t/default/dpFwd.png differ diff --git a/ajax-iui/iui/ext-sandbox/masabi/t/default/iui_ext.css b/ajax-iui/iui/ext-sandbox/masabi/t/default/iui_ext.css new file mode 100644 index 0000000..7556fdf --- /dev/null +++ b/ajax-iui/iui/ext-sandbox/masabi/t/default/iui_ext.css @@ -0,0 +1,64 @@ +/* iUI EXTENSIONS */ +.panel > ul { margin:5px 0 15px 0; padding:0; list-style:none; -webkit-border-radius:0; border-width:0; background-color:transparent; } +.panel > ul > li { margin:0; padding:0; border-width:0; } +.panel > ul > li a, .row > a { text-align:left; padding:11px 0 9px 10px; background:url(listArrow.png) center right no-repeat; display:block; text-decoration:none; overflow:hidden; text-overflow:ellipsis; color:#000; font-weight:bold; font-size:17px; } +.panel > ul > li a { margin:0; border:1px solid #aaa; border-bottom-width:0 !important; margin-top:-1px; background-color:#fff; } +.panel > ul > li:first-child a { -webkit-border-top-right-radius:10px; -webkit-border-top-left-radius:10px; } +.panel > ul > li:last-child a { -webkit-border-bottom-right-radius:10px; -webkit-border-bottom-left-radius:10px; border-bottom-width:1px !important; } +.panel > ul > li a img { vertical-align:middle; margin-left:-4px; } + +.panel > form > div img { vertical-align:middle; margin-left:-4px; } + +body > .text { box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; padding:10px 7px; background-color:#fff; min-height:408px;} +.text p { margin-top:5px; } +.text p:first-child { margin-top:0; } + +.panel > p { text-align:center; margin:10px 10px 0 10px; color:#4d4d70; text-shadow:rgba(255, 255, 255, 0.75) 2px 2px 0; } + + +/* FORM STYLING */ +.panel a { position:relative; } +.panel var { position:absolute; right:23px; top:12px; font-size:14px; color:#666; font-weight:normal; font-style:normal; } +a[selected] var, a:active var, a[selected] .details, a:active .details { color:#ccf } +.panel a > small { display:block; color:#99a; } +a[selected] small, a:active small { color:#bbc } + +label img { margin-bottom:-5px; } +fieldset.radiogroup label { display:block; text-align:left; width:94%; } +fieldset.radiogroup input[type="radio"] { display:none; } +fieldset.radiogroup label > input:checked { display:block !important; float:right; -khtml-appearance:none; width:20px; height:27px; background:url(tick.png) bottom right no-repeat; } + + +/* SORTED LISTS */ +ul.az > nav { display:block; position:absolute; top:6px; right:0; font-size:11px; width:4em; z-index:1000; } +ul.az > nav > div { display:block; text-decoration:none; color:#666; text-align:center; padding-bottom:1px; font-weight:bold; } +ul.az > li.selected { background:url(tick.png) 90% 50% no-repeat; } +ul.az > li > a { display:inline; background:none; } + + +/* DATE PICKER */ +#_dptable { background-color:#e3e2e5; border:1px solid #666; padding:0; margin:0 auto; -webkit-border-radius:2px; -moz-border-radius:2px; } +#_dptable tr, #_dptable col { padding:0; margin:0 } +#_dptable th { font-size:12px; text-align:center; padding:5px 0 0 0; margin:0; border-bottom:1px solid #b2b5bc; color:#37424d; background:-webkit-gradient(linear, left top, left bottom, from(#eeedf0), to(#ceced2)); } +#_dptable tr > td { font-size:22px; font-weight:bold; text-align:center; width:46px; padding:0; height:40px; margin:0; color:#37424d; border:1px solid #b2b5bc; border-top-color:#fff; border-right-color:#fff; } +#_dptable tr > td.other { opacity:0.3; } +#_dptable tr > td.outofrange { opacity:0.2; } +#_dptable tr > td.selected { background:#d33; /*-webkit-gradient(linear,left top,left bottom,from(#f00),to(#c00));*/ color:#fff; } +#_dptable td.today { background-color:#b0abbf; color:#000; border-color:#000; } +#_datepicker #_dptable col.sat td, #_datepicker #_dptable col.sun td { background-color:#cecaaf; } +#_datepicker p, #dp_table th, #dp_table tr > td { text-shadow:rgba(255, 255, 255, 0.7) 0 1px 0; } + +#_datepicker .wk2 td { background-color:#dbdbde } +#_datepicker .wk3 td { background-color:#d5d5d9 } +#_datepicker .wk4 td { background-color:#d0cfd4 } +#_datepicker .wk5 td { background-color:#c9c8ce } +#_datepicker .wk6 td { background-color:#c8c8cd } + +#_datepicker p { padding-bottom:3px; margin:0; min-height:33px; /*background:-webkit-gradient(linear, left top, left bottom, from(#c8c8cd), to(#e3e2e5));*/ font-size:22px; font-weight:bold; text-align:center; } +#_datepicker p > .back, #_datepicker p > .fwd { width:36px; height:30px; display:block; background-repeat:no-repeat; background-position:center center; } +#_datepicker p > .back { background-image:url(dpBack.png); float:left; } +#_datepicker p > .fwd { background-image:url(dpFwd.png); float:right; } + + +/* DESKTOP HACKS */ +ul.az li, fieldset.radiogroup label, #_dptable td { cursor:pointer; } diff --git a/ajax-iui/iui/ext-sandbox/masabi/t/default/listArrow.png b/ajax-iui/iui/ext-sandbox/masabi/t/default/listArrow.png new file mode 100644 index 0000000..01f92cf Binary files /dev/null and b/ajax-iui/iui/ext-sandbox/masabi/t/default/listArrow.png differ diff --git a/ajax-iui/iui/ext-sandbox/masabi/t/default/tick.png b/ajax-iui/iui/ext-sandbox/masabi/t/default/tick.png new file mode 100644 index 0000000..08d2eb9 Binary files /dev/null and b/ajax-iui/iui/ext-sandbox/masabi/t/default/tick.png differ diff --git a/ajax-iui/iui/ext-sandbox/view/iui-views.js b/ajax-iui/iui/ext-sandbox/view/iui-views.js new file mode 100644 index 0000000..5b51504 --- /dev/null +++ b/ajax-iui/iui/ext-sandbox/view/iui-views.js @@ -0,0 +1,105 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + */ + +// requires iui.js +// requires querySelectorAll, therefore iPhone OS 2.x or later +// or Safari 3.x or later +// requires DOMContentLoaded event + +(function() { + +// global, byClass, and byID need to be setup at page load time and be ready +// when DOMContentLoaded is called. +window.iui.views = +{ + global: null, + byClass: [], + byID: [] +} + +var eventNames = ['load', 'unload', 'focus', 'blur', 'beforetransition', 'aftertransition' ]; + +// Using DOMContentLoaded so this loads before the onload in iui.js -- need a better method +// We need to register before iui's main onload handler so we can get the 'load' and 'focus' events +// for the default 'page' (view). +// +addEventListener("DOMContentLoaded", function(event) +{ + document.body.addEventListener('afterinsert', afterInsert, false); +// This will register event handlers on all initial nodes +// We'll also need to register handlers on inserted (via ajax) nodes +// To do that we'll need to use the beforeInsert event + nodes = document.querySelectorAll("body > *:not(.toolbar)"); + for (var i = 0; i < nodes.length ; i++) + { + registerNode(nodes[i]); + } +}, false); + +function registerNode(node) +{ + console.log("registerNode: " + node.id + " = " + node); + + // One view per node, first one found is used. + // If id match, use that, else first class match, else global (if any) + var view = window.iui.views.byID[node.id] || + viewByClass(node) || + window.iui.views.global; + + if (view) + { + for (var i = 0; i < eventNames.length ; i++) + { + var name = eventNames[i]; + var onName = "on" + name; + if (view[onName]) + { + console.log("addlistener: " + name + " func: " + onName + "() on #" + node.id + " = " + node); + node.addEventListener(name, view[onName], false); + } + } + } +} + +function viewByClass(node) +{ + var view = null; + var classString = node.getAttribute("class"); + if (classString) + { + var classes = classString.split(' '); + for (var i=0; i < classes.length ; i++) + { + view = window.iui.views.byClass[classes[i]]; + if (view) break; + } + } + return view; +} + +function afterInsert(e) +{ + logEvent(e); + registerNode(e.insertedNode); // Set event handlers on newly added node +} + +function logEvent(e) +{ + console.log("logEvent type: " + e.type + " target " + e.target.tagName + "#" + e.target.id); + if (e.type == "beforetransition" || e.type == "aftertransition") + { + console.log(" out trans = " + e.out); + } + else if (e.type == "beforeinsert") { + console.log(" fragment = " + e.fragment); + } + else if (e.type == "afterinsert") { + console.log(" node = " + e.insertedNode); + } +} + + +})(); + diff --git a/ajax-iui/iui/ext-sandbox/view/view-test.html b/ajax-iui/iui/ext-sandbox/view/view-test.html new file mode 100644 index 0000000..cc4a6ee --- /dev/null +++ b/ajax-iui/iui/ext-sandbox/view/view-test.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>View Test</title> + <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> + <link rel="apple-touch-icon-precomposed" href="../iui/iui-logo-touch-icon.png" /> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-status-bar-style" content="black" /> + <link rel="stylesheet" href="../../iui.css" type="text/css" /> + <link rel="stylesheet" title="Default" href="../../t/default/default-theme.css" type="text/css"/> + <script type="application/x-javascript" src="../../iui.js"></script> +<!-- + <script type="application/x-javascript" src="../../js/iui-event-log.js"></script> + --> + <script type="application/x-javascript" src="iui-views.js"></script> + <script type="application/x-javascript" src="view-test.js"></script> + <script language="JavaScript" type="text/javascript"> + </script> +</head> + +<body> + <div class="toolbar"> + <h1 id="pageTitle"></h1> + <a id="backButton" class="button" href="#"></a> + </div> + + <ul id="main" title="ViewTest" selected="true"> + <li><a href="#panel">Panel</a></li> + </ul> + + <div id="panel" title="Panel(r/o)" class="panel"> + <h2>Panel (read/only)</h2> + <fieldset> + <div class="row"> + <label>Label</label> + <span>Text in a span</span> + </div> + <div class="row"> + <label>Label 2</label> + <span>More text</span> + </div> + </fieldset> + </div> +</body> + +</html> diff --git a/ajax-iui/iui/ext-sandbox/view/view-test.js b/ajax-iui/iui/ext-sandbox/view/view-test.js new file mode 100644 index 0000000..8686641 --- /dev/null +++ b/ajax-iui/iui/ext-sandbox/view/view-test.js @@ -0,0 +1,50 @@ +var myView = { + onload: function(e) { + window.logEvent(e); + }, + onunload: function(e) { + window.logEvent(e); + }, + onfocus: function(e) { + window.logEvent(e); + }, + onblur: function(e) { + window.logEvent(e); + }, + onbeforetransition: function(e) { + window.logEvent(e); + }, + onaftertransition: function(e) { + window.logEvent(e); + }, + +} + +// +// The following lines allow you to attach myView to either +// 1) All views +// 2) All views having class 'panel' +// 3) The view having the id 'main' +// +// Comment or uncomment the lines to test/demonstrate the different +// behaviors +// +//window.iui.views.global = myView; +window.iui.views.byClass['panel'] = myView; +//window.iui.views.byID['main'] = myView; + + +function logEvent(e) +{ + console.log("logEvent type: " + e.type + " target " + e.target.tagName + "#" + e.target.id); + if (e.type == "beforetransition" || e.type == "aftertransition") + { + console.log(" out trans = " + e.out); + } + else if (e.type == "beforeinsert") { + console.log(" fragment = " + e.fragment); + } + else if (e.type == "afterinsert") { + console.log(" node = " + e.insertedNode); + } +} diff --git a/ajax-iui/iui/iui-favicon.png b/ajax-iui/iui/iui-favicon.png new file mode 100644 index 0000000..2f95865 Binary files /dev/null and b/ajax-iui/iui/iui-favicon.png differ diff --git a/ajax-iui/iui/iui-logo-touch-icon.png b/ajax-iui/iui/iui-logo-touch-icon.png new file mode 100644 index 0000000..8817b30 Binary files /dev/null and b/ajax-iui/iui/iui-logo-touch-icon.png differ diff --git a/ajax-iui/iui/iui-moz.css b/ajax-iui/iui/iui-moz.css new file mode 100644 index 0000000..afaa8d3 --- /dev/null +++ b/ajax-iui/iui/iui-moz.css @@ -0,0 +1,4 @@ +/* iui-moz.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ + +/* This file is deprecated and the -moz styles have been merged into iui.css + and the theme CSS files */ diff --git a/ajax-iui/iui/iui.css b/ajax-iui/iui/iui.css new file mode 100644 index 0000000..90e4d87 --- /dev/null +++ b/ajax-iui/iui/iui.css @@ -0,0 +1,399 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ +body { + margin: 0; + font-family: Helvetica; + background: #FFFFFF; + color: #000000; + overflow-x: hidden; + -webkit-user-select: none; + -webkit-text-size-adjust: none; +} + +body > *:not(.toolbar) { + display: none; + position: absolute; + margin: 0; + padding: 0; + left: 0; + top: 45px; + width: 100%; + height: auto; + min-height: 415px; + -webkit-transition-duration: 300ms; + -webkit-transition-property: -webkit-transform; + -webkit-transform: translateX(0%); +} + +body[orient="landscape"] > *:not(.toolbar) { + height: auto; + min-height: 268px; +} + +body > *[selected="true"] { + display: block; +} + +li > a[selected], li > a:active { + background-color: #194fdb !important; + background-repeat: no-repeat, repeat-x !important; /* TG: !important */ + background-position: right center, left top !important; /* TG: !important */ + color: #FFFFFF !important; +} + +li > a[selected="progress"] { +} + +/************************************************************************************************/ + +body > .toolbar { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + border-top: 1px solid #6d84a2; + padding: 0 10px 10px 10px; + height: 45px; +} + +.toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + margin: 1px 0 0 -75px; + padding-top: 10px; + height: 45px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #FFFFFF; +} + +body[orient="landscape"] > .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +.button { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; +} + +.blueButton { + border-width: 0 5px; +} + +.leftButton { + left: 6px; + right: auto; +} + +#backButton { + display: none; + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; +} + +.whiteButton, +.redButton, +.grayButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +/* TG */ .grayButton[selected], .grayButton:active, +.whiteButton { + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +/* TG */ background:transparent !important; +} + +.redButton { +/* TG */ background:transparent !important; + color:#fff; + text-shadow: #7a0001 0 -1px 0; +} + +/* TG */ .whiteButton[selected], .whiteButton:active, +.grayButton { + color: #FFFFFF; +/* TG */ background:transparent !important; +} + +/************************************************************************************************/ + +body > ul > li { + position: relative; + margin: 0; + border-bottom: 1px solid #E0E0E0; + padding: 8px 0 8px 10px; + font-size: 20px; + font-weight: bold; + list-style: none; +} + +body > ul > li.group { + position: relative; + top: -1px; + margin-bottom: -2px; + border-top: 1px solid #7d7d7d; + border-bottom: 1px solid #999999; + padding: 1px 10px; + font-size: 17px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; + color: #FFFFFF; +} + +body > ul > li.group:first-child { + top: 0; + border-top: none; +} + +body > ul > li > a { + display: block; + margin: -8px 0 -8px -10px; + padding: 8px 32px 8px 10px; + text-decoration: none; + color: inherit; +} + +a[target="_replace"] { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding-top: 25px; + padding-bottom: 25px; + font-size: 18px; + color: cornflowerblue; + background-color: #FFFFFF; + background-image: none; +} + +/************************************************************************************************/ + +body > .dialog { + top: 0; + width: 100%; + min-height: 417px; + z-index: 2; + background: rgba(0, 0, 0, 0.8); + padding: 0; + text-align: right; +} + +.dialog > fieldset { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 0; + border: none; + border-top: 1px solid #6d84a2; + padding: 10px 6px; +} + +.dialog > fieldset > h1 { + margin: 0 10px 0 10px; + padding: 0; + font-size: 20px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; +} + +.dialog > fieldset > label { + position: absolute; + margin: 16px 0 0 6px; + font-size: 14px; + color: #999999; +} + +input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + width: 100%; + margin: 8px 0 0 0; + padding: 6px 6px 6px 44px; + font-size: 16px; + font-weight: normal; +} + +/************************************************************************************************/ + +body > .panel { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + padding: 10px; +} + +.panel > ul, +.panel > fieldset { + position: relative; + margin: 0 0 20px 0; + padding: 0; + background: #FFFFFF; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border: 1px solid #999999; + text-align: right; + font-size: 16px; +} + +.panel > ul li, +.row { + position: relative; + min-height: 42px; + border-bottom: 1px solid #999999; + -webkit-border-radius: 0; + -moz-border-radius: 0; + text-align: right; +} + +.panel > ul li:last-child, +fieldset > .row:last-child { + border-bottom: none !important; +} + +.row > input:not(input[type|=radio]):not(input[type|=checkbox]) { + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + margin: 0; + border: none; + padding: 12px 10px 0 110px; + height: 42px; + background: none; +} +.row > input[type|=radio], .row > input[type|=checkbox] { + margin: 7px 7px 0 0; + height: 25px; + width: 25px; +} + +.row > label { + position: absolute; + margin: 0 0 0 14px; + line-height: 42px; + font-weight: bold; +} + +.row > span { + position: absolute; + padding: 12px 10px 0 110px; + margin: 0; +} + +.row > .toggle { + position: absolute; + top: 6px; + right: 6px; + width: 100px; + height: 28px; +} + +.toggle { + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + font-size: 19px; + font-weight: bold; + line-height: 30px; +} + +.toggle[toggled="true"] { + border: 1px solid #143fae; +} + +.toggleOn { + display: none; + position: absolute; + width: 60px; + text-align: center; + left: 0; + top: 0; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; +} + +.toggleOff { + position: absolute; + width: 60px; + text-align: center; + right: 0; + top: 0; + color: #666666; +} + +.toggle[toggled="true"] > .toggleOn { + display: block; +} + +.toggle[toggled="true"] > .toggleOff { + display: none; +} + +.thumb { + position: absolute; + top: -1px; + left: -1px; + width: 40px; + height: 28px; + border: 1px solid #888888; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; +} + +.toggle[toggled="true"] > .thumb { + left: auto; + right: -1px; +} + +.panel > h2 { + margin: 0 0 8px 14px; + font-size: inherit; + font-weight: bold; + color: #4d4d70; + text-shadow: rgba(255, 255, 255, 0.75) 2px 2px 0; +} + +/************************************************************************************************/ + +#preloader { + display: none; +} diff --git a/ajax-iui/iui/iui.js b/ajax-iui/iui/iui.js new file mode 100644 index 0000000..5cbe4bb --- /dev/null +++ b/ajax-iui/iui/iui.js @@ -0,0 +1,663 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + Version 0.40-dev2 + */ + + +(function() { + +var slideSpeed = 20; +var slideInterval = 0; + +var currentPage = null; +var currentDialog = null; +var currentWidth = 0; +var currentHeight = 0; +var currentHash = location.hash; +var hashPrefix = "#_"; +var pageHistory = []; +var newPageCount = 0; +var checkTimer; +var hasOrientationEvent = false; +var portraitVal = "portrait"; +var landscapeVal = "landscape"; + +// ************************************************************************************************* + +window.iui = +{ + animOn: true, // Slide animation with CSS transition is now enabled by default where supported + + httpHeaders: { + "X-Requested-With" : "XMLHttpRequest" + }, + + showPage: function(page, backwards) + { + if (page) + { +// if (window.iui_ext) window.iui_ext.injectEventMethods(page); // TG + + if (currentDialog) + { + currentDialog.removeAttribute("selected"); + // EVENT blur->currentDialog + sendEvent("blur", currentDialog); + currentDialog = null; + } + + if (hasClass(page, "dialog")) + { + // EVENT focus->page + sendEvent("focus", page); + showDialog(page); + } + else + { + sendEvent("load", page); // 127(stylesheet), 128(script), 129(onload) + // 130(onFocus), 133(loadActionButton) + var fromPage = currentPage; + // EVENT blur->currentPage + sendEvent("blur", currentPage); + currentPage = page; + // EVENT focus->currentPage + sendEvent("focus", page); + + if (fromPage) + { + if (backwards) sendEvent("unload", fromPage); + setTimeout(slidePages, 0, fromPage, page, backwards); + } + else + { + updatePage(page, fromPage); + } + + } + } + }, + + showPageById: function(pageId) + { + var page = $(pageId); + if (page) + { + var index = pageHistory.indexOf(pageId); + var backwards = index != -1; + if (backwards) + { + // we're going back, remove history from index on + // remember - pageId will be added again in updatePage + pageHistory.splice(index); + } + + iui.showPage(page, backwards); + } + }, + + goBack: function() + { + pageHistory.pop(); // pop current page + var pageID = pageHistory.pop(); // pop/get parent + var page = $(pageID); + iui.showPage(page, true); + }, + + showPageByHref: function(href, args, method, replace, cb) + { + // I don't think we need onerror, because readstate will still go to 4 in that case + function spbhCB(xhr) + { + if (xhr.readyState == 4) + { + // Add 'if (xhr.responseText)' to make sure we have something??? + var frag = document.createElement("div"); + frag.innerHTML = xhr.responseText; + // EVENT beforeInsert->body + sendEvent("beforeinsert", document.body, {fragment:frag}) + if (replace) + { + replaceElementWithFrag(replace, frag); + } + else + { + iui.insertPages(frag); + } + if (cb) + setTimeout(cb, 1000, true); + } + }; + iui.ajax(href, args, method, spbhCB); + }, + + // Callback function gets a single argument, the XHR + ajax: function(url, args, method, cb) + { + var xhr = new XMLHttpRequest(); + method = method ? method.toUpperCase() : "GET"; + if (args && method == "GET") + { + url = url + "?" + iui.param(args); + } + xhr.open(method, url, true); + if (cb) + { + xhr.onreadystatechange = function() { cb(xhr); }; + } + var data = null; + if (args && method != "GET") + { + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + data = iui.param(args); + } + for (var header in iui.httpHeaders) + { + xhr.setRequestHeader(header, iui.httpHeaders[header]); + } + xhr.send(data); + }, + + // Thanks, jQuery + // stripped-down, simplified, object-only version + param: function( o ) + { + var s = [ ]; + + // Serialize the key/values + for ( var key in o ) + s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(o[key]); + + // Return the resulting serialization + return s.join("&").replace(/%20/g, "+"); + }, + + insertPages: function(frag) + { + var nodes = frag.childNodes; + var targetPage; + for (var i = 0; i < nodes.length; ++i) + { + var child = nodes[i]; + if (child.nodeType == 1) + { + if (!child.id) + child.id = "__" + (++newPageCount) + "__"; + + var clone = $(child.id); + var docNode; + if (clone) { + clone.parentNode.replaceChild(child, clone); + docNode = $(child.id); + } + else + docNode = document.body.appendChild(child); + + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + + + if (child.getAttribute("selected") == "true" || !targetPage) + targetPage = child; + + --i; + } + } + if (targetPage) + iui.showPage(targetPage); + + }, + + getSelectedPage: function() + { + for (var child = document.body.firstChild; child; child = child.nextSibling) + { + if (child.nodeType == 1 && child.getAttribute("selected") == "true") + return child; + } + }, + isNativeUrl: function(href) + { + for(var i = 0; i < iui.nativeUrlPatterns.length; i++) + { + if(href.match(iui.nativeUrlPatterns[i])) return true; + } + return false; + }, + nativeUrlPatterns: [ + new RegExp("^http:\/\/maps.google.com\/maps\?"), + new RegExp("^mailto:"), + new RegExp("^tel:"), + new RegExp("^http:\/\/www.youtube.com\/watch\\?v="), + new RegExp("^http:\/\/www.youtube.com\/v\/"), + new RegExp("^javascript:"), + + ], + hasClass: function(self, name) + { + var re = new RegExp("(^|\\s)"+name+"($|\\s)"); + return re.exec(self.getAttribute("class")) != null; + }, + + addClass: function(self, name) + { + if (!iui.hasClass(self,name)) self.className += " "+name; + }, + + removeClass: function(self, name) + { + if (iui.hasClass(self,name)) { + var reg = new RegExp('(\\s|^)'+name+'(\\s|$)'); + self.className=self.className.replace(reg,' '); + } + } +}; + +// ************************************************************************************************* + +addEventListener("load", function(event) +{ + var page = iui.getSelectedPage(); + var locPage = getPageFromLoc(); + + if (page) + iui.showPage(page); + + if (locPage && (locPage != page)) + iui.showPage(locPage); + + setTimeout(preloadImages, 0); + if (typeof window.onorientationchange == "object") + { + window.onorientationchange=orientChangeHandler; + hasOrientationEvent = true; + setTimeout(orientChangeHandler, 0); + } + setTimeout(checkOrientAndLocation, 0); + checkTimer = setInterval(checkOrientAndLocation, 300); +}, false); + +addEventListener("unload", function(event) +{ + return; +}, false); + +addEventListener("click", function(event) +{ + var link = findParent(event.target, "a"); + if (link) + { + function unselect() { link.removeAttribute("selected"); } + + if (link.href && link.hash && link.hash != "#" && !link.target) + { + link.setAttribute("selected", "true"); + iui.showPage($(link.hash.substr(1))); + setTimeout(unselect, 500); + } + else if (link == $("backButton")) + { + iui.goBack(); + } + else if (link.getAttribute("type") == "submit") + { + var form = findParent(link, "form"); + if (form.target == "_self") + { + form.submit(); + return; // allow default + } + submitForm(form); + } + else if (link.getAttribute("type") == "cancel") + { + cancelDialog(findParent(link, "form")); + } + else if (link.target == "_replace") + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", link, unselect); + } + else if (iui.isNativeUrl(link.href)) + { + return; + } + else if (link.target == "_webapp") + { + location.href = link.href; + } + else if (!link.target) + { + link.setAttribute("selected", "progress"); + iui.showPageByHref(link.href, null, "GET", null, unselect); + } + else + return; + + event.preventDefault(); + } +}, true); + +addEventListener("click", function(event) +{ + var div = findParent(event.target, "div"); + if (div && hasClass(div, "toggle")) + { + div.setAttribute("toggled", div.getAttribute("toggled") != "true"); + event.preventDefault(); + } +}, true); + + +function sendEvent(type, node, props) +{ + if (node) + { + var event = document.createEvent("UIEvent"); + event.initEvent(type, false, false); // no bubble, no cancel + if (props) + { + for (i in props) + { + event[i] = props[i]; + } + } + node.dispatchEvent(event); + } +} + +function getPageFromLoc() +{ + var page; + var result = location.hash.match(/#_([^\?_]+)/); + if (result) + page = result[1]; + if (page) + page = $(page); + return page; +} + +function orientChangeHandler() +{ + var orientation=window.orientation; + switch(orientation) + { + case 0: + setOrientation(portraitVal); + break; + + case 90: + case -90: + setOrientation(landscapeVal); + break; + } +} + + +function checkOrientAndLocation() +{ + if (!hasOrientationEvent) + { + if ((window.innerWidth != currentWidth) || (window.innerHeight != currentHeight)) + { + currentWidth = window.innerWidth; + currentHeight = window.innerHeight; + var orient = (currentWidth < currentHeight) ? portraitVal : landscapeVal; + setOrientation(orient); + } + } + + if (location.hash != currentHash) + { + var pageId = location.hash.substr(hashPrefix.length); + iui.showPageById(pageId); + } +} + +function setOrientation(orient) +{ + document.body.setAttribute("orient", orient); +// Set class in addition to orient attribute: + if (orient == portraitVal) + { + iui.removeClass(document.body, landscapeVal); + iui.addClass(document.body, portraitVal); + } + else if (orient == landscapeVal) + { + iui.removeClass(document.body, portraitVal); + iui.addClass(document.body, landscapeVal); + } + else + { + iui.removeClass(document.body, portraitVal); + iui.removeClass(document.body, landscapeVal); + } + setTimeout(scrollTo, 100, 0, 1); +} + +function showDialog(page) +{ + currentDialog = page; + page.setAttribute("selected", "true"); + + if (hasClass(page, "dialog")) + showForm(page); +} + +function showForm(form) +{ + form.onsubmit = function(event) + { +// submitForm and preventDefault are called in the click handler +// when the user clicks the submit a.button +// + event.preventDefault(); + submitForm(form); + }; + + form.onclick = function(event) + { +// Why is this code needed? cancelDialog is called from +// the click hander. When will this be called? + if (event.target == form && hasClass(form, "dialog")) + cancelDialog(form); + }; +} + +function cancelDialog(form) +{ + form.removeAttribute("selected"); +} + +function updatePage(page, fromPage) +{ + if (!page.id) + page.id = "__" + (++newPageCount) + "__"; + + location.hash = currentHash = hashPrefix + page.id; + pageHistory.push(page.id); + + var pageTitle = $("pageTitle"); + if (page.title) + pageTitle.innerHTML = page.title; + var ttlClass = page.getAttribute("ttlclass"); + pageTitle.className = ttlClass ? ttlClass : ""; + + if (page.localName.toLowerCase() == "form" && !page.target) + showForm(page); + + var backButton = $("backButton"); + if (backButton) + { + var prevPage = $(pageHistory[pageHistory.length-2]); + if (prevPage && !page.getAttribute("hideBackButton")) + { + backButton.style.display = "inline"; + backButton.innerHTML = prevPage.title ? prevPage.title : "Back"; + var bbClass = prevPage.getAttribute("bbclass"); + backButton.className = (bbClass) ? 'button ' + bbClass : 'button'; + } + else + backButton.style.display = "none"; + } +} + +function slidePages(fromPage, toPage, backwards) +{ + var axis = (backwards ? fromPage : toPage).getAttribute("axis"); + + clearInterval(checkTimer); + + sendEvent("beforetransition", fromPage, {out:true}); + sendEvent("beforetransition", toPage, {out:false}); + if (canDoSlideAnim() && axis != 'y') + { + slide2(fromPage, toPage, backwards, slideDone); + } + else + { + slide1(fromPage, toPage, backwards, axis, slideDone); + } + + function slideDone() + { + if (!hasClass(toPage, "dialog")) + fromPage.removeAttribute("selected"); + checkTimer = setInterval(checkOrientAndLocation, 300); + setTimeout(updatePage, 0, toPage, fromPage); + fromPage.removeEventListener('webkitTransitionEnd', slideDone, false); + sendEvent("aftertransition", fromPage, {out:true}); + sendEvent("aftertransition", toPage, {out:false}); + + } +} + +function canDoSlideAnim() +{ + return (iui.animOn) && (typeof WebKitCSSMatrix == "object"); +} + +function slide1(fromPage, toPage, backwards, axis, cb) +{ + if (axis == "y") + (backwards ? fromPage : toPage).style.top = "100%"; + else + toPage.style.left = "100%"; + + scrollTo(0, 1); + toPage.setAttribute("selected", "true"); + var percent = 100; + slide(); + var timer = setInterval(slide, slideInterval); + + function slide() + { + percent -= slideSpeed; + if (percent <= 0) + { + percent = 0; + clearInterval(timer); + cb(); + } + + if (axis == "y") + { + backwards + ? fromPage.style.top = (100-percent) + "%" + : toPage.style.top = percent + "%"; + } + else + { + fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%"; + toPage.style.left = (backwards ? -percent : percent) + "%"; + } + } +} + + +function slide2(fromPage, toPage, backwards, cb) +{ + toPage.style.webkitTransitionDuration = '0ms'; // Turn off transitions to set toPage start offset + // fromStart is always 0% and toEnd is always 0% + // iPhone won't take % width on toPage + var toStart = 'translateX(' + (backwards ? '-' : '') + window.innerWidth + 'px)'; + var fromEnd = 'translateX(' + (backwards ? '100%' : '-100%') + ')'; + toPage.style.webkitTransform = toStart; + toPage.setAttribute("selected", "true"); + toPage.style.webkitTransitionDuration = ''; // Turn transitions back on + function startTrans() + { + fromPage.style.webkitTransform = fromEnd; + toPage.style.webkitTransform = 'translateX(0%)'; //toEnd + } + fromPage.addEventListener('webkitTransitionEnd', cb, false); + setTimeout(startTrans, 0); +} + +function preloadImages() +{ + var preloader = document.createElement("div"); + preloader.id = "preloader"; + document.body.appendChild(preloader); +} + +function submitForm(form) +{ + iui.addClass(form, "progress"); + iui.showPageByHref(form.action, encodeForm(form), form.method || "GET", null, clear); + function clear() { iui.removeClass(form, "progress"); } +} + +function encodeForm(form) +{ + function encode(inputs) + { + for (var i = 0; i < inputs.length; ++i) + { + if (inputs[i].name) + args[inputs[i].name] = inputs[i].value; + } + } + + var args = {}; + encode(form.getElementsByTagName("input")); + encode(form.getElementsByTagName("textarea")); + encode(form.getElementsByTagName("select")); + encode(form.getElementsByTagName("button")); + return args; +} + +function findParent(node, localName) +{ + while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName)) + node = node.parentNode; + return node; +} + +function hasClass(self, name) +{ + return iui.hasClass(self,name); +} + +function replaceElementWithFrag(replace, frag) +{ + var page = replace.parentNode; + var parent = replace; + while (page.parentNode != document.body) + { + page = page.parentNode; + parent = parent.parentNode; + } + page.removeChild(parent); + + var docNode; + while (frag.firstChild) { + docNode = page.appendChild(frag.firstChild); + sendEvent("afterinsert", document.body, {insertedNode:docNode}); + } +} + +function $(id) { return document.getElementById(id); } +function ddd() { console.log.apply(console, arguments); } + +})(); diff --git a/ajax-iui/iui/iuix.css b/ajax-iui/iui/iuix.css new file mode 100644 index 0000000..ab0001c --- /dev/null +++ b/ajax-iui/iui/iuix.css @@ -0,0 +1 @@ +body{margin:0;font-family:Helvetica;background:#FFF;color:#000;overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;}body>*:not(.toolbar){display:none;position:absolute;margin:0;padding:0;left:0;top:45px;width:100%;height:auto;min-height:415px;-webkit-transition-duration:300ms;-webkit-transition-property:-webkit-transform;-webkit-transform:translateX(0%);}body[orient="landscape"]>*:not(.toolbar){height:auto;min-height:268px;}body>*[selected="true"]{display:block;}li>a[selected],li>a:active{background-color:#194fdb!important;background-repeat:no-repeat,repeat-x!important;background-position:right center,left top!important;color:#FFF!important;}body>.toolbar{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border-bottom:1px solid #2d3642;border-top:1px solid #6d84a2;padding:0 10px 10px 10px;height:45px;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;margin:1px 0 0 -75px;padding-top:10px;height:45px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#FFF;}body[orient="landscape"]>.toolbar>h1{margin-left:-125px;width:250px;}.button{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.6) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;}.blueButton{border-width:0 5px;}.leftButton{left:6px;right:auto;}#backButton{display:none;left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;}.whiteButton,.redButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.grayButton[selected],.grayButton:active,.whiteButton{text-shadow:rgba(255,255,255,0.7) 0 1px 0;background:transparent!important;}.redButton{background:transparent!important;color:#fff;text-shadow:#7a0001 0 -1px 0;}.whiteButton[selected],.whiteButton:active,.grayButton{color:#FFF;background:transparent!important;}body>ul>li{position:relative;margin:0;border-bottom:1px solid #E0E0E0;padding:8px 0 8px 10px;font-size:20px;font-weight:bold;list-style:none;}body>ul>li.group{position:relative;top:-1px;margin-bottom:-2px;border-top:1px solid #7d7d7d;border-bottom:1px solid #999;padding:1px 10px;font-size:17px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 1px 0;color:#FFF;}body>ul>li.group:first-child{top:0;border-top:none;}body>ul>li>a{display:block;margin:-8px 0 -8px -10px;padding:8px 32px 8px 10px;text-decoration:none;color:inherit;}a[target="_replace"]{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding-top:25px;padding-bottom:25px;font-size:18px;color:cornflowerblue;background-color:#FFF;background-image:none;}body>.dialog{top:0;width:100%;min-height:417px;z-index:2;background:rgba(0,0,0,0.8);padding:0;text-align:right;}.dialog>fieldset{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;width:100%;margin:0;border:none;border-top:1px solid #6d84a2;padding:10px 6px;}.dialog>fieldset>h1{margin:0 10px 0 10px;padding:0;font-size:20px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;}.dialog>fieldset>label{position:absolute;margin:16px 0 0 6px;font-size:14px;color:#999;}input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;width:100%;margin:8px 0 0 0;padding:6px 6px 6px 44px;font-size:16px;font-weight:normal;}body>.panel{box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:10px;}.panel>ul,.panel>fieldset{position:relative;margin:0 0 20px 0;padding:0;background:#FFF;-webkit-border-radius:10px;-moz-border-radius:10px;border:1px solid #999;text-align:right;font-size:16px;}.panel>ul li,.row{position:relative;min-height:42px;border-bottom:1px solid #999;-webkit-border-radius:0;-moz-border-radius:0;text-align:right;}.panel>ul li:last-child,fieldset>.row:last-child{border-bottom:none!important;}.row>input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;margin:0;border:none;padding:12px 10px 0 110px;height:42px;background:none;}.row>input[type|=radio],.row>input[type|=checkbox]{margin:7px 7px 0 0;height:25px;width:25px;}.row>label{position:absolute;margin:0 0 0 14px;line-height:42px;font-weight:bold;}.row>span{position:absolute;padding:12px 10px 0 110px;margin:0;}.row>.toggle{position:absolute;top:6px;right:6px;width:100px;height:28px;}.toggle{border:1px solid #888;-webkit-border-radius:6px;-moz-border-radius:6px;font-size:19px;font-weight:bold;line-height:30px;}.toggle[toggled="true"]{border:1px solid #143fae;}.toggleOn{display:none;position:absolute;width:60px;text-align:center;left:0;top:0;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}.toggleOff{position:absolute;width:60px;text-align:center;right:0;top:0;color:#666;}.toggle[toggled="true"]>.toggleOn{display:block;}.toggle[toggled="true"]>.toggleOff{display:none;}.thumb{position:absolute;top:-1px;left:-1px;width:40px;height:28px;border:1px solid #888;-webkit-border-radius:6px;-moz-border-radius:6px;}.toggle[toggled="true"]>.thumb{left:auto;right:-1px;}.panel>h2{margin:0 0 8px 14px;font-size:inherit;font-weight:bold;color:#4d4d70;text-shadow:rgba(255,255,255,0.75) 2px 2px 0;}#preloader{display:none;} \ No newline at end of file diff --git a/ajax-iui/iui/iuix.js b/ajax-iui/iui/iuix.js new file mode 100644 index 0000000..ff289e2 --- /dev/null +++ b/ajax-iui/iui/iuix.js @@ -0,0 +1 @@ +(function(){var _1=20;var _2=0;var _3=null;var _4=null;var _5=0;var _6=0;var _7=location.hash;var _8="#_";var _9=[];var _a=0;var _b;var _c=false;var _d="portrait";var _e="landscape";window.iui={animOn:true,httpHeaders:{"X-Requested-With":"XMLHttpRequest"},showPage:function(_f,_10){if(_f){if(_4){_4.removeAttribute("selected");sendEvent("blur",_4);_4=null;}if(hasClass(_f,"dialog")){sendEvent("focus",_f);showDialog(_f);}else{sendEvent("load",_f);var _11=_3;sendEvent("blur",_3);_3=_f;sendEvent("focus",_f);if(_11){if(_10){sendEvent("unload",_11);}setTimeout(slidePages,0,_11,_f,_10);}else{updatePage(_f,_11);}}}},showPageById:function(_12){var _13=$(_12);if(_13){var _14=_9.indexOf(_12);var _15=_14!=-1;if(_15){_9.splice(_14);}iui.showPage(_13,_15);}},goBack:function(){_9.pop();var _16=_9.pop();var _17=$(_16);iui.showPage(_17,true);},showPageByHref:function(_18,_19,_1a,_1b,cb){function spbhCB(xhr){if(xhr.readyState==4){var _1e=document.createElement("div");_1e.innerHTML=xhr.responseText;sendEvent("beforeinsert",document.body,{fragment:_1e});if(_1b){replaceElementWithFrag(_1b,_1e);}else{iui.insertPages(_1e);}if(cb){setTimeout(cb,1000,true);}}}iui.ajax(_18,_19,_1a,spbhCB);},ajax:function(url,_20,_21,cb){var xhr=new XMLHttpRequest();_21=_21?_21.toUpperCase():"GET";if(_20&&_21=="GET"){url=url+"?"+iui.param(_20);}xhr.open(_21,url,true);if(cb){xhr.onreadystatechange=function(){cb(xhr);};}var _24=null;if(_20&&_21!="GET"){xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");_24=iui.param(_20);}for(var _25 in iui.httpHeaders){xhr.setRequestHeader(_25,iui.httpHeaders[_25]);}xhr.send(_24);},param:function(o){var s=[];for(var key in o){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(o[key]);}return s.join("&").replace(/%20/g,"+");},insertPages:function(_29){var _2a=_29.childNodes;var _2b;for(var i=0;i<_2a.length;++i){var _2d=_2a[i];if(_2d.nodeType==1){if(!_2d.id){_2d.id="__"+(++_a)+"__";}var _2e=$(_2d.id);var _2f;if(_2e){_2e.parentNode.replaceChild(_2d,_2e);_2f=$(_2d.id);}else{_2f=document.body.appendChild(_2d);}sendEvent("afterinsert",document.body,{insertedNode:_2f});if(_2d.getAttribute("selected")=="true"||!_2b){_2b=_2d;}--i;}}if(_2b){iui.showPage(_2b);}},getSelectedPage:function(){for(var _30=document.body.firstChild;_30;_30=_30.nextSibling){if(_30.nodeType==1&&_30.getAttribute("selected")=="true"){return _30;}}},isNativeUrl:function(_31){for(var i=0;i<iui.nativeUrlPatterns.length;i++){if(_31.match(iui.nativeUrlPatterns[i])){return true;}}return false;},nativeUrlPatterns:[new RegExp("^http://maps.google.com/maps?"),new RegExp("^mailto:"),new RegExp("^tel:"),new RegExp("^http://www.youtube.com/watch\\?v="),new RegExp("^http://www.youtube.com/v/"),new RegExp("^javascript:"),],hasClass:function(_33,_34){var re=new RegExp("(^|\\s)"+_34+"($|\\s)");return re.exec(_33.getAttribute("class"))!=null;},addClass:function(_36,_37){if(!iui.hasClass(_36,_37)){_36.className+=" "+_37;}},removeClass:function(_38,_39){if(iui.hasClass(_38,_39)){var reg=new RegExp("(\\s|^)"+_39+"(\\s|$)");_38.className=_38.className.replace(reg," ");}}};addEventListener("load",function(_3b){var _3c=iui.getSelectedPage();var _3d=getPageFromLoc();if(_3c){iui.showPage(_3c);}if(_3d&&(_3d!=_3c)){iui.showPage(_3d);}setTimeout(preloadImages,0);if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_c=true;setTimeout(orientChangeHandler,0);}setTimeout(checkOrientAndLocation,0);_b=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_3e){return;},false);addEventListener("click",function(_3f){var _40=findParent(_3f.target,"a");if(_40){function unselect(){_40.removeAttribute("selected");}if(_40.href&&_40.hash&&_40.hash!="#"&&!_40.target){_40.setAttribute("selected","true");iui.showPage($(_40.hash.substr(1)));setTimeout(unselect,500);}else{if(_40==$("backButton")){iui.goBack();}else{if(_40.getAttribute("type")=="submit"){var _41=findParent(_40,"form");if(_41.target=="_self"){_41.submit();return;}submitForm(_41);}else{if(_40.getAttribute("type")=="cancel"){cancelDialog(findParent(_40,"form"));}else{if(_40.target=="_replace"){_40.setAttribute("selected","progress");iui.showPageByHref(_40.href,null,"GET",_40,unselect);}else{if(iui.isNativeUrl(_40.href)){return;}else{if(_40.target=="_webapp"){location.href=_40.href;}else{if(!_40.target){_40.setAttribute("selected","progress");iui.showPageByHref(_40.href,null,"GET",null,unselect);}else{return;}}}}}}}}_3f.preventDefault();}},true);addEventListener("click",function(_42){var div=findParent(_42.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_42.preventDefault();}},true);function sendEvent(_44,_45,_46){if(_45){var _47=document.createEvent("UIEvent");_47.initEvent(_44,false,false);if(_46){for(i in _46){_47[i]=_46[i];}}_45.dispatchEvent(_47);}}function getPageFromLoc(){var _48;var _49=location.hash.match(/#_([^\?_]+)/);if(_49){_48=_49[1];}if(_48){_48=$(_48);}return _48;}function orientChangeHandler(){var _4a=window.orientation;switch(_4a){case 0:setOrientation(_d);break;case 90:case -90:setOrientation(_e);break;}}function checkOrientAndLocation(){if(!_c){if((window.innerWidth!=_5)||(window.innerHeight!=_6)){_5=window.innerWidth;_6=window.innerHeight;var _4b=(_5<_6)?_d:_e;setOrientation(_4b);}}if(location.hash!=_7){var _4c=location.hash.substr(_8.length);iui.showPageById(_4c);}}function setOrientation(_4d){document.body.setAttribute("orient",_4d);if(_4d==_d){iui.removeClass(document.body,_e);iui.addClass(document.body,_d);}else{if(_4d==_e){iui.removeClass(document.body,_d);iui.addClass(document.body,_e);}else{iui.removeClass(document.body,_d);iui.removeClass(document.body,_e);}}setTimeout(scrollTo,100,0,1);}function showDialog(_4e){_4=_4e;_4e.setAttribute("selected","true");if(hasClass(_4e,"dialog")){showForm(_4e);}}function showForm(_4f){_4f.onsubmit=function(_50){_50.preventDefault();submitForm(_4f);};_4f.onclick=function(_51){if(_51.target==_4f&&hasClass(_4f,"dialog")){cancelDialog(_4f);}};}function cancelDialog(_52){_52.removeAttribute("selected");}function updatePage(_53,_54){if(!_53.id){_53.id="__"+(++_a)+"__";}location.hash=_7=_8+_53.id;_9.push(_53.id);var _55=$("pageTitle");if(_53.title){_55.innerHTML=_53.title;}var _56=_53.getAttribute("ttlclass");_55.className=_56?_56:"";if(_53.localName.toLowerCase()=="form"&&!_53.target){showForm(_53);}var _57=$("backButton");if(_57){var _58=$(_9[_9.length-2]);if(_58&&!_53.getAttribute("hideBackButton")){_57.style.display="inline";_57.innerHTML=_58.title?_58.title:"Back";var _59=_58.getAttribute("bbclass");_57.className=(_59)?"button "+_59:"button";}else{_57.style.display="none";}}}function slidePages(_5a,_5b,_5c){var _5d=(_5c?_5a:_5b).getAttribute("axis");clearInterval(_b);sendEvent("beforetransition",_5a,{out:true});sendEvent("beforetransition",_5b,{out:false});if(canDoSlideAnim()&&_5d!="y"){slide2(_5a,_5b,_5c,slideDone);}else{slide1(_5a,_5b,_5c,_5d,slideDone);}function slideDone(){if(!hasClass(_5b,"dialog")){_5a.removeAttribute("selected");}_b=setInterval(checkOrientAndLocation,300);setTimeout(updatePage,0,_5b,_5a);_5a.removeEventListener("webkitTransitionEnd",slideDone,false);sendEvent("aftertransition",_5a,{out:true});sendEvent("aftertransition",_5b,{out:false});}}function canDoSlideAnim(){return (iui.animOn)&&(typeof WebKitCSSMatrix=="object");}function slide1(_5e,_5f,_60,_61,cb){if(_61=="y"){(_60?_5e:_5f).style.top="100%";}else{_5f.style.left="100%";}scrollTo(0,1);_5f.setAttribute("selected","true");var _63=100;slide();var _64=setInterval(slide,_2);function slide(){_63-=_1;if(_63<=0){_63=0;clearInterval(_64);cb();}if(_61=="y"){_60?_5e.style.top=(100-_63)+"%":_5f.style.top=_63+"%";}else{_5e.style.left=(_60?(100-_63):(_63-100))+"%";_5f.style.left=(_60?-_63:_63)+"%";}}}function slide2(_65,_66,_67,cb){_66.style.webkitTransitionDuration="0ms";var _69="translateX("+(_67?"-":"")+window.innerWidth+"px)";var _6a="translateX("+(_67?"100%":"-100%")+")";_66.style.webkitTransform=_69;_66.setAttribute("selected","true");_66.style.webkitTransitionDuration="";function startTrans(){_65.style.webkitTransform=_6a;_66.style.webkitTransform="translateX(0%)";}_65.addEventListener("webkitTransitionEnd",cb,false);setTimeout(startTrans,0);}function preloadImages(){var _6b=document.createElement("div");_6b.id="preloader";document.body.appendChild(_6b);}function submitForm(_6c){iui.addClass(_6c,"progress");iui.showPageByHref(_6c.action,encodeForm(_6c),_6c.method||"GET",null,clear);function clear(){iui.removeClass(_6c,"progress");}}function encodeForm(_6d){function encode(_6e){for(var i=0;i<_6e.length;++i){if(_6e[i].name){args[_6e[i].name]=_6e[i].value;}}}var _70={};encode(_6d.getElementsByTagName("input"));encode(_6d.getElementsByTagName("textarea"));encode(_6d.getElementsByTagName("select"));encode(_6d.getElementsByTagName("button"));return _70;}function findParent(_71,_72){while(_71&&(_71.nodeType!=1||_71.localName.toLowerCase()!=_72)){_71=_71.parentNode;}return _71;}function hasClass(_73,_74){return iui.hasClass(_73,_74);}function replaceElementWithFrag(_75,_76){var _77=_75.parentNode;var _78=_75;while(_77.parentNode!=document.body){_77=_77.parentNode;_78=_78.parentNode;}_77.removeChild(_78);var _79;while(_76.firstChild){_79=_77.appendChild(_76.firstChild);sendEvent("afterinsert",document.body,{insertedNode:_79});}}function $(id){return document.getElementById(id);}function ddd(){console.log.apply(console,arguments);}})(); \ No newline at end of file diff --git a/ajax-iui/iui/js/iui-event-log.js b/ajax-iui/iui/js/iui-event-log.js new file mode 100644 index 0000000..368a6b2 --- /dev/null +++ b/ajax-iui/iui/js/iui-event-log.js @@ -0,0 +1,62 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + */ + +// requires querySelectorAll, therefore iPhone OS 2.x or later +// or Safari 3.x or later + +(function() { + +var eventNames = ['blur', 'focus', 'load', 'unload', 'beforetransition', 'aftertransition' ]; + +// Using DOMContentLoaded so this loads before the onload in iui.js -- need a better method +// We need to register before iui's main onload handler so we can get the 'load' and 'focus' events +// for the default 'page' (view). +// +addEventListener("DOMContentLoaded", function(event) +{ + document.body.addEventListener('beforeinsert', logEvent, false); + document.body.addEventListener('afterinsert', afterInsert, false); +// This will register event handlers on all initial nodes +// We'll also need to register handlers on inserted (via ajax) nodes +// To do that we'll need to use the beforeInsert event + nodes = document.querySelectorAll("body > *:not(.toolbar)"); + for (var i = 0; i < nodes.length ; i++) + { + registerAllEvents(nodes[i]); + } +}, false); + +function registerAllEvents(node) +{ + for (var i = 0; i < eventNames.length ; i++) + { + console.log("addlistener: " + eventNames[i] + " on #" + node.id + " = " + node); + node.addEventListener(eventNames[i], logEvent, false); + } +} + +function afterInsert(e) +{ + logEvent(e); + registerAllEvents(e.insertedNode); // Set event handlers on newly added node +} + +function logEvent(e) +{ + console.log("logEvent type: " + e.type + " target " + e.target.tagName + "#" + e.target.id); + if (e.type == "beforetransition" || e.type == "aftertransition") + { + console.log(" out trans = " + e.out); + } + else if (e.type == "beforeinsert") { + console.log(" fragment = " + e.fragment); + } + else if (e.type == "afterinsert") { + console.log(" node = " + e.insertedNode); + } +} + + +})(); diff --git a/ajax-iui/iui/js/iui-theme-switcher.js b/ajax-iui/iui/js/iui-theme-switcher.js new file mode 100644 index 0000000..9ef074f --- /dev/null +++ b/ajax-iui/iui/js/iui-theme-switcher.js @@ -0,0 +1,42 @@ +/* + Copyright (c) 2007-9, iUI Project Members + See LICENSE.txt for licensing terms + */ + +iui.ts = { + themeSelect: function(select) + { + var curTheme = iui.ts.getTheme(); + var index = select.selectedIndex; + var newTheme = select.options[index].value; + iui.ts.setTheme(newTheme); + return false; + }, + + getTheme: function() + { + var i, a, main; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) + { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) + { + if (a.disabled == false) return a.getAttribute("title"); + } + } + }, + + setTheme: function(title) + { + var i, a, main; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) + { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) + { + a.disabled = true; + if(a.getAttribute("title") == title) a.disabled = false; + } + } + } +}; \ No newline at end of file diff --git a/ajax-iui/iui/t/ThemeImageCatalog.html b/ajax-iui/iui/t/ThemeImageCatalog.html new file mode 100644 index 0000000..a0c85e8 --- /dev/null +++ b/ajax-iui/iui/t/ThemeImageCatalog.html @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <title>iUI Theme Image Catalog</title> + + <style type="text/css">.toolbar { + position: relative; + display: block; + box-sizing: border-box; + -webkit-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + border-top: 1px solid #6d84a2; + padding: 0 10px 10px 10px; + height: 45px; + background-image: url(default/toolbar.png); +} + +.button { + font-family: Helvetica; + color: #000000; + overflow-x: hidden; + // position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + // font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #FFFFFF; + text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; +} + +.backButton { + display: inline; + position: absolute; + top: 8px; + left: 6px; + min-height: 30px; + right: auto; + -webkit-border-image: url(default/backButtonBrdr.png) 0 8 0 14; + background: url(default/backButtonBack.png) repeat-x; + border-width: 0 8px 0 14px; + max-width: 55px; + padding: 0; +} + +.panel { + background: #c8c8c8 url(default/pinstripes.png); +}</style> + </head> + + <body><p></p><table border="1"> + <thead> + <tr> + <th>Filename</th> + + <th>Description</th> + + <th>Notes</th> + + <th>Status</th> + + <th>Example</th> + </tr> + </thead> + + <tr> + <td>toolbar.png</td> + + <td>Background image used for top "toolbar"</td> + + <td><ul> + <li>1-pixel wide and horizontally repeated</li> + </ul></td> + + <td></td> + + <td><img alt="???" height="43px" src="default/toolbar.png" + width="100px" /></td> + </tr> + + <tr> + <td>title-img.png</td> + + <td>Toolbar w/Image</td> + + <td></td> + + <td></td> + + <td><div class="toolbar"><img alt="???" height="" + src="default/title-img.png" width="" /></div></td> + </tr> + + <tr> + <td>backButtonBack.png</td> + + <td>Background image for back button</td> + + <td><ul> + <li>1-pixel wide and horizontally repeated</li> + </ul></td> + + <td></td> + + <td><img alt="???" height="30px" src="default/backButtonBack.png" + width="50px" /></td> + </tr> + + <tr> + <td>back-img.png</td> + + <td>"Logo" image for back button</td> + + <td></td> + + <td></td> + + <td><img alt="???" height="" src="default/back-img.png" + width="" /></td> + </tr> + + <tr> + <td>backButtonBrdr.png</td> + + <td>Back button border</td> + + <td></td> + + <td></td> + + <td><img alt="???" height="" src="default/backButtonBrdr.png" + width="" /></td> + </tr> + + <tr> + <td>- multiple -</td> + + <td>Back Button Complete (text)</td> + + <td></td> + + <td></td> + + <td style=""><div class="toolbar"><a class="button backButton" + style="-webkit-border-image: url(default/backButtonBrdr.png) 0 8 0 14; background: url(default/backButtonBack.png) repeat-x; border-width: 0 8px 0 14px; max-width: 55px; padding: 0;">Back</a></div></td> + </tr> + + <tr> + <td>- multiple -</td> + + <td>Back Button Complete (image)</td> + + <td></td> + + <td></td> + + <td style=""><div class="toolbar"><a class="button backButton" + style="-webkit-border-image: url(default/backButtonBrdr.png) 0 8 0 14; background: url(default/backButtonBack.png) repeat-x; border-width: 0 8px 0 14px; max-width: 55px; padding: 0;"><img + alt="???" src="default/back-img.png" /></a></div></td> + </tr> + + <tr> + <td>pinstripes.png</td> + + <td>"Panel" background (grey &amp; white pinstripes in default + theme)</td> + + <td></td> + + <td></td> + + <td><div class="panel" style="width: 100px; height: 40px;"></div></td> + </tr> + + <tr> + <td>selection.png</td> + + <td>Background for selected (list) items</td> + + <td></td> + + <td></td> + + <td><img alt="???" height="36px" src="default/selection.png" + width="100px;" /></td> + </tr> + + <tr> + <td>loading.gif</td> + + <td>spinner used when loading new page elements via Ajax</td> + + <td><ul> + <li>The only .gif file -- since there is no animated .png </li> + + <li>Displayed on background image of selection.png</li> + </ul></td> + + <td></td> + + <td bgcolor="" + style="background-image: url(default/selection.png); background-repeat: repeat-x; background-color: #194fdb;"><img + alt="???" src="default/loading.gif" + style="display: block; margin-left: auto; margin-right: auto;" /></td> + </tr> + </table></body> +</html> \ No newline at end of file diff --git a/ajax-iui/iui/t/default/back-img.png b/ajax-iui/iui/t/default/back-img.png new file mode 100644 index 0000000..9df2d7f Binary files /dev/null and b/ajax-iui/iui/t/default/back-img.png differ diff --git a/ajax-iui/iui/t/default/backButton.png b/ajax-iui/iui/t/default/backButton.png new file mode 100644 index 0000000..e27ea8c Binary files /dev/null and b/ajax-iui/iui/t/default/backButton.png differ diff --git a/ajax-iui/iui/t/default/backButtonBack.png b/ajax-iui/iui/t/default/backButtonBack.png new file mode 100644 index 0000000..f38e2d0 Binary files /dev/null and b/ajax-iui/iui/t/default/backButtonBack.png differ diff --git a/ajax-iui/iui/t/default/backButtonBrdr.png b/ajax-iui/iui/t/default/backButtonBrdr.png new file mode 100644 index 0000000..9017168 Binary files /dev/null and b/ajax-iui/iui/t/default/backButtonBrdr.png differ diff --git a/ajax-iui/iui/t/default/blueButton.png b/ajax-iui/iui/t/default/blueButton.png new file mode 100644 index 0000000..0f92dfd Binary files /dev/null and b/ajax-iui/iui/t/default/blueButton.png differ diff --git a/ajax-iui/iui/t/default/cancel.png b/ajax-iui/iui/t/default/cancel.png new file mode 100644 index 0000000..5f6dcc8 Binary files /dev/null and b/ajax-iui/iui/t/default/cancel.png differ diff --git a/ajax-iui/iui/t/default/default-theme.css b/ajax-iui/iui/t/default/default-theme.css new file mode 100644 index 0000000..1a866d9 --- /dev/null +++ b/ajax-iui/iui/t/default/default-theme.css @@ -0,0 +1,107 @@ +/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ +body { + color: #000000; +} + +li > a[selected], li > a:active { + background-image: url(listArrowSel.png), url(selection.png) !important; +} + +li > a[selected="progress"] { + background-image: url(../default/loading.gif), url(selection.png) !important; +} + +/************************************************************************************************/ + +body > .toolbar { + background: url(toolbar.png) #6d84a2 repeat-x; +} + +.button { + -webkit-border-image: url(toolButton.png) 0 5 0 5; + -moz-border-image: url(toolButton.png) 0 5 0 5; +} + +.blueButton { + -webkit-border-image: url(blueButton.png) 0 5 0 5; + -moz-border-image: url(blueButton.png) 0 5 0 5; +} + +#backButton { + -webkit-border-image: url(backButtonBrdr.png) 0 8 0 14; + -moz-border-image: url(backButtonBrdr.png) 0 8 0 14; + background: url(backButtonBack.png) repeat-x; +} + + +.whiteButton { + -webkit-border-image: url(whiteButton.png) 0 12 0 12; + -moz-border-image: url(whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +.redButton { + -webkit-border-image: url(redButton.png) 0 12 0 12; + -moz-border-image: url(redButton.png) 0 12 0 12; +} + +.grayButton { + -webkit-border-image: url(grayButton.png) 0 12 0 12; + -moz-border-image: url(grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/************************************************************************************************/ + +body > ul > li.group { + opacity:0.7; + background: url(listGroup.png) repeat-x; +} + +body > ul > li > a { + background: url(listArrow.png) no-repeat right center; +} + +/************************************************************************************************/ + +.dialog > fieldset { + background: url(toolbar.png) #7388a5 repeat-x; +} + +/************************************************************************************************/ + +body > .panel { + background: #c8c8c8 url(pinstripes.png); +} + +.toggle { + border: 1px solid #888888; + background: #FFFFFF url(toggle.png) repeat-x; +} + +.toggle[toggled="true"] { + background: #194fdb url(toggleOn.png) repeat-x; +} + +.thumb { + background: #ffffff url(thumb.png) repeat-x; +} + +/************************************************************************************************/ +#preloader { + display: none; + background-image: url(loading.gif), url(selection.png), + url(blueButton.png), url(listArrowSel.png), url(listGroup.png); +} + +.toolbar > h1.titleImg { + background: url(title-img.png) no-repeat top center; + color: rgba(0,0,0,0); +} + +.backButtonImg { + width: 50px; + background: url(back-img.png) no-repeat center left, + url(backButtonBack.png) repeat-x top left !important; + color: rgba(0,0,0,0); +} diff --git a/ajax-iui/iui/t/default/grayButton.png b/ajax-iui/iui/t/default/grayButton.png new file mode 100644 index 0000000..0ce6a30 Binary files /dev/null and b/ajax-iui/iui/t/default/grayButton.png differ diff --git a/ajax-iui/iui/t/default/listArrow.png b/ajax-iui/iui/t/default/listArrow.png new file mode 100644 index 0000000..6421a16 Binary files /dev/null and b/ajax-iui/iui/t/default/listArrow.png differ diff --git a/ajax-iui/iui/t/default/listArrowSel.png b/ajax-iui/iui/t/default/listArrowSel.png new file mode 100644 index 0000000..86832eb Binary files /dev/null and b/ajax-iui/iui/t/default/listArrowSel.png differ diff --git a/ajax-iui/iui/t/default/listGroup.png b/ajax-iui/iui/t/default/listGroup.png new file mode 100644 index 0000000..221553a Binary files /dev/null and b/ajax-iui/iui/t/default/listGroup.png differ diff --git a/ajax-iui/iui/t/default/loading.gif b/ajax-iui/iui/t/default/loading.gif new file mode 100644 index 0000000..8522ddf Binary files /dev/null and b/ajax-iui/iui/t/default/loading.gif differ diff --git a/ajax-iui/iui/t/default/pinstripes.png b/ajax-iui/iui/t/default/pinstripes.png new file mode 100644 index 0000000..c997775 Binary files /dev/null and b/ajax-iui/iui/t/default/pinstripes.png differ diff --git a/ajax-iui/iui/t/default/redButton.png b/ajax-iui/iui/t/default/redButton.png new file mode 100644 index 0000000..210f156 Binary files /dev/null and b/ajax-iui/iui/t/default/redButton.png differ diff --git a/ajax-iui/iui/t/default/selection.png b/ajax-iui/iui/t/default/selection.png new file mode 100644 index 0000000..537e3f0 Binary files /dev/null and b/ajax-iui/iui/t/default/selection.png differ diff --git a/ajax-iui/iui/t/default/thumb.png b/ajax-iui/iui/t/default/thumb.png new file mode 100644 index 0000000..cefa8fc Binary files /dev/null and b/ajax-iui/iui/t/default/thumb.png differ diff --git a/ajax-iui/iui/t/default/title-img.png b/ajax-iui/iui/t/default/title-img.png new file mode 100644 index 0000000..05c10a6 Binary files /dev/null and b/ajax-iui/iui/t/default/title-img.png differ diff --git a/ajax-iui/iui/t/default/toggle.png b/ajax-iui/iui/t/default/toggle.png new file mode 100644 index 0000000..3b62ebf Binary files /dev/null and b/ajax-iui/iui/t/default/toggle.png differ diff --git a/ajax-iui/iui/t/default/toggleOn.png b/ajax-iui/iui/t/default/toggleOn.png new file mode 100644 index 0000000..b016814 Binary files /dev/null and b/ajax-iui/iui/t/default/toggleOn.png differ diff --git a/ajax-iui/iui/t/default/toolButton.png b/ajax-iui/iui/t/default/toolButton.png new file mode 100644 index 0000000..afe4d7a Binary files /dev/null and b/ajax-iui/iui/t/default/toolButton.png differ diff --git a/ajax-iui/iui/t/default/toolbar.png b/ajax-iui/iui/t/default/toolbar.png new file mode 100644 index 0000000..3dde94c Binary files /dev/null and b/ajax-iui/iui/t/default/toolbar.png differ diff --git a/ajax-iui/iui/t/default/whiteButton.png b/ajax-iui/iui/t/default/whiteButton.png new file mode 100644 index 0000000..5514b27 Binary files /dev/null and b/ajax-iui/iui/t/default/whiteButton.png differ diff --git a/ajax-iui/iui/t/defaultgrad/defaultgrad-theme.css b/ajax-iui/iui/t/defaultgrad/defaultgrad-theme.css new file mode 100644 index 0000000..62ae235 --- /dev/null +++ b/ajax-iui/iui/t/defaultgrad/defaultgrad-theme.css @@ -0,0 +1,109 @@ +/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ +body { + color: #000000; +} + +li > a[selected], li > a:active { + background-image: url(../default/listArrowSel.png), url(../default/selection.png) !important; +} + +li > a[selected="progress"] { + background-image: url(../default/loading.gif), url(../default/selection.png) !important; +} + +/************************************************************************************************/ + +body > .toolbar { + background: -webkit-gradient(linear, left top, left bottom, from(#CDD5DF), to(#6D84A2)) ; +// background: url(../default/toolbar.png) #6d84a2 repeat-x; +} + +.button { + -webkit-border-image: url(../default/toolButton.png) 0 5 0 5; + -moz-border-image: url(../default/toolButton.png) 0 5 0 5; +} + +.blueButton { + -webkit-border-image: url(../default/blueButton.png) 0 5 0 5; + -moz-border-image: url(../default/blueButton.png) 0 5 0 5; +} + +#backButton { + -webkit-border-image: url(../default/backButtonBrdr.png) 0 8 0 14; + -moz-border-image: url(../default/backButtonBrdr.png) 0 8 0 14; + background: url(../default/backButtonBack.png) repeat-x; +} + + +.whiteButton { + -webkit-border-image: url(../default/whiteButton.png) 0 12 0 12; + -moz-border-image: url(../default/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +.redButton { + -webkit-border-image: url(../default/redButton.png) 0 12 0 12; + -moz-border-image: url(../default/redButton.png) 0 12 0 12; +} + +.grayButton { + -webkit-border-image: url(../default/grayButton.png) 0 12 0 12; + -moz-border-image: url(../default/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/************************************************************************************************/ + +body > ul > li.group { + opacity:0.7; + background: url(../default/listGroup.png) repeat-x; +} + +body > ul > li > a { + background: url(../default/listArrow.png) no-repeat right center; +} + +/************************************************************************************************/ + +.dialog > fieldset { + background: -webkit-gradient(linear, left top, left bottom, from(#CDD5DF), to(#6D84A2)) ; +// background: url(../default/toolbar.png) #7388a5 repeat-x; +} + +/************************************************************************************************/ + +body > .panel { + background: #c8c8c8 url(../default/pinstripes.png); +} + +.toggle { + border: 1px solid #888888; + background: #FFFFFF url(../default/toggle.png) repeat-x; +} + +.toggle[toggled="true"] { + background: #194fdb url(../default/toggleOn.png) repeat-x; +} + +.thumb { + background: #ffffff url(../default/thumb.png) repeat-x; +} + +/************************************************************************************************/ +#preloader { + display: none; + background-image: url(../default/loading.gif), url(../default/selection.png), + url(../default/blueButton.png), url(../default/listArrowSel.png), url(../default/listGroup.png); +} + +.toolbar > h1.titleImg { + background: url(../default/title-img.png) no-repeat top center; + color: rgba(0,0,0,0); +} + +.backButtonImg { + width: 50px; + background: url(../default/back-img.png) no-repeat center left, + url(../default/backButtonBack.png) repeat-x top left !important; + color: rgba(0,0,0,0); +} diff --git a/ajax-iui/iui/t/ipdc/Logo_DevCamp.png b/ajax-iui/iui/t/ipdc/Logo_DevCamp.png new file mode 100644 index 0000000..4005891 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/Logo_DevCamp.png differ diff --git a/ajax-iui/iui/t/ipdc/backButton.png b/ajax-iui/iui/t/ipdc/backButton.png new file mode 100644 index 0000000..7f2be58 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/backButton.png differ diff --git a/ajax-iui/iui/t/ipdc/beige.png b/ajax-iui/iui/t/ipdc/beige.png new file mode 100644 index 0000000..204bf88 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/beige.png differ diff --git a/ajax-iui/iui/t/ipdc/blueButton.png b/ajax-iui/iui/t/ipdc/blueButton.png new file mode 100644 index 0000000..cb2bf97 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/blueButton.png differ diff --git a/ajax-iui/iui/t/ipdc/ipdc-theme.css b/ajax-iui/iui/t/ipdc/ipdc-theme.css new file mode 100644 index 0000000..3d75d5a --- /dev/null +++ b/ajax-iui/iui/t/ipdc/ipdc-theme.css @@ -0,0 +1,102 @@ +/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */ +body { + color: #40658A; + + background: url(Logo_DevCamp.png); + background-position-x: 100%; + background-position-y: 60px; + + background-repeat: no-repeat; + /*{ background: url("banner.jpeg") right top } + background-position: 100px 60px; + */ +} + +li > a[selected], li > a:active { + background-image: url(../default/listArrowSel.png), url(../default/selection.png) !important; +} + +li > a[selected="progress"] { + background-image: url(../default/loading.gif), url(../default/selection.png) !important; +} + +/************************************************************************************************/ + +body > .toolbar { + background: url(toolbar.png) #6d84a2 repeat-x; +} + +.button { + -webkit-border-image: url(toolButton.png) 0 5 0 5; + -moz-border-image: url(toolButton.png) 0 5 0 5; +} + +.blueButton { + -webkit-border-image: url(blueButton.png) 0 5 0 5; + -moz-border-image: url(blueButton.png) 0 5 0 5; +} + +#backButton { + -webkit-border-image: url(backButton.png) 0 8 0 14; + -moz-border-image: url(backButton.png) 0 8 0 14; +} + + +.whiteButton { + -webkit-border-image: url(../default/whiteButton.png) 0 12 0 12; + -moz-border-image: url(../default/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +.redButton { + -webkit-border-image: url(redButton.png) 0 12 0 12; + -moz-border-image: url(redButton.png) 0 12 0 12; +} + +.grayButton { + -webkit-border-image: url(../default/grayButton.png) 0 12 0 12; + -moz-border-image: url(../default/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/************************************************************************************************/ + +body > ul > li.group { + opacity:0.7; + background: url(listGroup.png) repeat-x; +} + +body > ul > li > a { + background: url(../default/listArrow.png) no-repeat right center; +} + +/************************************************************************************************/ + +.dialog > fieldset { + background: url(toolbar.png) #7388a5 repeat-x; +} + +/************************************************************************************************/ + +body > .panel { + background: #c8c8c8 url(pinstripes.png); +} + +.toggle { + border: 1px solid #888888; + background: #FFFFFF url(../default/toggle.png) repeat-x; +} + +.toggle[toggled="true"] { + background: #194fdb url(../default/toggleOn.png) repeat-x; +} + +.thumb { + background: #ffffff url(../default/thumb.png) repeat-x; +} + +/************************************************************************************************/ +#preloader { + background-image: url(../default/loading.gif), url(../default/selection.png), + url(blueButton.png), url(../default/listArrowSel.png), url(listGroup.png); +} diff --git a/ajax-iui/iui/t/ipdc/listGroup.png b/ajax-iui/iui/t/ipdc/listGroup.png new file mode 100644 index 0000000..c680368 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/listGroup.png differ diff --git a/ajax-iui/iui/t/ipdc/pinstripes.png b/ajax-iui/iui/t/ipdc/pinstripes.png new file mode 100644 index 0000000..ec685e6 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/pinstripes.png differ diff --git a/ajax-iui/iui/t/ipdc/redButton.png b/ajax-iui/iui/t/ipdc/redButton.png new file mode 100644 index 0000000..c8734d7 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/redButton.png differ diff --git a/ajax-iui/iui/t/ipdc/toggleOn.png b/ajax-iui/iui/t/ipdc/toggleOn.png new file mode 100644 index 0000000..270a375 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/toggleOn.png differ diff --git a/ajax-iui/iui/t/ipdc/toolButton.png b/ajax-iui/iui/t/ipdc/toolButton.png new file mode 100644 index 0000000..51671d1 Binary files /dev/null and b/ajax-iui/iui/t/ipdc/toolButton.png differ diff --git a/ajax-iui/iui/t/ipdc/toolbar.png b/ajax-iui/iui/t/ipdc/toolbar.png new file mode 100644 index 0000000..4920e1b Binary files /dev/null and b/ajax-iui/iui/t/ipdc/toolbar.png differ
agate/onTap
0c3e27a898bfe5a450e4319e19a3cc5fdddb488c
upgrade the jqtouch version
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/ajax/public/css/img/blueButton.png b/ajax/public/css/img/actionButton.png similarity index 100% rename from ajax/public/css/img/blueButton.png rename to ajax/public/css/img/actionButton.png diff --git a/ajax/public/css/img/greenButton.png b/ajax/public/css/img/greenButton.png new file mode 100644 index 0000000..a45594b Binary files /dev/null and b/ajax/public/css/img/greenButton.png differ diff --git a/ajax/public/css/img/redButton.png b/ajax/public/css/img/redButton.png new file mode 100644 index 0000000..f5728df Binary files /dev/null and b/ajax/public/css/img/redButton.png differ diff --git a/ajax/public/css/jqtouch.css b/ajax/public/css/jqtouch.css new file mode 100644 index 0000000..b5b40c9 --- /dev/null +++ b/ajax/public/css/jqtouch.css @@ -0,0 +1,327 @@ +* { + margin: 0; + padding: 0; +} +a { + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +body { + -webkit-touch-callout: none; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +#jqt { + -webkit-user-select: none; + -webkit-text-size-adjust: none; + font-family: "Helvetica Neue", Helvetica; + -webkit-perspective: 800; + -webkit-transform-style: preserve-3d; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; +} +#jqt .selectable, #jqt input, #jqt textarea { + -webkit-user-select: auto; +} +#jqt.notransform { + -webkit-transform: none !important; +} + +#jqt > * { + -webkit-backface-visibility: hidden; + -webkit-box-sizing: border-box; + display: none; + position: absolute; + left: 0; + width: 100%; + -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); + min-height: 100%; + overflow-x: hidden; +} + +#jqt > .current { + display: block !important; +} +#jqt .in.start, #jqt .out.start { + -webkit-transition-duration: 350ms; + -webkit-transition-timing-function: ease-in-out; +} + +/* Slide */ + +#jqt .slide.start { + -webkit-transition-property: -webkit-transform; +} + +#jqt .slide.in, #jqt .slide.out.reverse.start { + -webkit-transform: translateX(100%); +} + +#jqt .slide.out.start, #jqt .slide.in.reverse { + -webkit-transform: translateX(-100%); +} + +#jqt .slide.out, #jqt .slide.out.reverse, #jqt .slide.in.start, #jqt .slide.in.reverse.start { + -webkit-transform: translateX(0); +} + +/* Fade + Dissolve */ + +#jqt .fade.start, #jqt .dissolve.start { + -webkit-transition-property: opacity; +} + +#jqt .fade.in, #jqt .fade.out.reverse.start { + opacity: 0; +} + +#jqt .fade.out.start, #jqt .fade.in.reverse { + opacity: .99; +} + +#jqt .fade.out, #jqt .fade.out.reverse, #jqt .fade.in.start, #jqt .fade.in.reverse.start { + opacity: 1; +} + +#jqt .dissolve.in, #jqt .dissolve.out.reverse.start { + opacity: 0; +} + +#jqt .dissolve.out.start, #jqt .dissolve.in.reverse { + opacity: 0; +} + +#jqt .dissolve.out, #jqt .dissolve.out.reverse, #jqt .dissolve.in.start, #jqt .dissolve.in.reverse.start { + opacity: 1; +} + +/* Flip */ + +#jqt .flip.start { + -webkit-transition-duration: .65s; + -webkit-transition-property: -webkit-transform; +} + +#jqt .flip.in, #jqt .flip.out.reverse.start { + -webkit-transform: rotateY(180deg) scale(.8); +} + +#jqt .flip.out.start, #jqt .flip.in.reverse { + -webkit-transform: rotateY(-180deg) scale(.8); +} + +#jqt .flip.out, #jqt .flip.out.reverse, #jqt .flip.in.start, #jqt .flip.in.reverse.start { + -webkit-transform: rotateY(0) scale(1); +} + +/* Slideup */ + +#jqt .slideup.start { + z-index: 10; + -webkit-transition-property: -webkit-transform, opacity; +} + +/*#jqt .sideup.in.start, .slideup.out.reverse { + z-index: 30; +} + +#jqt .slideup.out.start, .slideup.in.reverse { + z-index: 10; +}*/ + +#jqt .slideup.in, #jqt .slideup.out.reverse.start { + -webkit-transform: translateY(100%); + opacity: 1; + z-index: 30; +} + +#jqt .slideup.out.start, #jqt .slideup.in.reverse { + -webkit-transform: translateY(0); + opacity: .99; + z-index: 10; +} + +#jqt .slideup.out, #jqt .slideup.out.reverse, #jqt .slideup.in.start, #jqt .slideup.in.reverse.start { + opacity: 1; + -webkit-transform: translateY(0); + z-index: 30; +} + +/* Swap */ +/* Still requires animation for steps */ + +#jqt .swap { + -webkit-transform: perspective(800); + -webkit-animation-duration: .7s; +} +#jqt .swap.out { + -webkit-animation-name: swapouttoleft; +} +#jqt .swap.in { + -webkit-animation-name: swapinfromright; +} +#jqt .swap.out.reverse { + -webkit-animation-name: swapouttoright; +} +#jqt .swap.in.reverse { + -webkit-animation-name: swapinfromleft; +} + +@-webkit-keyframes swapouttoright { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + } +} + +@-webkit-keyframes swapouttoleft { + 0% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + -webkit-animation-timing-function: ease-in-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in; + } + 100% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + } +} + +@-webkit-keyframes swapinfromright { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(-180px, 0px, -400px) rotateY(20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +@-webkit-keyframes swapinfromleft { + 0% { + -webkit-transform: translate3d(0px, 0px, -800px) rotateY(-70deg); + -webkit-animation-timing-function: ease-out; + } + 50% { + -webkit-transform: translate3d(180px, 0px, -400px) rotateY(-20deg); + -webkit-animation-timing-function: ease-in-out; + } + 100% { + -webkit-transform: translate3d(0px, 0px, 0px) rotateY(0deg); + } +} + +#jqt .cube.start { + -webkit-animation-duration: .55s; + -webkit-transition-property: .55s; + -webkit-transition-property: opacity; +} + +#jqt .cube.in { + -webkit-transform-origin: 0% 50%; + -webkit-animation-name: cubeinfromright; + +} +#jqt .cube.out { + -webkit-transform-origin: 100% 50%; + -webkit-animation-name: cubeouttoleft; +} + +#jqt .cube.in, #jqt .cube.out.reverse.start { + opacity: 1; +} + +#jqt .cube.out.start, #jqt .cube.in.reverse { + opacity: .99; +} + +#jqt .cube.out, #jqt .cube.out.reverse, #jqt .cube.in.start, #jqt .cube.in.reverse.start { + opacity: 1; +} + +#jqt .cube.in.reverse { + -webkit-animation-name: cubeinfromleft; + -webkit-transform-origin: 100% 50%; +} +#jqt .cube.out.reverse { + -webkit-animation-name: cubeouttoright; + -webkit-transform-origin: 0% 50%; +} + +@-webkit-keyframes cubeinfromleft { + from { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoright { + from { + -webkit-transform: rotateY(0deg) translateX(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } +} +@-webkit-keyframes cubeinfromright { + from { + -webkit-transform: rotateY(90deg) translateZ(320px); + opacity: .5; + } + to { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } +} +@-webkit-keyframes cubeouttoleft { + from { + -webkit-transform: rotateY(0deg) translateZ(0); + opacity: 1; + } + to { + -webkit-transform: rotateY(-90deg) translateZ(320px); + opacity: .5; + } +} + +/* Pop */ + +#jqt .pop.start { + -webkit-transform-origin: 50% 50%; + -webkit-transition-property: -webkit-transform, opacity; +} + +#jqt .pop.in, #jqt .pop.out.reverse.start { + -webkit-transform: scale(.2); + opacity: 0; +} + +#jqt .pop.out.start, #jqt .pop.in.reverse { + -webkit-transform: scale(1); + opacity: .99; +} + +#jqt .pop.out, #jqt .pop.out.reverse, #jqt .pop.in.start, #jqt .pop.in.reverse.start { + -webkit-transform: scale(1); + opacity: 1; +} \ No newline at end of file diff --git a/ajax/public/css/jqtouch.min.css b/ajax/public/css/jqtouch.min.css deleted file mode 100644 index 37ef6fe..0000000 --- a/ajax/public/css/jqtouch.min.css +++ /dev/null @@ -1 +0,0 @@ -*{margin:0;padding:0;}a{-webkit-tap-highlight-color:rgba(0,0,0,0);}body{overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;font-family:Helvetica;-webkit-perspective:800;-webkit-transform-style:preserve-3d;}.selectable,input,textarea{-webkit-user-select:auto;}body>*{-webkit-backface-visibility:hidden;-webkit-box-sizing:border-box;display:none;position:absolute;left:0;width:100%;-webkit-transform:translate3d(0,0,0) rotate(0) scale(1);min-height:420px!important;}body.fullscreen>*{min-height:460px!important;}body.fullscreen.black-translucent>*{min-height:480px!important;}body.landscape>*{min-height:320px;}body>.current{display:block!important;}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms;}.slide.in{-webkit-animation-name:slideinfromright;}.slide.out{-webkit-animation-name:slideouttoleft;}.slide.in.reverse{-webkit-animation-name:slideinfromleft;}.slide.out.reverse{-webkit-animation-name:slideouttoright;}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%);}to{-webkit-transform:translateX(0);}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(-100%);}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0);}to{-webkit-transform:translateX(100%);}}@-webkit-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-webkit-keyframes fadeout{from{opacity:1;}to{opacity:0;}}.fade.in{z-index:10;-webkit-animation-name:fadein;}.fade.out{z-index:0;}.dissolve.in{-webkit-animation-name:fadein;}.dissolve.out{-webkit-animation-name:fadeout;}.flip{-webkit-animation-duration:.65s;}.flip.in{-webkit-animation-name:flipinfromleft;}.flip.out{-webkit-animation-name:flipouttoleft;}.flip.in.reverse{-webkit-animation-name:flipinfromright;}.flip.out.reverse{-webkit-animation-name:flipouttoright;}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8);}to{-webkit-transform:rotateY(0) scale(1);}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(-180deg) scale(.8);}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1);}to{-webkit-transform:rotateY(180deg) scale(.8);}}.slideup.in{-webkit-animation-name:slideup;z-index:10;}.slideup.out{-webkit-animation-name:dontmove;z-index:0;}.slideup.out.reverse{z-index:10;-webkit-animation-name:slidedown;}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes slideup{from{-webkit-transform:translateY(100%);}to{-webkit-transform:translateY(0);}}@-webkit-keyframes slidedown{from{-webkit-transform:translateY(0);}to{-webkit-transform:translateY(100%);}}@-webkit-keyframes dontmove{from{opacity:1;}to{opacity:1;}}.swap{-webkit-transform:perspective(800);-webkit-animation-duration:.7s;}.swap.out{-webkit-animation-name:swapouttoleft;}.swap.in{-webkit-animation-name:swapinfromright;}.swap.out.reverse{-webkit-animation-name:swapouttoright;}.swap.in.reverse{-webkit-animation-name:swapinfromleft;}@-webkit-keyframes swapouttoright{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);}}@-webkit-keyframes swapouttoleft{0%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);-webkit-animation-timing-function:ease-in-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in;}100%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);}}@-webkit-keyframes swapinfromright{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(-180px,0px,-400px) rotateY(20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}@-webkit-keyframes swapinfromleft{0%{-webkit-transform:translate3d(0px,0px,-800px) rotateY(-70deg);-webkit-animation-timing-function:ease-out;}50%{-webkit-transform:translate3d(180px,0px,-400px) rotateY(-20deg);-webkit-animation-timing-function:ease-in-out;}100%{-webkit-transform:translate3d(0px,0px,0px) rotateY(0deg);}}.cube{-webkit-animation-duration:.55s;}.cube.in{-webkit-animation-name:cubeinfromright;-webkit-transform-origin:0 50%;}.cube.out{-webkit-animation-name:cubeouttoleft;-webkit-transform-origin:100% 50%;}.cube.in.reverse{-webkit-animation-name:cubeinfromleft;-webkit-transform-origin:100% 50%;}.cube.out.reverse{-webkit-animation-name:cubeouttoright;-webkit-transform-origin:0 50%;}@-webkit-keyframes cubeinfromleft{from{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoright{from{-webkit-transform:rotateY(0deg) translateX(0);opacity:1;}to{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}}@-webkit-keyframes cubeinfromright{from{-webkit-transform:rotateY(90deg) translateZ(320px);opacity:.5;}to{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}}@-webkit-keyframes cubeouttoleft{from{-webkit-transform:rotateY(0deg) translateZ(0);opacity:1;}to{-webkit-transform:rotateY(-90deg) translateZ(320px);opacity:.5;}}.pop{-webkit-transform-origin:50% 50%;}.pop.in{-webkit-animation-name:popin;z-index:10;}.pop.out.reverse{-webkit-animation-name:popout;z-index:10;}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove;}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0;}to{-webkit-transform:scale(1);opacity:1;}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1;}to{-webkit-transform:scale(.2);opacity:0;}} \ No newline at end of file diff --git a/ajax/public/css/theme.css b/ajax/public/css/theme.css new file mode 100644 index 0000000..2e4f5c6 --- /dev/null +++ b/ajax/public/css/theme.css @@ -0,0 +1,725 @@ +body { + background: rgb(0,0,0); +} + +#jqt > * { + background: rgb(197,204,211) url(img/pinstripes.png); +} + +#jqt h1, #jqt h2 { + font: bold 18px "Helvetica Neue", Helvetica; + text-shadow: rgba(255,255,255,.2) 0 1px 1px; + color: rgb(76, 86, 108); + margin: 10px 20px 6px; +} + +/* @group Toolbar */ + +#jqt .toolbar { + -webkit-box-sizing: border-box; + border-bottom: 1px solid #2d3642; + padding: 10px; + height: 45px; + background: url(img/toolbar.png) #6d84a2 repeat-x; + position: relative; +} + +#jqt .black-translucent .toolbar { + margin-top: 20px; +} + +div#jqt .toolbar > h1 { + position: absolute; + overflow: hidden; + left: 50%; + top: 10px; + line-height: 1em; + margin: 1px 0 0 -75px; + height: 40px; + font-size: 20px; + width: 150px; + font-weight: bold; + text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + color: #fff; +} + +div#jqt.landscape .toolbar > h1 { + margin-left: -125px; + width: 250px; +} + +#jqt .button, #jqt .back, #jqt .cancel, #jqt .add { + position: absolute; + overflow: hidden; + top: 8px; + right: 6px; + margin: 0; + border-width: 0 5px; + padding: 0 3px; + width: auto; + height: 30px; + line-height: 30px; + font-family: inherit; + font-size: 12px; + font-weight: bold; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0; + text-overflow: ellipsis; + text-decoration: none; + white-space: nowrap; + background: none; + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .button.active, #jqt .cancel.active, #jqt .add.active { + -webkit-border-image: url(img/toolButton.png) 0 5 0 5; +} + +#jqt .blueButton { + -webkit-border-image: url(img/actionButton.png) 0 5 0 5; + border-width: 0 5px; +} + +#jqt .back { + left: 6px; + right: auto; + padding: 0; + max-width: 55px; + border-width: 0 8px 0 14px; + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .back.active { + -webkit-border-image: url(img/backButton.png) 0 8 0 14; +} + +#jqt .leftButton, #jqt .cancel { + left: 6px; + right: auto; +} + +#jqt .add { + font-size: 24px; + line-height: 24px; + font-weight: bold; +} + +#jqt .whiteButton, +#jqt .grayButton, #jqt .redButton, #jqt .blueButton, #jqt .greenButton { + display: block; + border-width: 0 12px; + padding: 10px; + text-align: center; + font-size: 20px; + font-weight: bold; + text-decoration: inherit; + color: inherit; +} + +#jqt .whiteButton.active, #jqt .grayButton.active, #jqt .redButton.active, #jqt .blueButton.active, #jqt .greenButton.active, +#jqt .whiteButton:active, #jqt .grayButton:active, #jqt .redButton:active, #jqt .blueButton:active, #jqt .greenButton:active { + -webkit-border-image: url(img/activeButton.png) 0 12 0 12; +} + +#jqt .whiteButton { + -webkit-border-image: url(img/whiteButton.png) 0 12 0 12; + text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0; +} + +#jqt .grayButton { + -webkit-border-image: url(img/grayButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .redButton { + -webkit-border-image: url(img/redButton.png) 0 12 0 12; + color: #FFFFFF; +} + +#jqt .greenButton { + -webkit-border-image: url(img/greenButton.png) 0 12 0 12; + color: #FFFFFF; +} + +/* @end */ + +/* @group Lists */ + +#jqt h1 + ul, #jqt h2 + ul, #jqt h3 + ul, #jqt h4 + ul, #jqt h5 + ul, #jqt h6 + ul { + margin-top: 0; +} + +#jqt ul { + color: black; + background: #fff; + border: 1px solid #B4B4B4; + font: bold 17px "Helvetica Neue", Helvetica; + padding: 0; + margin: 15px 10px 17px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul li { + color: #666; + border-top: 1px solid #B4B4B4; + list-style-type: none; + padding: 10px 10px 10px 10px; +} + +/* when you have a first LI item on any list */ + +#jqt li:first-child, #jqt li:first-child a { + border-top: 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} + +#jqt li:last-child, #jqt li:last-child a { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; +} + +/* universal arrows */ + +#jqt ul li.arrow { + background-image: url(img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt ul li.arrow a { + padding: 12px 22px 12px 10px; +} + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(../img/chevron.png); + background-position: right center; + background-repeat: no-repeat; +} + +/* universal links on list */ + +#jqt ul li a, #jqt li.img a + a { + color: #000; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 12px 10px 12px 10px; + margin: -10px; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +#jqt ul li a.active { + background: #194fdb url(img/selection.png) 0 0 repeat-x; + color: #fff; +} + +#jqt ul li a.button { + background-color: #194fdb; + color: #fff; +} + +#jqt ul li.img a + a { + margin: -10px 10px -20px -5px; + font-size: 17px; + font-weight: bold; +} + +#jqt ul li.img a + a + a { + font-size: 14px; + font-weight: normal; + margin-left: -10px; + margin-bottom: -10px; + margin-top: 0; +} + +#jqt ul li.img a + small + a { + margin-left: -5px; +} + +#jqt ul li.img a + small + a + a { + margin-left: -10px; + margin-top: -20px; + margin-bottom: -10px; + font-size: 14px; + font-weight: normal; +} + +#jqt ul li.img a + small + a + a + a { + margin-left: 0px !important; + margin-bottom: 0; +} + +#jqt ul li a + a { + color: #000; + font: 14px "Helvetica Neue", Helvetica; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} + +#jqt ul li a + a + a, #jqt ul li.img a + a + a + a, #jqt ul li.img a + small + a + a + a { + color: #666; + font: 13px "Helvetica Neue", Helvetica; + margin: 0; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + padding: 0; +} + +/* +@end */ + +/* @group Forms */ + +#jqt ul.form li { + padding: 7px 10px; +} + +#jqt ul.form li.error { + border: 2px solid red; +} + +#jqt ul.form li.error + li.error { + border-top: 0; +} + +#jqt ul.form li:hover { + background: #fff; +} + +#jqt ul li input[type="text"], +#jqt ul li input[type="password"], +#jqt ul li input[type="tel"], +#jqt ul li input[type="number"], +#jqt ul li input[type="search"], +#jqt ul li input[type="email"], +#jqt ul li input[type="url"], +#jqt ul li textarea, +#jqt ul li select { + color: #777; + background: #fff url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); + border: 0; + font: normal 17px "Helvetica Neue", Helvetica; + padding: 0; + display: inline-block; + margin-left: 0px; + width: 100%; + -webkit-appearance: textarea; +} + +#jqt ul li textarea { + height: 120px; + padding: 0; + text-indent: -2px; +} + +#jqt ul li select { + text-indent: 0px; + background: transparent url(../img/chevron.png) no-repeat 103% 3px; + -webkit-appearance: textfield; + margin-left: -6px; + width: 104%; +} + +#jqt ul li input[type="checkbox"], #jqt ul li input[type="radio"] { + margin: 0; + color: rgb(50,79,133); + padding: 10px 10px; +} + +#jqt ul li input[type="checkbox"]:after, #jqt ul li input[type="radio"]:after { + content: attr(title); + font: 17px "Helvetica Neue", Helvetica; + display: block; + width: 246px; + margin: -12px 0 0 17px; +} + +/* @end */ + +/* @group Edge to edge */ +#jqt ul.edgetoedge { + -webkit-border-radius: 0; +} + +#jqt ul.edgetoedge li.sep { + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(139, 159, 171, 1)), to(rgba(181, 193, 201, 1.0))); + border-bottom: 1px solid #b5c1c9; + border-top: 1px solid #b5c1c9; + color: #fff; + font-size: 16px; + margin: 1px 0 0 0; + padding: 2px 10px; + text-shadow: #636a6f 0 1px 0; +} + +#jqt .edgetoedge h4 { + color: #fff; + background: rgb(154,159,170) url(img/listGroup.png) top left repeat-x; + border-top: 1px solid rgb(165,177,186); + text-shadow: #666 0 1px 0; + margin: 0; + padding: 2px 10px; +} + +#jqt .edgetoedge, #jqt .metal { + margin: 0; + padding: 0; + background-color: rgb(255,255,255); +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul { + border-top: 0; + border-bottom: 0; + background: rgb(180,180,180); +} + +#jqt .edgetoedge ul li:first-child, +#jqt .edgetoedge ul li:first-child a, +#jqt .edgetoedge ul li:last-child, +#jqt .edgetoedge ul li:last-child a, +#jqt .metal ul li:first-child a, +#jqt .metal ul li:last-child a { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge ul li small { + font-size: 16px; + line-height: 28px; +} + +#jqt .edgetoedge li, #jqt .metal li { + -webkit-border-radius: 0; +} + +#jqt .edgetoedge li em { + font-weight: normal; + font-style: normal; +} + +#jqt .edgetoedge h4 + ul { + border-top: 1px solid rgb(152,158,164); + border-bottom: 1px solid rgb(113,125,133); +} + +/* @end */ + +/* @group Mini Label */ + +#jqt ul li small { + color: #369; + font: 17px "Helvetica Neue", Helvetica; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + width: 23%; + float: right; + padding: 3px 0px; +} + +#jqt ul li.arrow small { + padding: 0 15px; +} + +#jqt ul li small.counter { + font-size: 17px !important; + line-height: 13px !important; + font-weight: bold; + background: rgb(154,159,170); + color: #fff; + -webkit-border-radius: 11px; + padding: 4px 10px 5px 10px; + display: inline !important; + width: auto; + margin-top: -22px; +} + +#jqt ul li.arrow small.counter { + margin-right: 15px; +} + +/* @end */ + +/* @group Plastic */ + +#jqt #plastic ul li.arrow, #jqt #metal ul li.arrow { + background-image: url(img/listArrow.png); + background-position: right center; + background-repeat: no-repeat; +} + +#jqt .edgetoedge ul, #jqt .metal ul, #jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; +} + +#jqt .metal ul li { + border-top: 1px solid rgb(238,238,238); + border-bottom: 1px solid rgb(156,158,165); + font-size: 26px; + text-shadow: #fff 0 1px 0; +} + +#jqt .metal ul li a { + line-height: 26px; + margin: 0; + padding: 13px 0; +} + +#jqt .metal ul li a:hover { + color: rgb(0,0,0); +} + +#jqt .metal ul li:hover small { + color: inherit; +} + +#jqt .metal ul li a em { + display: block; + font-size: 14px; + font-style: normal; + color: #444; + width: 50%; + line-height: 14px; +} + +#jqt .metal ul li small { + float: right; + position: relative; + margin-top: 10px; + font-weight: bold; +} + +#jqt .metal ul li.arrow a small { + padding-right: 0; + line-height: 17px; +} + +#jqt .metal ul li.arrow { + background: url(../img/chevron.png) right center no-repeat; +} + +#jqt .plastic { + margin: 0; + padding: 0; + background: rgb(173,173,173); +} + +#jqt .plastic ul { + -webkit-border-radius: 0; + margin: 0; + border-left: 0; + border-right: 0; + border-top: 0; + background-color: rgb(173,173,173); +} + +#jqt .plastic ul li { + -webkit-border-radius: 0; + border-top: 1px solid rgb(191,191,191); + border-bottom: 1px solid rgb(157,157,157); +} + +#jqt .plastic ul li:nth-child(odd) { + background-color: rgb(152,152,152); + border-top: 1px solid rgb(181,181,181); + border-bottom: 1px solid rgb(138,138,138); +} + +#jqt .plastic ul + p { + font-size: 11px; + color: #2f3237; + text-shadow: none; + padding: 10px 10px; +} + +#jqt .plastic ul + p strong { + font-size: 14px; + line-height: 18px; + text-shadow: #fff 0 1px 0; +} + +#jqt .plastic ul li a { + text-shadow: rgb(211,211,211) 0 1px 0; +} + +#jqt .plastic ul li:nth-child(odd) a { + text-shadow: rgb(191,191,191) 0 1px 0; +} + +#jqt .plastic ul li small { + color: #3C3C3C; + text-shadow: rgb(211,211,211) 0 1px 0; + font-size: 13px; + font-weight: bold; + text-transform: uppercase; + line-height: 24px; +} + +#jqt #plastic ul.minibanner, #jqt #plastic ul.bigbanner { + margin: 10px; + border: 0; + height: 81px; + clear: both; +} + +#jqt #plastic ul.bigbanner { + height: 140px !important; +} + +#jqt #plastic ul.minibanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 145px; + height: 81px; + float: left; + -webkit-border-radius: 5px; + padding: 0; +} + +#jqt #plastic ul.bigbanner li { + border: 1px solid rgb(138,138,138); + background-color: rgb(152,152,152); + width: 296px; + height: 140px; + float: left; + -webkit-border-radius: 5px; + padding: 0; + margin-bottom: 4px; +} + +#jqt #plastic ul.minibanner li:first-child { + margin-right: 6px; +} + +#jqt #plastic ul.minibanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 145px; + height: 81px; +} + +#jqt #plastic ul.bigbanner li a { + color: transparent; + text-shadow: none; + display: block; + width: 296px; + height: 145px; +} + +/* @end */ + +/* @group Individual */ + +#jqt ul.individual { + border: 0; + background: none; + clear: both; + overflow: hidden; +} + +#jqt ul.individual li { + color: rgb(183,190,205); + background: white; + border: 1px solid rgb(180,180,180); + font-size: 14px; + text-align: center; + -webkit-border-radius: 8px; + -webkit-box-sizing: border-box; + width: 48%; + float: left; + display: block; + padding: 11px 10px 14px 10px; +} + +#jqt ul.individual li + li { + float: right; +} + +#jqt ul.individual li a { + color: rgb(50,79,133); + line-height: 16px; + margin: -11px -10px -14px -10px; + padding: 11px 10px 14px 10px; + -webkit-border-radius: 8px; +} + +#jqt ul.individual li a:hover { + color: #fff; + background: #36c; +} + +/* @end */ + +/* @group Toggle */ + + +#jqt .toggle { + width: 94px; + position: relative; + height: 27px; + display: block; + overflow: hidden; + float: right; +} + +#jqt .toggle input[type="checkbox"]:checked { + left: 0px; +} + +#jqt .toggle input[type="checkbox"] { + -webkit-tap-highlight-color: rgba(0,0,0,0); + margin: 0; + -webkit-border-radius: 5px; + background: #fff url(img/on_off.png) 0 0 no-repeat; + height: 27px; + overflow: hidden; + width: 149px; + border: 0; + -webkit-appearance: textarea; + background-color: transparent; + -webkit-transition: left .15s; + position: absolute; + top: 0; + left: -55px; +} +/* @end */ + + + +#jqt .info { + background: #dce1eb; + font-size: 12px; + line-height: 16px; + text-align: center; + text-shadow: rgba(255,255,255,.8) 0 1px 0; + color: rgb(76, 86, 108); + padding: 15px; + border-top: 1px solid rgba(76, 86, 108, .3); + font-weight: bold; +} diff --git a/ajax/public/css/theme.min.css b/ajax/public/css/theme.min.css deleted file mode 100644 index decc185..0000000 --- a/ajax/public/css/theme.min.css +++ /dev/null @@ -1 +0,0 @@ -body{background:#000;}body>*{background:#c5ccd3 url(img/pinstripes.png);}h1,h2{font:bold 18px Helvetica;text-shadow:rgba(255,255,255,.2) 0 1px 1px;color:#4c566c;margin:10px 20px 6px;}.toolbar{-webkit-box-sizing:border-box;border-bottom:1px solid #2d3642;padding:10px;height:45px;background:url(img/toolbar.png) #6d84a2 repeat-x;position:relative;}.black-translucent .toolbar{margin-top:20px;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;top:10px;line-height:1em;margin:1px 0 0 -75px;height:40px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#fff;}body.landscape .toolbar>h1{margin-left:-125px;width:250px;}.button,.back,.cancel,.add{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#fff;text-shadow:rgba(0,0,0,0.5) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;-webkit-border-image:url(img/toolButton.png) 0 5 0 5;}.button.active,.back.active,.cancel.active,.add.active{-webkit-border-image:url(img/toolButton.png) 0 5 0 5;}.blueButton{-webkit-border-image:url(img/blueButton.png) 0 5 0 5;border-width:0 5px;}.back{left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;-webkit-border-image:url(img/backButton.png) 0 8 0 14;}.leftButton,.cancel{left:6px;right:auto;}.add{font-size:24px;line-height:24px;font-weight:bold;}.whiteButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.whiteButton{-webkit-border-image:url(img/whiteButton.png) 0 12 0 12;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}.grayButton{-webkit-border-image:url(img/grayButton.png) 0 12 0 12;color:#FFF;}h1+ul,h2+ul,h3+ul,h4+ul,h5+ul,h6+ul{margin-top:0;}ul{color:black;background:#fff;border:1px solid #B4B4B4;font:bold 17px Helvetica;padding:0;margin:15px 10px 17px 10px;-webkit-border-radius:8px;}ul li{color:#666;border-top:1px solid #B4B4B4;list-style-type:none;padding:10px 10px 10px 10px;}li:first-child,li:first-child a{border-top:0;-webkit-border-top-left-radius:8px;-webkit-border-top-right-radius:8px;}li:last-child,li:last-child a{-webkit-border-bottom-left-radius:8px;-webkit-border-bottom-right-radius:8px;}ul li.arrow{background-image:url(img/chevron.png);background-position:right center;background-repeat:no-repeat;}#plastic ul li.arrow,#metal ul li.arrow{background-image:url(../images/chevron_dg.png);background-position:right center;background-repeat:no-repeat;}ul li a,li.img a+a{color:#000;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:12px 10px 12px 10px;margin:-10px;-webkit-tap-highlight-color:rgba(0,0,0,0);}ul li a.active{background:#194fdb url(img/selection.png) 0 0 repeat-x;color:#fff;}ul li a.button{background-color:#194fdb;color:#fff;}ul li.img a+a{margin:-10px 10px -20px -5px;font-size:17px;font-weight:bold;}ul li.img a+a+a{font-size:14px;font-weight:normal;margin-left:-10px;margin-bottom:-10px;margin-top:0;}ul li.img a+small+a{margin-left:-5px;}ul li.img a+small+a+a{margin-left:-10px;margin-top:-20px;margin-bottom:-10px;font-size:14px;font-weight:normal;}ul li.img a+small+a+a+a{margin-left:0!important;margin-bottom:0;}ul li a+a{color:#000;font:14px Helvetica;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin:0;padding:0;}ul li a+a+a,ul li.img a+a+a+a,ul li.img a+small+a+a+a{color:#666;font:13px Helvetica;margin:0;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;padding:0;}ul.form li{padding:7px 10px;}ul.form li.error{border:2px solid red;}ul.form li.error+li.error{border-top:0;}ul.form li:hover{background:#fff;}ul li input[type="text"],ul li input[type="password"],ul li textarea,ul li select{color:#777;background:#fff url(../.png);border:0;font:normal 17px Helvetica;padding:0;display:inline-block;margin-left:0;width:100%;-webkit-appearance:textarea;}ul li textarea{height:120px;padding:0;text-indent:-2px;}ul li select{text-indent:0;background:transparent url(../images/chevron.png) no-repeat 103% 3px;-webkit-appearance:textfield;margin-left:-6px;width:104%;}ul li input[type="checkbox"],ul li input[type="radio"]{margin:0;color:#324f85;padding:10px 10px;}ul li input[type="checkbox"]:after,ul li input[type="radio"]:after{content:attr(title);font:17px Helvetica;display:block;width:246px;margin:-12px 0 0 17px;}.edgetoedge h4{color:#fff;background:#9a9faa url(img/listGroup.png) top left repeat-x;border-top:1px solid #a5b1ba;text-shadow:#666 0 1px 0;margin:0;padding:2px 10px;}.edgetoedge,.metal{margin:0;padding:0;background-color:#fff;}.edgetoedge ul,.metal ul,.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;}.metal ul{border-top:0;border-bottom:0;background:#b4b4b4;}.edgetoedge ul li:first-child,.edgetoedge ul li:first-child a,.edgetoedge ul li:last-child,.edgetoedge ul li:last-child a,.metal ul li:first-child a,.metal ul li:last-child a{-webkit-border-radius:0;}.edgetoedge ul li small{font-size:16px;line-height:28px;}.edgetoedge li,.metal li{-webkit-border-radius:0;}.edgetoedge li em{font-weight:normal;font-style:normal;}.edgetoedge h4+ul{border-top:1px solid #989ea4;border-bottom:1px solid #717d85;}ul li small{color:#369;font:17px Helvetica;text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;width:23%;float:right;padding:3px 0;}ul li.arrow small{padding:0 15px;}ul li small.counter{font-size:17px!important;line-height:13px!important;font-weight:bold;background:#9a9faa;color:#fff;-webkit-border-radius:11px;padding:4px 10px 5px 10px;display:inline!important;width:auto;margin-top:-22px;}ul li.arrow small.counter{margin-right:15px;}#plastic ul li.arrow,#metal ul li.arrow{background-image:url(img/listArrow.png);background-position:right center;background-repeat:no-repeat;}.edgetoedge ul,.metal ul,.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;}.metal ul li{border-top:1px solid #eee;border-bottom:1px solid #9c9ea5;background:url(../images/bgMetal.png) top left repeat-x;font-size:26px;text-shadow:#fff 0 1px 0;}.metal ul li a{line-height:26px;margin:0;padding:13px 0;}.metal ul li a:hover{color:#000;}.metal ul li:hover small{color:inherit;}.metal ul li a em{display:block;font-size:14px;font-style:normal;color:#444;width:50%;line-height:14px;}.metal ul li small{float:right;position:relative;margin-top:10px;font-weight:bold;}.metal ul li.arrow a small{padding-right:0;line-height:17px;}.metal ul li.arrow{background:url(../images/bgMetal.png) top left repeat-x,url(../images/chevron_dg.png) right center no-repeat;}.plastic{margin:0;padding:0;background:#adadad;}.plastic ul{-webkit-border-radius:0;margin:0;border-left:0;border-right:0;border-top:0;background-color:#adadad;}.plastic ul li{-webkit-border-radius:0;border-top:1px solid #bfbfbf;border-bottom:1px solid #9d9d9d;}.plastic ul li:nth-child(odd){background-color:#989898;border-top:1px solid #b5b5b5;border-bottom:1px solid #8a8a8a;}.plastic ul+p{font-size:11px;color:#2f3237;text-shadow:none;padding:10px 10px;}.plastic ul+p strong{font-size:14px;line-height:18px;text-shadow:#fff 0 1px 0;}.plastic ul li a{text-shadow:#d3d3d3 0 1px 0;}.plastic ul li:nth-child(odd) a{text-shadow:#bfbfbf 0 1px 0;}.plastic ul li small{color:#3C3C3C;text-shadow:#d3d3d3 0 1px 0;font-size:13px;font-weight:bold;text-transform:uppercase;line-height:24px;}#plastic ul.minibanner,#plastic ul.bigbanner{margin:10px;border:0;height:81px;clear:both;}#plastic ul.bigbanner{height:140px!important;}#plastic ul.minibanner li{border:1px solid #8a8a8a;background-color:#989898;width:145px;height:81px;float:left;-webkit-border-radius:5px;padding:0;}#plastic ul.bigbanner li{border:1px solid #8a8a8a;background-color:#989898;width:296px;height:140px;float:left;-webkit-border-radius:5px;padding:0;margin-bottom:4px;}#plastic ul.minibanner li:first-child{margin-right:6px;}#plastic ul.minibanner li a{color:transparent;text-shadow:none;display:block;width:145px;height:81px;}#plastic ul.bigbanner li a{color:transparent;text-shadow:none;display:block;width:296px;height:145px;}ul.individual{border:0;background:none;clear:both;overflow:hidden;}ul.individual li{color:#b7becd;background:white;border:1px solid #b4b4b4;font-size:14px;text-align:center;-webkit-border-radius:8px;-webkit-box-sizing:border-box;width:48%;float:left;display:block;padding:11px 10px 14px 10px;}ul.individual li+li{float:right;}ul.individual li a{color:#324f85;line-height:16px;margin:-11px -10px -14px -10px;padding:11px 10px 14px 10px;-webkit-border-radius:8px;}ul.individual li a:hover{color:#fff;background:#36c;}.toggle{width:94px;position:relative;height:27px;display:block;overflow:hidden;float:right;}.toggle input[type="checkbox"]:checked{left:0;}.toggle input[type="checkbox"]{-webkit-tap-highlight-color:rgba(0,0,0,0);margin:0;-webkit-border-radius:5px;background:#fff url(img/on_off.png) 0 0 no-repeat;height:27px;overflow:hidden;width:149px;border:0;-webkit-appearance:textarea;background-color:transparent;-webkit-transition:left .15s;position:absolute;top:0;left:-55px;}.info{background:#dce1eb;font-size:12px;line-height:16px;text-align:center;text-shadow:rgba(255,255,255,.8) 0 1px 0;color:#4c566c;padding:15px;border-top:1px solid rgba(76,86,108,.3);font-weight:bold;} \ No newline at end of file diff --git a/ajax/public/js/jqtouch.js b/ajax/public/js/jqtouch.js new file mode 100644 index 0000000..d9dec9f --- /dev/null +++ b/ajax/public/js/jqtouch.js @@ -0,0 +1,662 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + + $Revision: 148 $ + $Date: 2010-04-25 05:00:00 +0800 (Sun, 25 Apr 2010) $ + $LastChangedBy: davidcolbykaneda $ + +*/ + +(function($) { + $.jQTouch = function(options) { + + // Set support values + $.support.WebKitCSSMatrix = (typeof WebKitCSSMatrix == "object"); + $.support.touch = (typeof Touch == "object"); + $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object"); + + // Initialize internal variables + var $body, + $head=$('head'), + hist=[], + newPageCount=0, + jQTSettings={}, + hashCheckInterval, + currentPage, + orientation, + isMobileWebKit = RegExp(" Mobile/").test(navigator.userAgent), + tapReady=true, + lastAnimationTime=0, + touchSelectors=[], + publicObj={}, + tapBuffer=351, + extensions=$.jQTouch.prototype.extensions, + defaultAnimations=['slide','flip','slideup','swap','cube','pop','dissolve','fade','back'], + animations=[], + hairextensions=''; + // Get the party started + init(options); + + function init(options) { + + var defaults = { + addGlossToIcon: true, + backSelector: '.back, .cancel, .goback', + cacheGetRequests: true, + cubeSelector: '.cube', + dissolveSelector: '.dissolve', + fadeSelector: '.fade', + fixedViewport: true, + flipSelector: '.flip', + formSelector: 'form', + fullScreen: true, + fullScreenClass: 'fullscreen', + icon: null, + touchSelector: 'a, .touch', + popSelector: '.pop', + preloadImages: false, + slideSelector: '#jqt > * > ul li a, .slide', + slideupSelector: '.slideup', + startupScreen: null, + statusBar: 'default', // other options: black-translucent, black + submitSelector: '.submit', + swapSelector: '.swap', + useAnimations: true, + useFastTouch: true // Experimental. + }; + jQTSettings = $.extend({}, defaults, options); + + // Preload images + if (jQTSettings.preloadImages) { + for (var i = jQTSettings.preloadImages.length - 1; i >= 0; i--) { + (new Image()).src = jQTSettings.preloadImages[i]; + }; + } + // Set icon + if (jQTSettings.icon) { + var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed'; + hairextensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />'; + } + // Set startup screen + if (jQTSettings.startupScreen) { + hairextensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />'; + } + // Set viewport + if (jQTSettings.fixedViewport) { + hairextensions += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>'; + } + // Set full-screen + if (jQTSettings.fullScreen) { + hairextensions += '<meta name="apple-mobile-web-app-capable" content="yes" />'; + if (jQTSettings.statusBar) { + hairextensions += '<meta name="apple-mobile-web-app-status-bar-style" content="' + jQTSettings.statusBar + '" />'; + } + } + if (hairextensions) { + $head.prepend(hairextensions); + } + + // Initialize on document ready: + $(document).ready(function() { + + // Add extensions + for (var i in extensions) { + var fn = extensions[i]; + if ($.isFunction(fn)) { + $.extend(publicObj, fn(publicObj)); + } + } + + // Add animations + for (var i in defaultAnimations) { + var name = defaultAnimations[i]; + var selector = jQTSettings[name + 'Selector']; + if (typeof(selector) == 'string') { + addAnimation({name:name, selector:selector}); + } + } + + touchSelectors.push('input'); + touchSelectors.push(jQTSettings.touchSelector); + touchSelectors.push(jQTSettings.backSelector); + touchSelectors.push(jQTSettings.submitSelector); + $(touchSelectors.join(', ')).css('-webkit-touch-callout', 'none'); + $(jQTSettings.backSelector).tap(liveTap); + $(jQTSettings.submitSelector).tap(submitParentForm); + + $body = $('#jqt'); + + if (jQTSettings.fullScreenClass && window.navigator.standalone == true) { + $body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar); + } + + // Create custom live events + $body + .bind('touchstart', handleTouch) + .bind('orientationchange', updateOrientation) + .trigger('orientationchange') + .submit(submitForm); + + if (jQTSettings.useFastTouch && $.support.touch) { + $body.click(function(e) { + var timeDiff = (new Date()).getTime() - lastAnimationTime; + if (timeDiff > tapBuffer) { + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA' && $el.attr('nodeName')!=='INPUT') { + $el = $el.closest('a, area'); + } + + if ($el.isExternalLink()) { + return true; + } + } + + return false; + + }); + + // This additionally gets rid of form focusses + $body.mousedown(function(e) { + var timeDiff = (new Date()).getTime() - lastAnimationTime; + if (timeDiff < tapBuffer) { + return false; + } + }); + } + + // Make sure exactly one child of body has "current" class + if ($('#jqt > .current').length == 0) { + currentPage = $('#jqt > *:first'); + } else { + currentPage = $('#jqt > .current:first'); + $('#jqt > .current').removeClass('current'); + } + + // Go to the top of the "current" page + $(currentPage).addClass('current'); + location.hash = '#' + $(currentPage).attr('id'); + addPageToHistory(currentPage); + scrollTo(0, 0); + startHashCheck(); + }); + } + + // PUBLIC FUNCTIONS + function goBack(to) { + // Init the param + if (hist.length <= 1) + { + window.history.go(-2); + } + + var numberOfPages = Math.min(parseInt(to || 1, 10), hist.length-1), + curPage = hist[0]; + + // Search through the history for an ID + if(isNaN(numberOfPages) && typeof(to) === "string" && to != '#' ) { + for( var i=1, length=hist.length; i < length; i++ ) { + if( '#' + hist[i].id === to ) { + numberOfPages = i; + break; + } + } + } + + // If still nothing, assume one + if(isNaN(numberOfPages) || numberOfPages < 1) { + numberOfPages = 1; + }; + + if (hist.length > 1) { + // Remove all pages in front of the target page + hist.splice(0, numberOfPages); + animatePages(curPage.page, hist[0].page, curPage.animation, curPage.reverse === false); + } else { + location.hash = '#' + curPage.id; + } + + return publicObj; + } + function goTo(toPage, animation, reverse) { + var fromPage = hist[0].page; + + if (typeof(animation) === 'string') { + for (var i = animations.length - 1; i >= 0; i--) { + if (animations[i].name === animation) { + animation = animations[i]; + break; + } + } + } + if (typeof(toPage) === 'string') { + nextPage = $(toPage); + if (nextPage.length < 1) + { + showPageByHref(toPage, { + 'animation': animation + }); + return; + } + else + { + toPage = nextPage; + } + + } + if (animatePages(fromPage, toPage, animation, reverse)) { + addPageToHistory(toPage, animation, reverse); + return publicObj; + } else { + console.error('Could not animate pages.'); + return false; + } + } + function getOrientation() { + return orientation; + } + + // PRIVATE FUNCTIONS + function liveTap(e){ + + // Grab the clicked element + var $el = $(e.target); + + if ($el.attr('nodeName')!=='A' && $el.attr('nodeName')!=='AREA') { + $el = $el.closest('a, area'); + } + + var target = $el.attr('target'), + hash = $el.attr('hash'), + animation=null; + + if (tapReady == false || !$el.length) { + console.warn('Not able to tap element.'); + return false; + } + + if ($el.isExternalLink()) { + $el.removeClass('active'); + return true; + } + + // Figure out the animation to use + for (var i = animations.length - 1; i >= 0; i--) { + if ($el.is(animations[i].selector)) { + animation = animations[i]; + break; + } + }; + + // User clicked an internal link, fullscreen mode + if (target == '_webapp') { + window.location = $el.attr('href'); + } + // User clicked a back button + else if ($el.is(jQTSettings.backSelector)) { + goBack(hash); + } + // Allow tap on item with no href + else if ($el.attr('href') == '#') { + $el.unselect(); + return true; + } + // Branch on internal or external href + else if (hash && hash!='#') { + $el.addClass('active'); + goTo($(hash).data('referrer', $el), animation, $(this).hasClass('reverse')); + } else { + $el.addClass('loading active'); + showPageByHref($el.attr('href'), { + animation: animation, + callback: function() { + $el.removeClass('loading'); setTimeout($.fn.unselect, 250, $el); + }, + $referrer: $el + }); + } + return false; + } + function addPageToHistory(page, animation, reverse) { + // Grab some info + var pageId = page.attr('id'); + // Prepend info to page history + hist.unshift({ + page: page, + animation: animation, + reverse: reverse || false, + id: pageId + }); + } + function animatePages(fromPage, toPage, animation, backwards) { + // Error check for target page + if (toPage.length === 0) { + $.fn.unselect(); + console.error('Target element is missing.'); + return false; + } + + // Error check for fromPage=toPage + if (toPage.hasClass('current')) { + $.fn.unselect(); + console.error('Target element is the current page.'); + return false; + } + + // Collapse the keyboard + $(':focus').blur(); + + // Make sure we are scrolled up to hide location bar + toPage.css('top', window.pageYOffset); + + // Define callback to run after animation completes + var callback = function animationEnd(event) { + + fromPage[0].removeEventListener('webkitTransitionEnd', callback); + fromPage[0].removeEventListener('webkitAnimationEnd', callback); + + if (animation) { + toPage.removeClass('start in ' + animation.name); + fromPage.removeClass('start out current ' + animation.name); + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + toPage.css('top', 0); + } else { + fromPage.removeClass('current'); + } + + toPage.trigger('pageAnimationEnd', { direction: 'in', reverse: backwards }); + fromPage.trigger('pageAnimationEnd', { direction: 'out', reverse: backwards }); + + clearInterval(hashCheckInterval); + currentPage = toPage; + location.hash = '#' + currentPage.attr('id'); + startHashCheck(); + + var $originallink = toPage.data('referrer'); + if ($originallink) { + $originallink.unselect(); + } + lastAnimationTime = (new Date()).getTime(); + tapReady = true; + + } + + fromPage.trigger('pageAnimationStart', { direction: 'out' }); + toPage.trigger('pageAnimationStart', { direction: 'in' }); + + if ($.support.WebKitAnimationEvent && animation && jQTSettings.useAnimations) { + tapReady = false; + if (backwards) { + toPage.toggleClass('reverse'); + fromPage.toggleClass('reverse'); + } + + // Support both transitions and animations + fromPage[0].addEventListener('webkitTransitionEnd', callback); + fromPage[0].addEventListener('webkitAnimationEnd', callback); + + toPage.addClass(animation.name + ' in current'); + fromPage.addClass(animation.name + ' out'); + + setTimeout(function(){ + toPage.addClass('start'); + fromPage.addClass('start'); + }, 0); + + + } else { + toPage.addClass('current'); + callback(); + } + + return true; + } + function hashCheck() { + var curid = currentPage.attr('id'); + if (location.hash != '#' + curid) { + clearInterval(hashCheckInterval); + goBack(location.hash); + } + else if (location.hash == '') { + location.hash = '#' + curid; + } + } + function startHashCheck() { + hashCheckInterval = setInterval(hashCheck, 100); + } + function insertPages(nodes, animation) { + var targetPage = null; + $(nodes).each(function(index, node) { + var $node = $(this); + if (!$node.attr('id')) { + $node.attr('id', 'page-' + (++newPageCount)); + } + + $body.trigger('pageInserted', {page: $node.appendTo($body)}); + + if ($node.hasClass('current') || !targetPage) { + targetPage = $node; + } + }); + if (targetPage !== null) { + goTo(targetPage, animation); + return targetPage; + } else { + return false; + } + } + function showPageByHref(href, options) { + var defaults = { + data: null, + method: 'GET', + animation: null, + callback: null, + $referrer: null + }; + + var settings = $.extend({}, defaults, options); + + if (href != '#') { + $.ajax({ + url: href, + data: settings.data, + type: settings.method, + success: function (data, textStatus) { + var firstPage = insertPages(data, settings.animation); + if (firstPage) { + if (settings.method == 'GET' && jQTSettings.cacheGetRequests === true && settings.$referrer) { + settings.$referrer.attr('href', '#' + firstPage.attr('id')); + } + if (settings.callback) { + settings.callback(true); + } + } + }, + error: function (data) { + if (settings.$referrer) { + settings.$referrer.unselect(); + } + if (settings.callback) { + settings.callback(false); + } + } + }); + } + else if (settings.$referrer) { + settings.$referrer.unselect(); + } + } + function submitForm(e, callback) { + var $form = (typeof(e)==='string') ? $(e).eq(0) : (e.target ? $(e.target) : $(e)); + + if ($form.length && $form.is(jQTSettings.formSelector)) { + showPageByHref($form.attr('action'), { + data: $form.serialize(), + method: $form.attr('method') || "POST", + animation: animations[0] || null, + callback: callback + }); + return false; + } + return true; + } + function submitParentForm(e) { + var $form = $(this).closest('form'); + if ($form.length) { + var evt = $.Event("submit"); + evt.preventDefault(); + $form.trigger(evt); + return false; + } + return true; + } + function addAnimation(animation) { + if (typeof(animation.selector) == 'string' && typeof(animation.name) == 'string') { + animations.push(animation); + $(animation.selector).tap(liveTap); + touchSelectors.push(animation.selector); + } + } + function updateOrientation() { + orientation = Math.abs(window.orientation) == 90 ? 'landscape' : 'portrait'; + $body.removeClass('portrait landscape').addClass(orientation).trigger('turn', {orientation: orientation}); + } + function handleTouch(e) { + var $el = $(e.target); + + // Only handle touchSelectors + if (!$(e.target).is(touchSelectors.join(', '))) { + var $link = $(e.target).closest('a, area'); + + if ($link.length && $link.is(touchSelectors.join(', '))) { + $el = $link; + } else { + return; + } + } + + if (e) { + var hoverTimeout = null, + startX = event.changedTouches[0].clientX, + startY = event.changedTouches[0].clientY, + startTime = (new Date).getTime(), + deltaX = 0, + deltaY = 0, + deltaT = 0; + + // Let's bind these after the fact, so we can keep some internal values + $el.bind('touchmove', touchmove).bind('touchend', touchend); + + hoverTimeout = setTimeout(function() { + $el.makeActive(); + }, 100); + + } + + // Private touch functions (TODO: insert dirty joke) + function touchmove(e) { + + updateChanges(); + var absX = Math.abs(deltaX); + var absY = Math.abs(deltaY); + + // Check for swipe + if (absX > absY && (absX > 35) && deltaT < 1000) { + $el.trigger('swipe', {direction: (deltaX < 0) ? 'left' : 'right', deltaX: deltaX, deltaY: deltaY }).unbind('touchmove',touchmove).unbind('touchend',touchend); + } else if (absY > 1) { + $el.removeClass('active'); + } + + clearTimeout(hoverTimeout); + } + + function touchend() { + updateChanges(); + + if (deltaY === 0 && deltaX === 0) { + $el.makeActive(); + $el.trigger('tap'); + } else { + $el.removeClass('active'); + } + $el.unbind('touchmove',touchmove).unbind('touchend',touchend); + clearTimeout(hoverTimeout); + } + + function updateChanges() { + var first = event.changedTouches[0] || null; + deltaX = first.pageX - startX; + deltaY = first.pageY - startY; + deltaT = (new Date).getTime() - startTime; + } + + } // End touch handler + + // Public jQuery Fns + $.fn.unselect = function(obj) { + if (obj) { + obj.removeClass('active'); + } else { + $('.active').removeClass('active'); + } + } + $.fn.makeActive = function() { + return $(this).addClass('active'); + } + $.fn.swipe = function(fn) { + if ($.isFunction(fn)) { + return $(this).live('swipe', fn); + } else { + return $(this).trigger('swipe'); + } + } + $.fn.tap = function(fn) { + if ($.isFunction(fn)) { + var tapEvent = (jQTSettings.useFastTouch && $.support.touch) ? 'tap' : 'click'; + return $(this).live(tapEvent, fn); + } else { + return $(this).trigger('tap'); + } + } + $.fn.isExternalLink = function() { + var $el = $(this); + return ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' || $el.is('input[type="checkbox"], input[type="radio"], a[href^="http://maps.google.com"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]')); + } + + publicObj = { + getOrientation: getOrientation, + goBack: goBack, + goTo: goTo, + addAnimation: addAnimation, + submitForm: submitForm + } + + return publicObj; + } + + // Extensions directly manipulate the jQTouch object, before it's initialized. + $.jQTouch.prototype.extensions = []; + $.jQTouch.addExtension = function(extension) { + $.jQTouch.prototype.extensions.push(extension); + } + +})(jQuery); diff --git a/ajax/public/js/jqtouch.min.js b/ajax/public/js/jqtouch.min.js deleted file mode 100644 index 7d4fe4a..0000000 --- a/ajax/public/js/jqtouch.min.js +++ /dev/null @@ -1 +0,0 @@ -(function($){$.jQTouch=function(_2){$.support.WebKitCSSMatrix=(typeof WebKitCSSMatrix=="object");$.support.touch=(typeof Touch=="object");$.support.WebKitAnimationEvent=(typeof WebKitTransitionEvent=="object");var _3,$head=$("head"),hist=[],newPageCount=0,jQTSettings={},hashCheck,currentPage,orientation,isMobileWebKit=RegExp(" Mobile/").test(navigator.userAgent),tapReady=true,lastAnimationTime=0,touchSelectors=[],publicObj={},extensions=$.jQTouch.prototype.extensions,defaultAnimations=["slide","flip","slideup","swap","cube","pop","dissolve","fade","back"],animations=[],hairextensions="";init(_2);function init(_4){var _5={addGlossToIcon:true,backSelector:".back, .cancel, .goback",cacheGetRequests:true,cubeSelector:".cube",dissolveSelector:".dissolve",fadeSelector:".fade",fixedViewport:true,flipSelector:".flip",formSelector:"form",fullScreen:true,fullScreenClass:"fullscreen",icon:null,touchSelector:"a, .touch",popSelector:".pop",preloadImages:false,slideSelector:"body > * > ul li a",slideupSelector:".slideup",startupScreen:null,statusBar:"default",submitSelector:".submit",swapSelector:".swap",useAnimations:true,useFastTouch:true};jQTSettings=$.extend({},_5,_4);if(jQTSettings.preloadImages){for(var i=jQTSettings.preloadImages.length-1;i>=0;i--){(new Image()).src=jQTSettings.preloadImages[i];}}if(jQTSettings.icon){var _7=(jQTSettings.addGlossToIcon)?"":"-precomposed";hairextensions+="<link rel=\"apple-touch-icon"+_7+"\" href=\""+jQTSettings.icon+"\" />";}if(jQTSettings.startupScreen){hairextensions+="<link rel=\"apple-touch-startup-image\" href=\""+jQTSettings.startupScreen+"\" />";}if(jQTSettings.fixedViewport){hairextensions+="<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;\"/>";}if(jQTSettings.fullScreen){hairextensions+="<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />";if(jQTSettings.statusBar){hairextensions+="<meta name=\"apple-mobile-web-app-status-bar-style\" content=\""+jQTSettings.statusBar+"\" />";}}if(hairextensions){$head.append(hairextensions);}$(document).ready(function(){for(var i in extensions){var fn=extensions[i];if($.isFunction(fn)){$.extend(publicObj,fn(publicObj));}}for(var i in defaultAnimations){var _a=defaultAnimations[i];var _b=jQTSettings[_a+"Selector"];if(typeof (_b)=="string"){addAnimation({name:_a,selector:_b});}}touchSelectors.push("input");touchSelectors.push(jQTSettings.touchSelector);touchSelectors.push(jQTSettings.backSelector);touchSelectors.push(jQTSettings.submitSelector);$(touchSelectors.join(", ")).css("-webkit-touch-callout","none");$(jQTSettings.backSelector).tap(liveTap);$(jQTSettings.submitSelector).tap(submitParentForm);_3=$("body");if(jQTSettings.fullScreenClass&&window.navigator.standalone==true){_3.addClass(jQTSettings.fullScreenClass+" "+jQTSettings.statusBar);}_3.bind("touchstart",handleTouch).bind("orientationchange",updateOrientation).trigger("orientationchange").submit(submitForm);if(jQTSettings.useFastTouch&&$.support.touch){_3.click(function(e){var _d=$(e.target);if(_d.attr("target")=="_blank"||_d.attr("rel")=="external"||_d.is("input[type=\"checkbox\"]")){return true;}else{return false;}});_3.mousedown(function(e){var _f=(new Date()).getTime()-lastAnimationTime;if(_f<200){return false;}});}if($("body > .current").length==0){currentPage=$("body > *:first");}else{currentPage=$("body > .current:first");$("body > .current").removeClass("current");}$(currentPage).addClass("current");location.hash=$(currentPage).attr("id");addPageToHistory(currentPage);scrollTo(0,0);dumbLoopStart();});}function goBack(to){if(hist.length>1){var _11=Math.min(parseInt(to||1,10),hist.length-1);if(isNaN(_11)&&typeof (to)==="string"&&to!="#"){for(var i=1,length=hist.length;i<length;i++){if("#"+hist[i].id===to){_11=i;break;}}}if(isNaN(_11)||_11<1){_11=1;}var _13=hist[0].animation;var _14=hist[0].page;hist.splice(0,_11);var _15=hist[0].page;animatePages(_14,_15,_13,true);return publicObj;}else{console.error("No pages in history.");return false;}}function goTo(_16,_17){var _18=hist[0].page;if(typeof (_16)==="string"){_16=$(_16);}if(typeof (_17)==="string"){for(var i=animations.length-1;i>=0;i--){if(animations[i].name===_17){_17=animations[i];break;}}}if(animatePages(_18,_16,_17)){addPageToHistory(_16,_17);return publicObj;}else{console.error("Could not animate pages.");return false;}}function getOrientation(){return orientation;}function liveTap(e){var $el=$(e.target);if($el.attr("nodeName")!=="A"){$el=$el.parent("a");}var _1c=$el.attr("target"),hash=$el.attr("hash"),animation=null;if(tapReady==false||!$el.length){console.warn("Not able to tap element.");return false;}if($el.attr("target")=="_blank"||$el.attr("rel")=="external"){return true;}for(var i=animations.length-1;i>=0;i--){if($el.is(animations[i].selector)){animation=animations[i];break;}}if(_1c=="_webapp"){window.location=$el.attr("href");}else{if($el.is(jQTSettings.backSelector)){goBack(hash);}else{if(hash&&hash!="#"){$el.addClass("active");goTo($(hash).data("referrer",$el),animation);}else{$el.addClass("loading active");showPageByHref($el.attr("href"),{animation:animation,callback:function(){$el.removeClass("loading");setTimeout($.fn.unselect,250,$el);},$referrer:$el});}}}return false;}function addPageToHistory(_1e,_1f){var _20=_1e.attr("id");hist.unshift({page:_1e,animation:_1f,id:_20});}function animatePages(_21,_22,_23,_24){if(_22.length===0){$.fn.unselect();console.error("Target element is missing.");return false;}$(":focus").blur();scrollTo(0,0);var _25=function(_26){if(_23){_22.removeClass("in reverse "+_23.name);_21.removeClass("current out reverse "+_23.name);}else{_21.removeClass("current");}_22.trigger("pageAnimationEnd",{direction:"in"});_21.trigger("pageAnimationEnd",{direction:"out"});clearInterval(dumbLoop);currentPage=_22;location.hash=currentPage.attr("id");dumbLoopStart();var _27=_22.data("referrer");if(_27){_27.unselect();}lastAnimationTime=(new Date()).getTime();tapReady=true;};_21.trigger("pageAnimationStart",{direction:"out"});_22.trigger("pageAnimationStart",{direction:"in"});if($.support.WebKitAnimationEvent&&_23&&jQTSettings.useAnimations){_22.one("webkitAnimationEnd",_25);tapReady=false;_22.addClass(_23.name+" in current "+(_24?" reverse":""));_21.addClass(_23.name+" out"+(_24?" reverse":""));}else{_22.addClass("current");_25();}return true;}function dumbLoopStart(){dumbLoop=setInterval(function(){var _28=currentPage.attr("id");if(location.hash==""){location.hash="#"+_28;}else{if(location.hash!="#"+_28){try{goBack(location.hash);}catch(e){console.error("Unknown hash change.");}}}},100);}function insertPages(_29,_2a){var _2b=null;$(_29).each(function(_2c,_2d){var _2e=$(this);if(!_2e.attr("id")){_2e.attr("id","page-"+(++newPageCount));}_2e.appendTo(_3);if(_2e.hasClass("current")||!_2b){_2b=_2e;}});if(_2b!==null){goTo(_2b,_2a);return _2b;}else{return false;}}function showPageByHref(_2f,_30){var _31={data:null,method:"GET",animation:null,callback:null,$referrer:null};var _32=$.extend({},_31,_30);if(_2f!="#"){$.ajax({url:_2f,data:_32.data,type:_32.method,success:function(_33,_34){var _35=insertPages(_33,_32.animation);if(_35){if(_32.method=="GET"&&jQTSettings.cacheGetRequests&&_32.$referrer){_32.$referrer.attr("href","#"+_35.attr("id"));}if(_32.callback){_32.callback(true);}}},error:function(_36){if(_32.$referrer){_32.$referrer.unselect();}if(_32.callback){_32.callback(false);}}});}else{if($referrer){$referrer.unselect();}}}function submitForm(e,_38){var _39=(typeof (e)==="string")?$(e):$(e.target);if(_39.length&&_39.is(jQTSettings.formSelector)&&_39.attr("action")){showPageByHref(_39.attr("action"),{data:_39.serialize(),method:_39.attr("method")||"POST",animation:animations[0]||null,callback:_38});return false;}return true;}function submitParentForm(e){var _3b=$(this).closest("form");if(_3b.length){evt=jQuery.Event("submit");evt.preventDefault();_3b.trigger(evt);return false;}return true;}function addAnimation(_3c){if(typeof (_3c.selector)=="string"&&typeof (_3c.name)=="string"){animations.push(_3c);$(_3c.selector).tap(liveTap);touchSelectors.push(_3c.selector);}}function updateOrientation(){orientation=window.innerWidth<window.innerHeight?"profile":"landscape";_3.removeClass("profile landscape").addClass(orientation).trigger("turn",{orientation:orientation});}function handleTouch(e){var $el=$(e.target);if(!$(e.target).is(touchSelectors.join(", "))){var _3f=$(e.target).closest("a");if(_3f.length){$el=_3f;}else{return;}}if(event){var _40=null,startX=event.changedTouches[0].clientX,startY=event.changedTouches[0].clientY,startTime=(new Date).getTime(),deltaX=0,deltaY=0,deltaT=0;$el.bind("touchmove",touchmove).bind("touchend",touchend);_40=setTimeout(function(){$el.makeActive();},100);}function touchmove(e){updateChanges();var _42=Math.abs(deltaX);var _43=Math.abs(deltaY);if(_42>_43&&(_42>35)&&deltaT<1000){$el.trigger("swipe",{direction:(deltaX<0)?"left":"right"}).unbind("touchmove touchend");}else{if(_43>1){$el.removeClass("active");}}clearTimeout(_40);}function touchend(){updateChanges();if(deltaY===0&&deltaX===0){$el.makeActive();$el.trigger("tap");}else{$el.removeClass("active");}$el.unbind("touchmove touchend");clearTimeout(_40);}function updateChanges(){var _44=event.changedTouches[0]||null;deltaX=_44.pageX-startX;deltaY=_44.pageY-startY;deltaT=(new Date).getTime()-startTime;}}$.fn.unselect=function(obj){if(obj){obj.removeClass("active");}else{$(".active").removeClass("active");}};$.fn.makeActive=function(){return $(this).addClass("active");};$.fn.swipe=function(fn){if($.isFunction(fn)){return this.each(function(i,el){$(el).bind("swipe",fn);});}};$.fn.tap=function(fn){if($.isFunction(fn)){var _4a=(jQTSettings.useFastTouch&&$.support.touch)?"tap":"click";return $(this).live(_4a,fn);}else{$(this).trigger("tap");}};publicObj={getOrientation:getOrientation,goBack:goBack,goTo:goTo,addAnimation:addAnimation,submitForm:submitForm};return publicObj;};$.jQTouch.prototype.extensions=[];$.jQTouch.addExtension=function(_4b){$.jQTouch.prototype.extensions.push(_4b);};})(jQuery); diff --git a/ajax/public/js/jqtouch.transitions.js b/ajax/public/js/jqtouch.transitions.js new file mode 100644 index 0000000..9d8970f --- /dev/null +++ b/ajax/public/js/jqtouch.transitions.js @@ -0,0 +1,60 @@ +/* + + _/ _/_/ _/_/_/_/_/ _/ + _/ _/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ + _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ + _/ + _/ + + Created by David Kaneda <http://www.davidkaneda.com> + Documentation and issue tracking on Google Code <http://code.google.com/p/jqtouch/> + + Special thanks to Jonathan Stark <http://jonathanstark.com/> + and pinch/zoom <http://www.pinchzoom.com/> + + (c) 2009 by jQTouch project members. + See LICENSE.txt for license. + +*/ + +(function($) { + + $.fn.transition = function(css, options) { + return this.each(function(){ + var $el = $(this); + var defaults = { + speed : '300ms', + callback: null, + ease: 'ease-in-out' + }; + var settings = $.extend({}, defaults, options); + if(settings.speed === 0) { + $el.css(css); + window.setTimeout(settings.callback, 0); + } else { + if ($.browser.safari) + { + var s = []; + for(var i in css) { + s.push(i); + } + $el.css({ + webkitTransitionProperty: s.join(", "), + webkitTransitionDuration: settings.speed, + webkitTransitionTimingFunction: settings.ease + }); + if (settings.callback) { + $el.one('webkitTransitionEnd', settings.callback); + } + setTimeout(function(el){ el.css(css) }, 0, $el); + } + else + { + $el.animate(css, settings.speed, settings.callback); + } + } + }); + } +})(jQuery); \ No newline at end of file diff --git a/ajax/public/js/jquery-1.4.2.min.js b/ajax/public/js/jquery-1.4.2.min.js new file mode 100644 index 0000000..7c24308 --- /dev/null +++ b/ajax/public/js/jquery-1.4.2.min.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? +e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= +j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, +"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= +true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| +c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", +L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, +"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ +a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], +d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== +a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& +!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= +true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", +i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", +" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= +this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= +e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= +null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), +fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| +d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, +"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= +a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, +isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= +{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; +if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& +!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, +toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, +u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), +function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; +if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; +for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- +1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, +CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, +relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= +l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; +h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= +m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| +!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= +h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, +gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; +c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)? +a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&& +this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]|| +u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length=== +1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay"); +this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a], +"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)}, +animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing= +j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]); +this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length|| +c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement? +function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b= +this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle; +k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&& +f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/ajax/public/js/jquery.1.3.2.min.js b/ajax/public/js/jquery.1.3.2.min.js deleted file mode 100644 index b1ae21d..0000000 --- a/ajax/public/js/jquery.1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/ajax/views/index.haml b/ajax/views/index.haml index b099090..dc72210 100644 --- a/ajax/views/index.haml +++ b/ajax/views/index.haml @@ -1,45 +1,46 @@ -#index.current - .toolbar - %h1 Factual Demo - %ul.links - %li.arrow - %a{ :href => '#users' } Users - %small.counter= @users.count - %li.arrow - %a{ :href => '#signup' } Signup +#jqt + #index.current + .toolbar + %h1 Factual Demo + %ul.links + %li.arrow + %a{ :href => '#users' } Users + %small.counter= @users.count + %li.arrow + %a{ :href => '#signup' } Signup -#users - .toolbar - %h1 Users - %a.back{ :href => '#index' } Back - %ul.edgetoedge - - @users.each do |u| - %li - %a= u[:username] + #users + .toolbar + %h1 Users + %a.back{ :href => '#index' } Back + %ul.edgetoedge + - @users.each do |u| + %li + %a= u[:username] -#signup - .toolbar - %h1 Register a new account - %a.back{ :href => '#index' } Back - %form{ :action => '/signup', :method => 'POST' } - %ul.form - %li - %input{ :name => 'username', :placeholder => 'username', :type => 'text' }/ - %li - %input{ :name => 'password', :placeholder => 'password', :type => 'password' }/ - %li - %input{ :name => 'password_confirmation', :placeholder => 'verify password', :type => 'password' }/ - %li - %input{ :name => 'over_21', :title => 'I am at least 21 years old', :type => 'checkbox' }/ - %li - %input{ :name => 'terms_of_service', :title => 'I accept the Factual', :type => 'checkbox' }/ - %li.arrow - %a{ :href => '#terms_of_service' } Terms of Service - %a.submit.whiteButton{ :href => '#', :style => "margin:0 10px;color:rgba(0,0,0,.9)" } Done + #signup + .toolbar + %h1 Register a new account + %a.back{ :href => '#index' } Back + %form{ :action => '/signup', :method => 'POST' } + %ul.form + %li + %input{ :name => 'username', :placeholder => 'username', :type => 'text' }/ + %li + %input{ :name => 'password', :placeholder => 'password', :type => 'password' }/ + %li + %input{ :name => 'password_confirmation', :placeholder => 'verify password', :type => 'password' }/ + %li + %input{ :name => 'over_21', :title => 'I am at least 21 years old', :type => 'checkbox' }/ + %li + %input{ :name => 'terms_of_service', :title => 'I accept the Factual', :type => 'checkbox' }/ + %li.arrow + %a{ :href => '#terms_of_service' } Terms of Service + %a.submit.whiteButton{ :href => '#', :style => "margin:0 10px;color:rgba(0,0,0,.9)" } Done -#terms_of_service - .toolbar - %h1 Terms of Service - %a.back{ :href => '#' } Back - %p - All legal text as required by our attorney + #terms_of_service + .toolbar + %h1 Terms of Service + %a.back{ :href => '#' } Back + %p + All legal text as required by our attorney diff --git a/ajax/views/layout.haml b/ajax/views/layout.haml index 6813f58..038ccc7 100644 --- a/ajax/views/layout.haml +++ b/ajax/views/layout.haml @@ -1,12 +1,12 @@ !!! %html %head %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/ - %style{ :type => "text/css", :media => "screen" } @import "/css/jqtouch.min.css"; - %style{ :type => "text/css", :media => "screen" } @import "/css/theme.min.css"; - %script{ :src => "/js/jquery.1.3.2.min.js", :type => "text/javascript", :charset => "utf-8" } - %script{ :src => "/js/jqtouch.min.js", :type => "application/x-javascript", :charset => "utf-8" } + %style{ :type => "text/css", :media => "screen" } @import "/css/jqtouch.css"; + %style{ :type => "text/css", :media => "screen" } @import "/css/theme.css"; + %script{ :src => "/js/jquery-1.4.2.min.js", :type => "text/javascript", :charset => "utf-8" } + %script{ :src => "/js/jqtouch.js", :type => "application/x-javascript", :charset => "utf-8" } :javascript var jQT = new $.jQTouch({}); %body = yield diff --git a/ajax/views/signup.haml b/ajax/views/signup.haml index c0c79a0..6387074 100644 --- a/ajax/views/signup.haml +++ b/ajax/views/signup.haml @@ -1,19 +1,19 @@ -%div +#signup .toolbar %h1 Register a new account %a.back{ :href => '#index' } Back %form{ :action => '/signup', :method => 'POST' } %ul.form %li{ :class => "#{"error" if @errors[:username]}" } %input{ :name => 'username', :placeholder => 'username', :type => 'text' }/ %li{ :class => "#{"error" if @errors[:password]}" } %input{ :name => 'password', :placeholder => 'password', :type => 'password' }/ %li{ :class => "#{"error" if @errors[:password_confirmation]}" } %input{ :name => 'password_confirmation', :placeholder => 'verify password', :type => 'password' }/ %li{ :class => "#{"error" if @errors[:statements]}" } %input{ :name => 'over_21', :title => 'I am at least 21 years old', :type => 'checkbox' }/ %li{ :class => "#{"error" if @errors[:statements]}" } %input{ :name => 'terms_of_service', :title => 'I accept the Factual', :type => 'checkbox' }/ %li.arrow %a{ :href => '#terms_of_service' } Terms of Service %a.submit.whiteButton{ :href => '#', :style => "margin:0 10px;color:rgba(0,0,0,.9)" } Done diff --git a/ajax/views/success.haml b/ajax/views/success.haml index 59c8e0c..d941324 100644 --- a/ajax/views/success.haml +++ b/ajax/views/success.haml @@ -1,25 +1,25 @@ -#success.current +#success .toolbar %h1 Success %a.back{ :href => '#index' } Back .message Thanks for you registion. #index .toolbar %h1 Factual Demo %ul.links %li.arrow %a{ :href => '#users' } Users %small.counter= @users.count %li.arrow %a{ :href => '#signup' } Signup #users .toolbar %h1 Users %a.back{ :href => '#index' } Back %ul.edgetoedge - @users.each do |u| %li %a= u[:username]