(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(* ::Input::Initialization:: *)
Print["Album/Slide show..."]


(* ::Input::Initialization:: *)
dirs=Complement[Select[FileNames["*"], FileType[#]===Directory&], {"previews", "nb", "thumbs"}]


(* ::Input::Initialization:: *)
ExcludedImages={"2020.12.05_Brantford_to_Port_Dover_Loop/Hate.jpg"};


(* ::Input::Initialization:: *)
Short[images=Complement[
StringReplace["\\"->"/"]/@Union[
FileNames["*.jpg"|"*.png",dirs],
FileNames["*.gif",StringJoin[#,"/thumbs"]&/@dirs]
],
ExcludedImages
],
5]


(* ::Input::Initialization:: *)
Short[listing="listing = [\n"<>StringJoin@@Riffle[StringJoin["  \"",#,"\""]& /@ images, ",\n"]<>"\n];",5]


(* ::Input::Initialization:: *)
SlideShowDiv=StringJoin["<table border=0 cellpadding=0 cellspacing=0 width=100%><tr>
  <td align=left><#Navigation#><span id=\"caption_span\"><a href=\"2020.01-02 Groningen/index.html\">2020.01-02 Groningen</a></span></td>
  <td align=right>
    <a href=\"javascript: order();\">&#x1f501;&#xfe0e;</a>
    <a href=\"javascript: shuffle();\">&#x1f500;&#xfe0e;</a>
    &nbsp;
    <a href=\"javascript: prev();\">&#x23Ea;&#xfe0e;</a>
    <a href=\"javascript: toggle();\">&#x23EF;&#xfe0e;</a>
    <a href=\"javascript: next();\">&#x23E9;&#xfe0e;</a>
  </td>
</tr></table>
<a href=\"javascript: toggle();\">
  <img name=sample src=\"2020.01-02 Groningen/groningerforum_Green+screen+foto_2020_01_16-1.png\" style=\"width:100%; height:100%; object-fit:contain;\">
</a>
<script>
",
listing,
"
  var olisting=listing.slice();
  var len=listing.length;
  var caption_span = document.getElementById(\"caption_span\");
  var j,kk,t;
  var playing=true;
  kk = Math.floor(len*Math.random());
  function load() {
    if (kk>=len) {kk=0;}
    if (kk<0) {kk=len-1;}
    document.images[\"sample\"].src = listing[kk];
    j = listing[kk].search(\"/\");
    t = listing[kk].slice(0,j);
    caption_span.innerHTML = ((\"0000\"+(1+kk)).slice(-4))+\"/\"+len+\" @ <a href=\\\"\"+t+\"/index.html\\\">\"+t+\"</a>\";
  }

  function tick() {
    if (playing) {++kk; load();}
    setTimeout('tick()', 5000);
  }

  function shuffle() {
    for (kk=2; kk<=len; ++kk) {
      j = Math.floor(kk*Math.random());
      t = listing[kk-1]; listing[kk-1]=listing[j]; listing[j]=t;
    }
    kk=len-1;
  }

  function order() {
    listing=olisting.slice();
    kk = Math.floor(len*Math.random());
  }

  function prev() {--kk; playing=false; load();}
  function toggle() {playing=!playing;}
  function pause() {playing=false;}
  function play() {playing=true;}
  function next() {++kk; playing=false; load();}
  tick();
</script>
"
];


(* ::Input::Initialization:: *)
htmlfile=OpenWrite["SlideShow.html"];
WriteString[htmlfile,
StringReplace[
StringReplace[Import["SlideShow.html.txt"], "<#SlideShowDiv#>"->SlideShowDiv],
"<#Navigation#>"->"<a href=\"http://www.math.toronto.edu/~drorbn/Copyleft/index.html\" title=\"My Copyleft Policy\">(&#8580;)</a> |
  <a href=\"http://www.math.toronto.edu/~drorbn/\">Dror Bar-Natan</a>:
    <a href=\"index.html\">Album</a>: "
]
];
Close[htmlfile]


(* ::Input::Initialization:: *)
Print["Album/SlideShow2.html..."]


(* ::Input::Initialization:: *)
htmlfile=OpenWrite["SlideShow2.html"];
WriteString[htmlfile,
StringReplace[Import["SlideShow2.html.txt"], "<#Listing#>"->StringJoin[
StringReplace["<a href=\"<#img#>\" data-caption=\"<#img#>\"> </a>\n", "<#img#>"->#]& /@ images
]]
];
Close[htmlfile]


(* ::Input::Initialization:: *)
{
"TitleNotes" -> StringJoin[
"<div style=\"clear: right; float: right; padding: 10px; width: 60%;\">",
       StringReplace[SlideShowDiv, "<#Navigation#>"->""],
"</div>\[IndentingNewLine]My travel photo album, since 2020 (<a href=SlideShow.html>slide show</a>, <a href=SlideShow2.html>2</a>).\n<p>"
],
"DirectoryListingSorter"->Reverse,
"DirectoryListingSeparator"->"<br/>",
"ExcludeDirectories" -> {"Admin"}
}
