script CartoonEditor input NameEditor input CartoonId input CartoonSource input CartoonTitleEN textarea CartoonCaptionEN textarea CartoonTextEN input CartoonTitleFR textarea CartoonCaptionFR textarea CartoonTextFR input CartoonTitleIT textarea CartoonCaptionIT textarea CartoonTextIT input CartoonSold input CartoonVisible span Status button Open button Save variable Name variable CurrentName variable Content variable Current variable Item variable Sold variable Visible variable Password variable Valid ! The media browser div Overlay div Scroller div Media div FileListing div FileRow button CloseButton img Image a FileName variable Alpha variable Separator variable FileList variable FileCount variable File variable Type variable N get Password from storage as `password` rest get Valid from `_verify/` cat Password or alert `Unable to verify password - please try again.` if Valid is not `yes` location `https://fr.rembrandt.ie` attach Open to `ec-open` attach Save to `ec-save` attach Status to `ec-status` attach CartoonId to `ec-cartoon-id` attach CartoonSource to `ec-cartoon-src` attach CartoonTitleEN to `ec-cartoon-title-en` attach CartoonCaptionEN to `ec-cartoon-caption-en` attach CartoonTextEN to `ec-cartoon-text-en` attach CartoonTitleFR to `ec-cartoon-title-fr` attach CartoonCaptionFR to `ec-cartoon-caption-fr` attach CartoonTextFR to `ec-cartoon-text-fr` attach CartoonTitleIT to `ec-cartoon-title-it` attach CartoonCaptionIT to `ec-cartoon-caption-it` attach CartoonTextIT to `ec-cartoon-text-it` attach CartoonSold to `ec-cartoon-sold` attach CartoonVisible to `ec-cartoon-visible` attach NameEditor to `ec-name` gosub to GetContent put Content into Current on click Save begin put the content of NameEditor into Name if Name is empty begin set the content of Status to `No script name has been given` go to ResetStatus end gosub to GetContent if Content is not Current begin rest post encode Content to `rem_cartoons/set/name/` cat Name put Content into Current set the content of Status to `Cartoon '` cat Name cat `' saved` go to ResetStatus end else begin set the content of Status to `Nothing has changed` go to ResetStatus end end on click Open go to DoOpen stop DoOpen: gosub to GetContent if Content is not Current begin if confirm `Content has changed. Do you want to save it?` begin rest post encode Content to `rem_cartoons/set/name/` cat CurrentName end end attach Overlay to `ec-overlay` set style `display` of Overlay to `block` ! Animate the background put 0 into Alpha while Alpha is less than 8 begin set style `background-color` of Overlay to `rgba(0,0,0,0.` cat Alpha cat `)` wait 4 ticks add 1 to Alpha end wait 50 ticks ! Make the browser panel visible attach Media to `ec-media` set style `display` of Media to `inline-block` attach FileListing to `ec-file-listing` set style `display` of FileListing to `inline-block` ! Fill the browser with content from the server rest get Content from `rem_cartoons/names/0/1000` put empty into FileList put the json count of Content into FileCount set the elements of File to FileCount set the elements of FileName to FileCount ! Add a row for each file put 0 into N while N is less than FileCount begin index File to N index FileName to N attach FileRow to `ec-file-row` put the content of FileRow into File replace `INDEX` with N in File if N is even replace `ODDEVEN` with `ec-even` in File else replace `ODDEVEN` with `ec-odd` in File put FileList cat File into FileList add 1 to N end attach Scroller to `ec-scroller` set the content of Scroller to FileList ! Add the document names put 0 into N while N is less than FileCount begin index File to N index FileName to N put element N of Content into File attach FileRow to `ec-file-row-` cat N attach FileName to `ec-file-name-` cat N set the content of FileName to File if N is even set style `background` of FileRow to `lightgray` on click FileName go to SelectFile add 1 to N end attach CloseButton to `ec-close-media-button` on click CloseButton go to CloseBrowser stop SelectFile: index File to the index of FileName set the content of NameEditor to File rest get Content from `rem_cartoons/name/` cat File decode Content set the content of Status to `Cartoon '` cat File cat `' loaded` fork to ResetStatus put property `id` of Content into Item set the content of CartoonId to Item put property `src` of Content into Item set the content of CartoonSource to Item put property `title-en` of Content into Item set the content of CartoonTitleEN to Item put property `caption-en` of Content into Item set the content of CartoonCaptionEN to Item put property `text-en` of Content into Item set the content of CartoonTextEN to Item put property `title-fr` of Content into Item set the content of CartoonTitleFR to Item put property `caption-fr` of Content into Item set the content of CartoonCaptionFR to Item put property `text-fr` of Content into Item set the content of CartoonTextFR to Item put property `title-it` of Content into Item set the content of CartoonTitleIT to Item put property `caption-it` of Content into Item set the content of CartoonCaptionIT to Item put property `text-it` of Content into Item set the content of CartoonTextIT to Item put property `sold` of Content into Item if Item is `undefined` put `false` into Item if Item is `true` set Sold else clear Sold if Sold set attribute `checked` of CartoonSold else remove attribute `checked` of CartoonSold put property `visible` of Content into Item if Item is `undefined` put `false` into Item if Item is `true` set Visible else clear Visible if Visible set attribute `checked` of CartoonVisible else remove attribute `checked` of CartoonVisible attach Image to `ec-image` set attribute `src` of Image to `https://fr.rembrandt.ie/easycoder/full/` cat the content of CartoonSource cat `.jpg` gosub to GetContent put Content into Current CloseBrowser: set style `background-color` of Overlay to `rgba(0,0,0,0.0)` set style `display` of Overlay to `none` set style `display` of Media to `none` stop GetContent: put `{}` into Content put the content of CartoonId into Item set property `id` of Content to the value of Item set property `src` of Content to the content of CartoonSource set property `title-en` of Content to the content of CartoonTitleEN set property `caption-en` of Content to the content of CartoonCaptionEN set property `text-en` of Content to the content of CartoonTextEN set property `title-fr` of Content to the content of CartoonTitleFR set property `caption-fr` of Content to the content of CartoonCaptionFR set property `text-fr` of Content to the content of CartoonTextFR set property `title-it` of Content to the content of CartoonTitleIT set property `caption-it` of Content to the content of CartoonCaptionIT set property `text-it` of Content to the content of CartoonTextIT if attribute `checked` of CartoonSold set property `sold` of Content to `true` else set property `sold` of Content to `false` if attribute `checked` of CartoonVisible set property `visible` of Content to `true` else set property `visible` of Content to `false` return ResetStatus: wait 2 set the content of Status to `` stop