// * * This is code to let Safari uses click on labels and end up with * check marks in checkboxes. */ function cc_js_call_me_on_label_selection(element) { // If we are not Safari, get out of here. // Note that even Konqueror doesn't need this fix. if (navigator.userAgent.indexOf('Safari') < 0) { return; } // Otherwise, I guess someone clicked on the label called element // and I should click an associated checkbox. var find_this_id = element.htmlFor; find_this_id = find_this_id.substring('cc_js_'.length()); // remove leading cc_js_ var check_me = cc_js_$(find_this_id); if (check_me === null) { return; // if there's nothing to check, that's odd but we're // not gonna do anything about it } check_me.focus(); if (check_me.getAttribute('type') == 'checkbox') { if (!check_me.checked) { check_me.checked = true; } else { check_me.checked = false; } } cc_js_modify(); } // ]]> // // ----8 */ {"ch":{"url":"http://creativecommons.org/worldwide/ch/","version":"2.5","name":"Switzerland"},"co":{"url":"http://creativecommons.org/worldwide/co/","version":"2.5","name":"Colombia"},"cn":{"url":"http://cn.creativecommons.org","version":"2.5","name":"China Mainland"},"cl":{"url":"http://creativecommons.cl","version":"2.0","name":"Chile"},"ca":{"url":"http://creativecommons.ca","version":"2.5","name":"Canada"},"it":{"url":"http://www.creativecommons.it","version":"2.5","name":"Italy"},"ar":{"url":"http://creativecommons.org/worldwide/ar/","version":"2.5","name":"Argentina"},"au":{"url":"http://www.creativecommons.org.au","version":"2.5","name":"Australia"},"at":{"url":"http://www.creativecommons.at","version":"2.0","name":"Austria"},"in":{"url":"http://cc-india.org","version":"2.5","name":"India"},"es":{"url":"http://es.creativecommons.org/","version":"2.5","name":"Spain"},"nl":{"url":"http://www.creativecommons.nl","version":"3.0","name":"Netherlands"},"us":{"url":"http://creativecommons.org/worldwide/us/","version":"3.0","name":"United States"},"pt":{"url":"http://pt.creativecommons.org","version":"2.5","name":"Portugal"},"mt":{"url":"http://creativecommons.org/worldwide/mt/","version":"2.5","name":"Malta"},"generic":{"url":"http://creativecommons.org","generic":true,"version":"3.0","name":"Unported","sampling":"1.0"},"tw":{"url":"http://www.creativecommons.org.tw","version":"2.5","name":"Taiwan","sampling":"1.0"},"scotland":{"url":"http://www.creativecommons.org.uk","version":"2.5","name":"UK: Scotland"},"pe":{"url":"http://pe.creativecommons.org","version":"2.5","name":"Peru"},"pl":{"url":"http://creativecommons.pl","version":"2.5","name":"Poland"},"be":{"url":"http://creativecommons.org/worldwide/be/","version":"2.0","name":"Belgium"},"fr":{"url":"http://fr.creativecommons.org","version":"2.0","name":"France"},"bg":{"url":"http://creativecommons.org/worldwide/bg/","version":"2.5","name":"Bulgaria"},"dk":{"url":"http://creativecommons.org/worldwide/dk/","version":"2.5","name":"Denmark"},"hr":{"url":"http://creativecommons.org/worldwide/hr/","version":"2.5","name":"Croatia"},"de":{"url":"http://de.creativecommons.org","version":"2.0","name":"Germany","sampling":"1.0"},"jp":{"url":"http://www.creativecommons.jp","version":"2.1","name":"Japan"},"hu":{"url":"http://creativecommons.org/worldwide/hu/","version":"2.5","name":"Hungary"},"za":{"url":"http://za.creativecommons.org","version":"2.5","name":"South Africa"},"br":{"url":"http://creativecommons.org/worldwide/br/","version":"2.5","name":"Brazil","sampling":"1.0"},"fi":{"url":"http://creativecommons.fi","version":"1.0","name":"Finland"},"mk":{"url":"http://creativecommons.org/worldwide/mk/","version":"2.5","name":"Macedonia"},"kr":{"url":"http://www.creativecommons.or.kr/","version":"2.0","name":"Korea"},"si":{"url":"http://creativecommons.si","version":"2.5","name":"Slovenia"},"uk":{"url":"http://www.creativecommons.org.uk","version":"2.0","name":"UK: England & Wales"},"my":{"url":"http://creativecommons.org/worldwide/my/","version":"2.5","name":"Malaysia"},"mx":{"url":"http://creativecommons.org.mx","version":"2.5","name":"Mexico"},"se":{"url":"http://creativecommons.org/worldwide/se/","version":"2.5","name":"Sweden"},"il":{"url":"http://creativecommons.org.il","version":"2.5","name":"Israel"}} /* --------------- FOLD HERE ---------------- */ ; /** * Insert tab A into slot B. */ // ]]> // 1) { cc_js_set_version(parts[1]); } if (parts.length > 2) { cc_js_set_jurisdiction(parts[2]); } cc_js_rest_of_modify(); if (parts[1] != cc_js_license_array['version']) { // if the versions are different, tell the user we upgraded his // license to the most recent license available for that jurisdiction var strong_warning = document.createElement('strong'); if (cc_js_license_array['jurisdiction'] != "") { // if they selected a jurisdiction: strong_warning.appendChild(document.createTextNode(cc_js_t('We have updated the version of your license to the most recent one available in your jurisdiction.'))); } else { // if they selected no jurisdiction: strong_warning.appendChild(document.createTextNode(cc_js_t('We have updated the version of your license to the most recent one available.'))); } cc_js_$('license_example').appendChild(strong_warning); } } function cc_js_set_attribs(attrs) { var attrs_ra = attrs.split("-"); for (var i = 0 ; i < attrs_ra.length; i++) { attr = attrs_ra[i]; if (attr == 'sa') { cc_js_share = true; cc_js_sa = true; } else if (attr == 'nc') { cc_js_nc = true; } else if (attr == 'nd') { cc_js_share = false; cc_js_sa = false; } } cc_js_update_checkboxes_based_on_variables(); } function cc_js_set_version(ver) { // I do set the 'version', but during sanity-checking it is // overwritten by the latest version for the jurisdiction. If // these disagree, we do alert the user. cc_js_license_array['version'] = ver; } function cc_js_set_jurisdiction(juri) { var juri_select = cc_js_$('jurisdiction'); if (juri_select) { for (var i = 0 ; i < juri_select.childNodes.length; i++) { var kid = juri_select.childNodes[i]; if (kid.value == juri) { kid.selected = 'selected'; } else { kid.selected = ''; } } } } function cc_js_build_license_url () { var license_url = cc_js_license_root_url + "/" + cc_js_license_array['code'] + "/" + cc_js_license_array['version'] + "/" ; if ( cc_js_$F('jurisdiction') && ! cc_js_license_array['generic'] ) license_url += cc_js_$F('jurisdiction') + "/" ; cc_js_license_array['url'] = license_url; } /** * Builds the nicely formatted test about the work */ function cc_js_build_license_text () { var license_text = ''; var work_title = ''; var work_by = ''; var namespaces_array = new Array(); var use_namespace_dc = false; var use_namespace_cc = false; var info_format_text = ''; // I had to put this big try block around all the // prototype.js attempts to access nonexistent form fields... // The main bit of text including or not, jurisdiction love if ( cc_js_license_array['jurisdiction'] && ! cc_js_license_array['generic'] ) { license_text = 'You have chosen a Creative Commons ' + cc_js_license_array['full_name'] + ' ' + cc_js_license_array['version'] + ' ' + ( cc_js_license_array['jurisdiction'] ? cc_js_license_array['jurisdiction'] : cc_js_license_array['jurisdiction'].toUpperCase() ) + ' License.' + ' ' + license_text; } else { license_text = 'You have chosen a Creative Commons ' + cc_js_license_array['full_name'] + ' ' + cc_js_license_array['version'] + ' License.' + ' ' + license_text; } // Lets set some namespaces if they are needed var namespace_text = ''; if ( use_namespace_cc ) { namespaces_array.push('xmlns:cc="http://creativecommons.org/ns#"'); } if ( use_namespace_dc ) { namespaces_array.push('xmlns:dc="http://purl.org/dc/elements/1.1/"'); } if ( namespaces_array.length > 0 ) { namespace_text = ''; license_text = namespace_text + license_text + ''; } // set the array container here cc_js_license_array['text'] = license_text; } function cc_js_build_license_image () { cc_js_license_array['img'] = 'http://i.creativecommons.org/l/' + cc_js_license_array['code'] + "/" + cc_js_license_array['version'] + "/" + ( cc_js_license_array['generic'] ? '' : cc_js_$F('jurisdiction') + "/" ) + '88x31.png'; } /** * Builds the jurisdictions and sets things up properly... */ function cc_js_build_jurisdictions () { // TODO: The following is not working in internet explorer on wine // THIS fixes the generic being the default selection... var current_jurisdiction = ''; if ( cc_js_$F('jurisdiction') ) current_jurisdiction = cc_js_$F('jurisdiction'); else current_jurisdiction = 'generic'; cc_js_license_array['jurisdiction'] = cc_js_jurisdictions_array[current_jurisdiction]['name']; cc_js_license_array['generic'] = cc_js_jurisdictions_array[current_jurisdiction]['generic']; cc_js_license_array['sampling'] = cc_js_jurisdictions_array[current_jurisdiction]['sampling']; // NOTE: This is all a bit hacky to get around that there are // only 2 customized jurisdictions with sampling licenses // If current jurisdiction doesn't have, then we just set // to generic sampling...cool? if ( cc_js_license_array['code'] == 'sampling' ) { if ( cc_js_jurisdictions_array[current_jurisdiction]['sampling'] ) { cc_js_license_array['version'] = cc_js_jurisdictions_array[current_jurisdiction]['sampling']; } else { cc_js_license_array['version'] = cc_js_jurisdictions_array['generic']['sampling']; cc_js_license_array['generic'] = true; } } else cc_js_license_array['version'] = cc_js_jurisdictions_array[current_jurisdiction]['version']; if ( ! cc_js_license_array['version'] ) cc_js_license_array['version'] = cc_js_default_version_number; } function cc_js_no_license_selection () { cc_js_$('license_selected').style.display = 'none'; } function cc_js_some_license_selection () { cc_js_$('license_selected').style.display = 'block'; } function cc_js_build_license_details () { cc_js_some_license_selection(); // This is purely cosmetic. if (!cc_js_share) { if (!cc_js_remix) { cc_js_no_license_selection(); return; } else { cc_js_update_hack('sampling', '1.0', 'Sampling', 'Remix'); } } else { if (!cc_js_remix) { if (cc_js_nc) { cc_js_update_hack('by-nc-nd', '2.5', 'Attribution-NonCommercial-NoDerivs', 'Share:NC:ND'); } else { cc_js_update_hack('by-nd', '2.5', 'Attribution-NoDerivs', 'Share:ND'); } } else { if (cc_js_nc) { if (cc_js_sa) { cc_js_update_hack('by-nc-sa', '2.5', 'Attribution-NonCommercial-ShareAlike', 'Remix&Share:NC:SA'); } else { cc_js_update_hack('by-nc', '2.5', 'Attribution-NonCommercial', 'Remix&Share:NC'); } } else if (cc_js_sa) { cc_js_update_hack('by-sa', '2.5', 'Attribution-ShareAlike', 'Remix&Share:SA'); } else { cc_js_update_hack('by', '2.5', 'Attribution', 'Remix&Share'); } } } } /** * This inserts html into an html element with the given insertion_id. */ function cc_js_insert_html (output, insertion_id) { cc_js_$(insertion_id).innerHTML = output; return true; } function cc_js_get_comment_code (msg) { if ( ! msg ) msg = "Creative Commonts License"; return "\n"; } /** * This builds our custom html license code using various refactored * functions for handling all the nastiness... */ function cc_js_output_license_html () { var output = cc_js_get_comment_code() + '