<commit_before>=javascript_include_tag "openseadragon.js"

.image-container(id="image_container" style="width:100%;height:100%;border:1px solid black;color:#333;background-color: black;")

-content_for :javascript
  javascript:
    $(function() {
      viewer = OpenSeadragon({
        id: "image_container",
        prefixUrl: "",
        showRotationControl: true,
        gestureSettingsTouch: {
          pinchRotate: true
        },
        navImages: {
          zoomIn: {
            REST: "#{asset_path('osd/zoomin_rest.png')}",
            GROUP: "#{asset_path('osd/zoomin_grouphover.png')}",
            HOVER: "#{asset_path('osd/zoomin_hover.png')}",
            DOWN: "#{asset_path('osd/zoomin_pressed.png')}"
          },
          zoomOut: {
            REST: "#{asset_path('osd/zoomout_rest.png')}",
            GROUP: "#{asset_path('osd/zoomout_grouphover.png')}",
            HOVER: "#{asset_path('osd/zoomout_hover.png')}",
            DOWN: "#{asset_path('osd/zoomout_pressed.png')}"
          },
          home: {
            REST: "#{asset_path('osd/home_rest.png')}",
            GROUP: "#{asset_path('osd/home_grouphover.png')}",
            HOVER: "#{asset_path('osd/home_hover.png')}",
            DOWN: "#{asset_path('osd/home_pressed.png')}"
          },
          fullpage: {
            REST: "#{asset_path('osd/fullpage_rest.png')}",
            GROUP: "#{asset_path('osd/fullpage_grouphover.png')}",
            HOVER: "#{asset_path('osd/fullpage_hover.png')}",
            DOWN: "#{asset_path('osd/fullpage_pressed.png')}"
          },
          rotateleft: {
            REST: "#{asset_path('osd/rotateleft_rest.png')}",
            GROUP: "#{asset_path('osd/rotateleft_grouphover.png')}",
            HOVER: "#{asset_path('osd/rotateleft_hover.png')}",
            DOWN: "#{asset_path('osd/rotateleft_pressed.png')}"
          },
          rotateright: {
            REST: "#{asset_path('osd/rotateright_rest.png')}",
            GROUP: "#{asset_path('osd/rotateright_grouphover.png')}",
            HOVER: "#{asset_path('osd/rotateright_hover.png')}",
            DOWN: "#{asset_path('osd/rotateright_pressed.png')}"
          },
          previous: {
            REST: "#{asset_path('osd/previous_rest.png')}",
            GROUP: "#{asset_path('osd/previous_grouphover.png')}",
            HOVER: "#{asset_path('osd/previous_hover.png')}",
            DOWN: "#{asset_path('osd/previous_pressed.png')}"
          },
          next: {
            REST: "#{asset_path('osd/next_rest.png')}",
            GROUP: "#{asset_path('osd/next_grouphover.png')}",
            HOVER: "#{asset_path('osd/next_hover.png')}",
            DOWN: "#{asset_path('osd/next_pressed.png')}"
          }
        },
        maxZoomPixelRatio:  10,
        visibilityRatio:    1,
        fitBounds:          true,
        preserveViewport:   true,
        sequenceMode:       false, //we want fromthepage to handle pages sequentially, rather than openseadragon

        tileSources: {
          type: 'image',
          url: '#{file_to_url(@page.canonical_facsimile_url)}'
        }
      });

      $(window).on('beforeunload', function() {
        var bounds = JSON.stringify(viewer.viewport.getBounds());
        localStorage['bounds'] = bounds;
      });

      viewer.addHandler('open', function() {
        bounds = localStorage['bounds'];

        if (bounds) {
          jbounds = JSON.parse(bounds);
          var rect = new OpenSeadragon.Rect(jbounds.x, jbounds.y, jbounds.height, jbounds.width);
          viewer.viewport.fitBounds(rect, true);
        }
      });
    });<commit_msg>transcribe: call stringify when storing, not before<commit_after>=javascript_include_tag "openseadragon.js"

.image-container(id="image_container" style="width:100%;height:100%;border:1px solid black;color:#333;background-color: black;")

-content_for :javascript
  javascript:
    $(function() {
      viewer = OpenSeadragon({
        id: "image_container",
        prefixUrl: "",
        showRotationControl: true,
        gestureSettingsTouch: {
          pinchRotate: true
        },
        navImages: {
          zoomIn: {
            REST: "#{asset_path('osd/zoomin_rest.png')}",
            GROUP: "#{asset_path('osd/zoomin_grouphover.png')}",
            HOVER: "#{asset_path('osd/zoomin_hover.png')}",
            DOWN: "#{asset_path('osd/zoomin_pressed.png')}"
          },
          zoomOut: {
            REST: "#{asset_path('osd/zoomout_rest.png')}",
            GROUP: "#{asset_path('osd/zoomout_grouphover.png')}",
            HOVER: "#{asset_path('osd/zoomout_hover.png')}",
            DOWN: "#{asset_path('osd/zoomout_pressed.png')}"
          },
          home: {
            REST: "#{asset_path('osd/home_rest.png')}",
            GROUP: "#{asset_path('osd/home_grouphover.png')}",
            HOVER: "#{asset_path('osd/home_hover.png')}",
            DOWN: "#{asset_path('osd/home_pressed.png')}"
          },
          fullpage: {
            REST: "#{asset_path('osd/fullpage_rest.png')}",
            GROUP: "#{asset_path('osd/fullpage_grouphover.png')}",
            HOVER: "#{asset_path('osd/fullpage_hover.png')}",
            DOWN: "#{asset_path('osd/fullpage_pressed.png')}"
          },
          rotateleft: {
            REST: "#{asset_path('osd/rotateleft_rest.png')}",
            GROUP: "#{asset_path('osd/rotateleft_grouphover.png')}",
            HOVER: "#{asset_path('osd/rotateleft_hover.png')}",
            DOWN: "#{asset_path('osd/rotateleft_pressed.png')}"
          },
          rotateright: {
            REST: "#{asset_path('osd/rotateright_rest.png')}",
            GROUP: "#{asset_path('osd/rotateright_grouphover.png')}",
            HOVER: "#{asset_path('osd/rotateright_hover.png')}",
            DOWN: "#{asset_path('osd/rotateright_pressed.png')}"
          },
          previous: {
            REST: "#{asset_path('osd/previous_rest.png')}",
            GROUP: "#{asset_path('osd/previous_grouphover.png')}",
            HOVER: "#{asset_path('osd/previous_hover.png')}",
            DOWN: "#{asset_path('osd/previous_pressed.png')}"
          },
          next: {
            REST: "#{asset_path('osd/next_rest.png')}",
            GROUP: "#{asset_path('osd/next_grouphover.png')}",
            HOVER: "#{asset_path('osd/next_hover.png')}",
            DOWN: "#{asset_path('osd/next_pressed.png')}"
          }
        },
        maxZoomPixelRatio:  10,
        visibilityRatio:    1,
        fitBounds:          true,
        preserveViewport:   true,
        sequenceMode:       false, //we want fromthepage to handle pages sequentially, rather than openseadragon

        tileSources: {
          type: 'image',
          url: '#{file_to_url(@page.canonical_facsimile_url)}'
        }
      });

      $(window).on('beforeunload', function() {
        var bounds = viewer.viewport.getBounds();
        localStorage['bounds'] = JSON.stringify(bounds);
      });

      viewer.addHandler('open', function() {
        bounds = localStorage['bounds'];

        if (bounds) {
          jbounds = JSON.parse(bounds);
          var rect = new OpenSeadragon.Rect(jbounds.x, jbounds.y, jbounds.height, jbounds.width);
          viewer.viewport.fitBounds(rect, true);
        }
      });
    });
{'fraction_non_alphanumeric': 0.1683222958057395, 'fraction_numerical': 0.00358719646799117, 'mean_word_length': 2.30250569476082, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3815335', 'n_tokens_mistral': 2415, 'n_tokens_neox': 2379, 'n_words': 292}