YUI.add("hermes-template-following-dropdown",function(e,n){var t=e.Template.Handlebars.revive({1:function(e,n,t,l,a){return'\t\t\t
").map(function(e){return e.replace(/(/g,"")}).filter(function(e){return""!==e.trim()}).join("").replace(/^(\n)+(.*)/g,"$2")},doneEditingAttr:function(t){var D,i,o=this.get("container"),u=this,s=this.get("photo"),l=o.one(".photo-title"),n=o.one(".photo-desc"),a=o.one(".edit-photo-title"),d=o.one(".edit-photo-desc"),r=a.get("value"),h=d.get("value"),F=s.getValue("title"),c=s.getValue("description");e.fire("phototitledesc:editdone",{id:s.getValue("id")}),o.removeClass("editing"),e.one("body").one(".editing-shim")&&e.one("body").all(".editing-shim").remove(),o.one(".done-editing-title-desc").setStyle("display","none"),l.set("text",r),n.set("text",h),l.set("contenteditable",null),n.set("contenteditable",null),l.addClass("disabled"),n.addClass("disabled"),i=(i=h.toString()).replace(/(#[^#\s]+)/gi,function(e,t,D,o){return D>0&&"&"===i.slice(D-1,D)?"":e}),D=(i.match(/(#[^#\s]+)/gi)||[]).map(function(e){return e.slice(1)}),s.setValue("title",r),s.setValue("description",h),D.length>0&&this.appContext.getModelRegistry("photo-tags-models").then(function(t){var i=[];return D.length>0&&i.push(t.remoteCreate({photoId:[u.photoId],tags:D.join(",")})),e.Promise.all(i)}).then(function(t){t[0].length>0&&e.fire("flickr:photo-page--new-tags-added",t[0])},function(e){}),""===r||"
"===r.toUpperCase()?(l.setHTML(this.intlMessage({intlName:"photo-page-scrappy.ADD_TITLE"})),l.addClass("placeholder-text")):l.removeClass("placeholder-text"),""===h||"
"===h.toUpperCase()?(n.setHTML(this.intlMessage({intlName:"photo-page-scrappy.ADD_DESCRIPTION"})),n.addClass("placeholder-text")):n.removeClass("placeholder-text"),l.removeClass("show-editable"),a.removeClass("show-editable"),n.removeClass("show-editable"),d.removeClass("show-editable"),u.fixEmoji(),s.remoteUpdate().then(function(){var t=s.getValue("title"),D=s.getValue("description");l.set("contenteditable","true"),n.set("contenteditable","true"),l.removeClass("disabled"),n.removeClass("disabled"),""===t?(l.setHTML(u.intlMessage({intlName:"photo-page-scrappy.ADD_TITLE"})),l.addClass("placeholder-text")):(l.set("text",t),l.setHTML(u.addLinkToHash(l.get("text").replace(//g,">")))),""===D?(n.setHTML(u.intlMessage({intlName:"photo-page-scrappy.ADD_DESCRIPTION"})),n.addClass("placeholder-text")):n.setHTML(e.Handlebars.helpers.photoDescription(D,!1,u.isFlickrOnFlickr).toString()),u.fixEmoji()},function(t){s.setValue("title",F),s.setValue("description",c);new e.Views.FluidModal({appContext:u.appContext,title:u.intlMessage({intlName:"common.ERROR"}),message:u.intlMessage({intlName:"photo-page-scrappy.TITLE_DESCRIPTION_FAILURE"}),actionButtonLabel:u.intlMessage({intlName:"common.OK"}),classList:"scrappy-dialog",showCancelButton:!1,showActionButton:!1,dismissOnOverlayClick:!0,showFooter:!1}).show(),l.set("contenteditable","true"),n.set("contenteditable","true"),l.removeClass("disabled"),n.removeClass("disabled"),""===s.getValue("title")?(l.setHTML(this.intlMessage({intlName:"photo-page-scrappy.ADD_TITLE"})),l.addClass("placeholder-text")):(l.set("text",s.getValue("title")),l.setHTML(u.addLinkToHash(l.get("text").replace(//g,">"))),u.fixEmoji()),""===s.getValue("description")?(n.setHTML(this.intlMessage({intlName:"photo-page-scrappy.ADD_DESCRIPTION"})),n.addClass("placeholder-text")):n.setHTML(e.Handlebars.helpers.photoDescription(s.getValue("description")).toString()),u.toggleTitleDesc({show:!1,noEffect:!0})})},startEditingAttr:function(t,D){var i,o,u,s,l=this,n=this.get("container"),a=this.get("photo"),d=a.getValue("title"),r=a.getValue("description"),h=n.one(".photo-title"),F=n.one(".photo-desc"),c=n.one(".edit-photo-title"),p=n.one(".edit-photo-desc"),E=n.one(".false-edit-photo-title"),g=n.one(".false-edit-photo-desc");e.fire("phototitledesc:edit",{id:a.getValue("id")}),h.hasClass("disabled")||F.hasClass("disabled")||(n.addClass("editing"),this.isPhotostreamEdit||e.one("body").append(this.templates("editing-shim")()),e.one("body").one(".editing-shim")&&(this.registerEventHandler(e.one("body").one(".editing-shim").on("click",function(){l.doneEditingAttr()},this)),this.registerEventHandler(e.one("body").one(".editing-shim").on("focus",function(){l.doneEditingAttr()},this))),i=d,o=r,h.hasClass("placeholder-text")&&(i="",c.set("placeholder",this.intlMessage({intlName:"photo-page-scrappy.ADD_TITLE"}))),F.hasClass("placeholder-text")?(o="",p.set("placeholder",this.intlMessage({intlName:"photo-page-scrappy.ADD_DESCRIPTION"})),p.set("value",this.unwrapDescription(o)),g.set("value",this.unwrapDescription(o))):(u=o.replace(/"/g,'"').replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<"),p.set("value",this.unwrapDescription(u)),g.set("value",this.unwrapDescription(u))),c.set("value",this.unwrapDescription(i)),E.set("value",this.unwrapDescription(i)),c.addClass("show-editable"),h.addClass("show-editable"),this.fixEmoji(),this.isPhotostreamEdit||(g._node.scrollHeight>420?p.setStyle("height","420px"):p.setStyle("height",g._node.scrollHeight+"px")),p.setStyle("minHeight","80px"),p.addClass("show-editable"),F.addClass("show-editable"),(s=D.target.ancestor(".photo-desc",!0)?p:c).focus(),s.getDOMNode().setSelectionRange(0,s.getDOMNode().value.length),this.toggleTitleDesc({showButton:!1,show:!0,noEffect:!0}))},editButtonClickHandler:function(e){if(e.target.hasClass("title-desc-edit")||"a"!==e.target.get("tagName").toLowerCase()){e.preventDefault();var t=this.get("container"),D=t.one(".edit-photo-title"),i=t.one(".photo-title"),o=t.one(".photo-desc");if(i.hasClass("disabled")||o.hasClass("disabled"))return;t.hasClass("editing")||(this.startEditingAttr(D,e),t.one(".done-editing-title-desc").setStyle("display","block"))}},toggleTitleDesc:function(e){var t,D=this.get("container");this.full=e.show||!this.full,this.full?(e.noEffect||this.fire("flickr:expand-sidebar"),D.one(".title-desc-block").addClass("showFull")):(D.one(".title-desc-block").removeClass("showFull"),e.noEffect||this.fire("flickr:collapse-sidebar")),D.one(".title-desc-more-button")&&(this.toggleTitleDescTruncationButton(),t=void 0!==e.showButton?e.showButton:this.titleDescHasOverflow(),this.showMoreButton(t))},toggleTitleDescTruncationButton:function(){var e=this.get("container");this.full?e.one(".title-desc-more-button").setHTML("less"):e.one(".title-desc-more-button").setHTML("more")},showMoreButton:function(e){var t=this.get("container").one(".title-desc-more-button");e?t.addClass("title-desc-has-overflow"):t.removeClass("title-desc-has-overflow")},titleDescHasOverflow:function(){var e,t=this.get("container").one(".title-desc-block"),D=t.getDOMNode();return e=t&&t.getComputedStyle?parseInt((t.getComputedStyle("maxHeight")||""+D.clientHeight).replace("px",""),10):D.clientHeight,D.clientHeighte},activate:function(){var e=this.get("container"),t=this.get("photo"),D=e.one(".title-desc-more-button"),i=this,o=t.getValue("title"),u=t.getValue("description"),s={title:!1,desc:!1};if(this.isPhotostreamEdit=this.get("container").hasClass("photostream-edit"),this.isMobile){var l=e.all(".hide-editable");l&&l.removeClass("hide-editable")}return""!==o.trim()&&"
"!==o.toUpperCase()||(s.title=!0),""===u.trim()&&(s.desc=!0),s.title&&s.desc&&!t.getValue("isOwner")&&e.setStyle("marginTop","0"),e&&(e.one(".photo-title")&&e.one(".photo-title").setHTML(this.addLinkToHash(e.one(".photo-title").getHTML())),this.fixEmoji(),D&&i.showMoreButton(i.titleDescHasOverflow())),D&&i.registerEventHandler(D.on("click",i.showFull,i)),t&&t.getValue("isOwner")&&[{field:".photo-title",editField:".edit-photo-title",editFalseField:".false-edit-photo-title"},{field:".photo-desc",editField:".edit-photo-desc",editFalseField:".false-edit-photo-desc"}].forEach(function(t){".photo-tags"!==t.field&&(s.desc&&s.title&&!i.isPhotostreamEdit&&(e.addClass("editing"),e.one(".photo-title").addClass("show-editable"),e.one(".edit-photo-title").addClass("show-editable"),e.one(".edit-photo-title").setHTML("add title"),e.one(".edit-photo-title").addClass("placeholder-text"),e.one(".edit-photo-title").set("placeholder",i.intlMessage({intlName:"photo-page-scrappy.ADD_TITLE"})),e.one(".photo-desc").addClass("show-editable"),e.one(".edit-photo-desc").addClass("show-editable"),e.one(".edit-photo-desc").addClass("placeholder-text"),e.one(".edit-photo-desc").set("placeholder",i.intlMessage({intlName:"photo-page-scrappy.ADD_DESCRIPTION"})),e.one(".done-editing-title-desc").setStyle("display","none")),i.registerEventHandler(e.one(".title-desc-edit").on("click",i.editButtonClickHandler,i)),i.registerEventHandler(e.on("click",function(e){i.editButtonClickHandler(e)},i)),i.registerEventHandler(e.on("key",function(e){e.target.hasClass("title-desc-block")&&i.editButtonClickHandler.call(i,e)},"down:13")),i.registerEventHandler(e.one(t.editField).on("focus",function(t){e.one(".done-editing-title-desc").setStyle("display","block")})),i.registerEventHandler(e.one(t.editField).on("valuechange",function(D){i.fixEmoji(),e.one(t.editFalseField).set("value",e.one(t.editField).get("value")),".edit-photo-title"===t.editField||i.isPhotostreamEdit||(e.one(t.editFalseField)._node.scrollHeight>420?e.one(t.editField).setStyle("height","420px"):e.one(t.editField).setStyle("height",e.one(t.editFalseField)._node.scrollHeight+"px"))})),i.registerEventHandler(e.one(".done-editing-title-desc").on("click",function(e){e.preventDefault(),i.doneEditingAttr()},i)),i.registerEventHandler(e.one(".done-editing-title-desc").on("key",function(e){e.preventDefault(),i.doneEditingAttr()},"down:13",i)),i.registerEventHandler(e.one(t.editField).on("keydown",function(D){(13===D.charCode||13===D.keyCode)&&(D.ctrlKey||D.metaKey)||".edit-photo-title"===t.editField&&(13===D.charCode||13===D.keyCode)?(D.preventDefault(),i.doneEditingAttr(),e.one(t.editField).blur()):(e.one(t.editFalseField).set("value",e.one(t.editField).get("value")),".edit-photo-title"===t.editField||i.isPhotostreamEdit||(e.one(t.editFalseField)._node.scrollHeight>420?e.one(t.editField).setStyle("height","420px"):e.one(t.editField).setStyle("height",e.one(t.editFalseField)._node.scrollHeight+"px")))})))}),this}})},"@VERSION@",{requires:["flickr-view","hermes-template-sub-photo-title-desc","hermes-template-editing-shim","array-extras","handlebars-helpers"],optional:["photo-models","photo-tags-models","photo-stats-models"],langBundles:["common","photo-page-scrappy"]});YUI.add("hermes-template-photo-license",function(n,e){var l=n.Template.Handlebars.revive({1:function(n,e,l,a,i){var s,t=null!=e?e:{};return(null!=(s=l.if.call(t,null!=e?e.licenseIsCreativeCommons:e,{name:"if",hash:{},fn:n.program(2,i,0),inverse:n.program(4,i,0),data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisGovt:e,{name:"if",hash:{},fn:n.program(9,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisNoLic:e,{name:"if",hash:{},fn:n.program(11,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisCopy:e,{name:"if",hash:{},fn:n.program(13,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseIsPDW:e,{name:"if",hash:{},fn:n.program(15,i,0),inverse:n.noop,data:i}))?s:"")+' \n \n
\n
\n'+(null!=(s=(l.eachConfigVal||e&&e.eachConfigVal||l.helperMissing).call(t,"licenseSelect",{name:"eachConfigVal",hash:{},fn:n.program(17,i,0),inverse:n.noop,data:i}))?s:"")+"
\n
\n"},2:function(n,e,l,a,i){var s,t=null!=e?e:{},r=l.helperMissing,c=n.escapeExpression;return' \n \n'},4:function(n,e,l,a,i){var s;return null!=(s=l.if.call(null!=e?e:{},null!=e?e.licenseisNoLic:e,{name:"if",hash:{},fn:n.program(5,i,0),inverse:n.program(7,i,0),data:i}))?s:""},5:function(n,e,l,a,i){return' \n'},7:function(n,e,l,a,i){return' \n'},9:function(n,e,l,a,i){return' \n'},11:function(n,e,l,a,i){return' \n'},13:function(n,e,l,a,i){return' \n'},15:function(n,e,l,a,i){return' \n'},17:function(n,e,l,a,i){var s,t=null!=e?e:{},r=l.helperMissing,c=n.escapeExpression;return' '+c((l.intlMessage||e&&e.intlMessage||r).call(t,{name:"intlMessage",hash:{intlName:null!=e?e.key:e},data:i}))+"\n"},19:function(n,e,l,a,i){var s,t=null!=e?e:{};return'\t\t\n'+(null!=(s=l.if.call(t,null!=e?e.licenseIsCreativeCommons:e,{name:"if",hash:{},fn:n.program(20,i,0),inverse:n.program(22,i,0),data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisGovt:e,{name:"if",hash:{},fn:n.program(27,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisNoLic:e,{name:"if",hash:{},fn:n.program(29,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseisCopy:e,{name:"if",hash:{},fn:n.program(31,i,0),inverse:n.noop,data:i}))?s:"")+(null!=(s=l.if.call(t,null!=e?e.licenseIsCreativeCommons:e,{name:"if",hash:{},fn:n.program(33,i,0),inverse:n.program(38,i,0),data:i}))?s:"")+"\t\t\n"},20:function(n,e,l,a,i){var s;return'\t\t\t\t\n'},22:function(n,e,l,a,i){var s;return null!=(s=l.if.call(null!=e?e:{},null!=e?e.licenseisNoLic:e,{name:"if",hash:{},fn:n.program(23,i,0),inverse:n.program(25,i,0),data:i}))?s:""},23:function(n,e,l,a,i){return'\t\t\t\t \n'},25:function(n,e,l,a,i){var s;return' \n'},27:function(n,e,l,a,i){return'\t\t\t\t\n'},29:function(n,e,l,a,i){return'\t\t\t\t\n'},31:function(n,e,l,a,i){return'\t\t\t\t\n'},33:function(n,e,l,a,i){var s;return null!=(s=l.if.call(null!=e?e:{},null!=e?e.licenseIsCC0:e,{name:"if",hash:{},fn:n.program(34,i,0),inverse:n.program(36,i,0),data:i}))?s:""},34:function(n,e,l,a,i){return"\t\t\t\t "+n.escapeExpression((l.intlMessage||e&&e.intlMessage||l.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.PUBLIC_DOMAIN"},data:i}))+"\n"},36:function(n,e,l,a,i){return" "+n.escapeExpression((l.intlMessage||e&&e.intlMessage||l.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.SOME_RIGHTS_RESERVED"},data:i}))+"\n"},38:function(n,e,l,a,i){var s;return null!=(s=l.if.call(null!=e?e:{},null!=e?e.licenseIsPDW:e,{name:"if",hash:{},fn:n.program(39,i,0),inverse:n.program(41,i,0),data:i}))?s:""},39:function(n,e,l,a,i){return" "+n.escapeExpression((l.intlMessage||e&&e.intlMessage||l.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:"photo-page-scrappy.PUBLIC_DOMAIN"},data:i}))+"\n"},41:function(n,e,l,a,i){var s;return" \t\t\t\t\n"+(null!=(s=(l.licenseString||e&&e.licenseString||l.helperMissing).call(null!=e?e:{},null!=e?e.license:e,{name:"licenseString",hash:{},fn:n.program(42,i,0),inverse:n.noop,data:i}))?s:"")+" \t\t\t\t\n"},42:function(n,e,l,a,i){return" \t\t\t\t\t\t"+n.escapeExpression((l.intlMessage||e&&e.intlMessage||l.helperMissing).call(null!=e?e:{},{name:"intlMessage",hash:{intlName:null!=e?e.key:e},data:i}))+"\n"},compiler:[7,">= 4.0.0"],main:function(n,e,l,a,i){var s;return' \n'+(null!=(s=l.if.call(null!=e?e:{},null!=e?e.licenseIsEditable:e,{name:"if",hash:{},fn:n.program(1,i,0),inverse:n.program(19,i,0),data:i}))?s:"")+"
"},useData:!0}),a={};n.Array.each([],function(e){var l=n.Template.get("hermes/"+e);l&&(a[e]=l)}),n.Template.register("hermes/photo-license",function(e,i){return i=i||{},i.partials=i.partials?n.merge(a,i.partials):a,l(e,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});