From 1a9eacb14bedf3d21fb2d94ff82ec6b0821372e0 Mon Sep 17 00:00:00 2001 From: Anna Sobiepanek Date: Mon, 10 Jan 2011 13:21:52 -0500 Subject: [PATCH] fixed licenseType dependecy and naming [#250 state:peer-review-requested] --- plugins/attribution/popcorn.attribution.js | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/plugins/attribution/popcorn.attribution.js b/plugins/attribution/popcorn.attribution.js index dfc091d..30c7efd 100644 --- a/plugins/attribution/popcorn.attribution.js +++ b/plugins/attribution/popcorn.attribution.js @@ -6,7 +6,7 @@ * Attribution popcorn plug-in * Adds text to an element on the page. * Options parameter will need a mandatory start, end, target. - * Optional parameters include NameOfWork, NameOfWorkUrl, CopyrightHolder, CopyrightHolderUrl, licenseType & licenseUrl. + * Optional parameters include NameOfWork, NameOfWorkUrl, CopyrightHolder, CopyrightHolderUrl, license & licenseUrl. * Start is the time that you want this plug-in to execute * End is the time that you want this plug-in to stop executing * Target is the id of the document element that the text needs to be attached to, this target element must exist on the DOM @@ -14,7 +14,7 @@ * NameOfWorkUrl is a url that provides more details about the attribution * CopyrightHolder is the name of the person/institution that holds the rights to the attribution * CopyrightHolderUrl is the url that provides more details about the copyrightholder - * LicenseType is the type of license that the work is copyrighted under + * license is the type of license that the work is copyrighted under * LicenseUrl is the url that provides more details about the ticense type * @param {Object} options * @@ -45,15 +45,15 @@ website: "annasob.wordpress.com" }, options:{ - start : {elem:'input', type:'text', label:'In'}, - end : {elem:'input', type:'text', label:'Out'}, - nameOfWork : {elem:'input', type:'text', label:'Name of Work'}, - nameOfWorkUrl : {elem:'input', type:'text', label:'Url of Work'}, - copyrightHolder : {elem:'input', type:'text', label:'Copyright Holder'}, - copyrightHolderUrl : {elem:'input', type:'text', label:'Copyright Holder Url'}, - licenseType : {elem:'input', type:'text', label:'License type'}, - licenseType : {elem:'input', type:'text', label:'License type'}, - target : 'attribution-container' + start : {elem:'input', type:'text', label:'In'}, + end : {elem:'input', type:'text', label:'Out'}, + nameOfWork : {elem:'input', type:'text', label:'Name of Work'}, + nameOfWorkUrl : {elem:'input', type:'text', label:'Url of Work'}, + copyrightHolder : {elem:'input', type:'text', label:'Copyright Holder'}, + copyrightHolderUrl : {elem:'input', type:'text', label:'Copyright Holder Url'}, + license : {elem:'input', type:'text', label:'License type'}, + licenseUrl : {elem:'input', type:'text', label:'License URL'}, + target : 'attribution-container' } }, _setup: function(options) { @@ -80,19 +80,23 @@ if (options.copyrightHolderUrl) { attrib += ""; } - if (licenses[options.licenseType.toLowerCase()]) { - if (options.licenseUrl) { - attrib = "" + attrib; + if (options.license) { + if (licenses[options.license.toLowerCase()]) { + if (options.licenseUrl) { + attrib = " " + attrib; + } else { + attrib = "" + attrib; + } } else { - attrib = "" + attrib; - } - } else { - if (options.licenseUrl) { - attrib += ", license: " + options.licenseType + ""; - } else { - attrib += ", license: " + options.licenseType; - } - } + if (options.licenseUrl) { + attrib += ", license: " + options.license + " "; + } else { + attrib += ", license: " + options.license; + } + } + } else if (options.licenseUrl) { + attrib += ", license "; + } options._container.innerHTML = attrib; options.target = document.getElementById( options.target ); if (options.target) { -- 2.43.0