The JsWidget is nearly ready! Please try the 0.9 preview.
This widget generated will be similar to the chooser currently deployed at CC Labs.
The following is a simple example of how the widget would be included in a page to create a license selector. A live demonstration is available on the CC labs site.
<html> <link rel="stylesheet" href="http://labs.creativecommons.org/jswidget/tags/0.9/example_web_app/example-widget-style.css" /> <head> <title>Example Widget Page</title> </head> <body> . . . <div id="cc_widget_container"> <script src="http://api.creativecommons.org/jswidget/tags/0.9/complete.js"></script>
. . . </body> </html>
You can play with a 0.9 pre-release right now!
- 2007-08-09: Released 0.9. This is the official preview that will probably become 1.0. All DOM elements are really prefixed with cc_js_ this time, and all strings really are available for translation this time. Documentation is updated for the 0.9 release, including a way to have the application developer specify only a single jurisdiction for the license. JSON output is validated before being sent to a web browser. Removed dependency on prototype.js. Server code changes to improve performance. Massive reduction of unused JS and CSS (this process began with 0.4).
- 2007-08-06: Released 0.4. All DOM elements are prefixed with cc_js_. The widget works in Opera and Safari and works with degraded functionality in Konqueror.
- 2007-08-01: Released 0.3. This release introduces Internet Explorer compatibility, Apache Content Negotiation to handle user language selection even if the server doesn't provide it for us, a hopefully-stable API for selecting a license, and license seeding.
- 2007-07-25: Released 0.2. The UI now doesn't ask or contain spurious questions, plus translation is halfway there.
- 2007-07-19: Released 0.1. Don't try to use this in production, but DO let us know how it fits into your systems and what you would want us to change.
- NOTE that whatever license version you provide, we always upgrade it to the most recent version the jurisdiction offers. We do display a Message underneath the license icon saying we did this.
Forcing a particular jurisdiction
To force the user to choose a license in a particular jurisdiction:
- First, use the "seeding" feature to seed the Attribution ("by") license in your jurisdiction
- Then, in your custom style, set the cc_js_jurisdiction_box to have "display: none;"
- You can append ?locale=XX to your call to complete.js to choose a language. The example distributed as index.html in the distribution package sets the language to US English this way.
- If omitted, Apache Content Negotiation will select the most appropriate language based on the user's preferences, defaulting to US English.
All of these result extraction systems are demonstrated in the examples.
- There are two hidden form fields called cc_js_license_uri and cc_js_license_name that respectively store the URI and name of the license selected by the user. Just do
document.getElementById("cc_js_result_uri").value(or "cc_js_result_name" instead) and you'll have the license information.
- There is an extra hidden form field containing the link to the image used. Simply get the element whose ID is cc_js_result_img and you will have a URL that is a permanent image. Hotlinking these images is allowed and encouraged.
- You can use the example style provided in the example application to get you going. We urge you to put this file on your own web server and not rely on the copy hosted on labs.creativecommons.org.
- What we really want you to do is to change the style of our divs and spans and so-forth to make them fit in to your application. To do that, you should copy the example style file into one of your own CSS files and modify it until you really like it.
- All JsWidget HTML elements that have IDs or classes start with "cc_js_" to avoid namespace collisions.
The following list of general goals to remind us what we want out of JsWidget. You can expect most of it for 1.0.
See JsWidget/Plan to see what features are planned for what versions.
- Generate HTML suitable for use in a form which presents the basic license selector
- Provide compatibility with all A-grade browsers
- Provide up to date license information by
- Support new, expanded metadata including attributionName, attributionUrl and morePermissions.
Zero point something (like 0.4)
There are no guarantees, but we'd like to keep to the same promises as a 1.0 release
Something point zero (like 1.0)
We guarantee (outside of really urgent situation where we exercise a judgement call) that these will not change:
- The programmatic interface for the widget will not change
- The user interface for selecting licenses will not change
The following are the only things that 'may change:
- As new translations become available, the text may become increasingly internationalized
- As jurisdictions offer new licenses, the engine will update the choices available to a user