From a7b641652b9a05e3f4bfb5453c50aaf4ee2450ca Mon Sep 17 00:00:00 2001 From: Mek Date: Fri, 11 Aug 2023 14:21:48 -0700 Subject: [PATCH] delete unused static files for prod --- iiify/static/mirador-2.1/.gitignore | 1 - iiify/static/mirador-2.1/README.md | 2 - iiify/static/mirador-2.1/css/main.css | 15 -- iiify/static/mirador-2.1/index.html | 18 -- iiify/static/mirador-2.1/js/annotations.js | 215 --------------------- iiify/static/mirador-2.1/js/app.js | 24 --- iiify/static/mirador-2.1/js/crosslink.js | 158 --------------- 7 files changed, 433 deletions(-) delete mode 100644 iiify/static/mirador-2.1/.gitignore delete mode 100644 iiify/static/mirador-2.1/README.md delete mode 100644 iiify/static/mirador-2.1/css/main.css delete mode 100644 iiify/static/mirador-2.1/index.html delete mode 100644 iiify/static/mirador-2.1/js/annotations.js delete mode 100644 iiify/static/mirador-2.1/js/app.js delete mode 100644 iiify/static/mirador-2.1/js/crosslink.js diff --git a/iiify/static/mirador-2.1/.gitignore b/iiify/static/mirador-2.1/.gitignore deleted file mode 100644 index b38a05e..0000000 --- a/iiify/static/mirador-2.1/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mirador diff --git a/iiify/static/mirador-2.1/README.md b/iiify/static/mirador-2.1/README.md deleted file mode 100644 index 34c0266..0000000 --- a/iiify/static/mirador-2.1/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# mirador-crosslink-plugin -Crosslink.js is a Mirador Plugin which uses Web Annotations to create links between documents diff --git a/iiify/static/mirador-2.1/css/main.css b/iiify/static/mirador-2.1/css/main.css deleted file mode 100644 index d86b5c2..0000000 --- a/iiify/static/mirador-2.1/css/main.css +++ /dev/null @@ -1,15 +0,0 @@ -#viewer { - width: 100%; - height: 100%; - position: fixed; -} - -.xannotate-widget { - position: fixed; - left: 5px; - top: 5px; -} - -.mirador-container .mirador-main-menu-bar { - background-color: #465575; -} \ No newline at end of file diff --git a/iiify/static/mirador-2.1/index.html b/iiify/static/mirador-2.1/index.html deleted file mode 100644 index 7b5002b..0000000 --- a/iiify/static/mirador-2.1/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - Mirador Viewer - - - - - - - -
- - diff --git a/iiify/static/mirador-2.1/js/annotations.js b/iiify/static/mirador-2.1/js/annotations.js deleted file mode 100644 index 08e2ed5..0000000 --- a/iiify/static/mirador-2.1/js/annotations.js +++ /dev/null @@ -1,215 +0,0 @@ -/* - * All Endpoints need to have at least the following: - * annotationsList - current list of OA Annotations - * dfd - Deferred Object - * init() - * search(options, successCallback, errorCallback) - * create(oaAnnotation, successCallback, errorCallback) - * update(oaAnnotation, successCallback, errorCallback) - * deleteAnnotation(annotationID, successCallback, errorCallback) (delete is a reserved word) - * TODO: - * read() //not currently used - * - * Optional, if endpoint is not OA compliant: - * getAnnotationInOA(endpointAnnotation) - * getAnnotationInEndpoint(oaAnnotation) - */ - -var pragma_url, Annotation; -(function($){ - pragma_url = 'https://pragma.archivelab.org/annotations'; - Annotation = { - get: function(annotation_id, successCallback) { - jQuery.ajax({ - url: annotation_id, - type: 'GET', - dataType: 'json', - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - if (typeof successCallback === "function") { - successCallback(annotation); - } - } - }); - }, - update: function(oaAnnotation, successCallback, errorCallback) { - var annotation = jQuery.extend({}, oaAnnotation); - if(annotation.on.length) { - annotation.on = annotation.on[0]; - } - if (annotation.endpoint) { - delete annotation.endpoint; - } - - jQuery.ajax({ - url: pragma_url, - type: 'POST', - dataType: 'json', - headers: { }, - data: JSON.stringify(annotation), - processData: false, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - if (typeof successCallback === "function") { - successCallback(annotation) - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - } - } - - - $.PragmaEndpoint = function(options) { - - jQuery.extend(this, { - dfd: null, - annotationsList: [], //OA list for Mirador use - windowID: null, - eventEmitter: null - }, options); - - this.init(); - }; - - $.PragmaEndpoint.prototype = { - init: function() { - //whatever initialization your endpoint needs - }, - - //Search endpoint for all annotations with a given URI in options - search: function(options, successCallback, errorCallback) { - var _this = this; - - //use options.uri - jQuery.ajax({ - url: pragma_url + '?canvas_id=' + options.uri, - type: 'GET', - dataType: 'json', - headers: { }, - data: { - canvas_id: options.uri - }, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotations = data.annotations - _this.annotationsList = []; - - jQuery.each(annotations, function(index, value) { - value.annotation.on = [value.annotation.on]; - value.annotation.endpoint = _this; - if (!value.annotation['@id']) { - value.annotation['@id'] = $.genUUID(); - } - - _this.annotationsList.push(value.annotation); - }); - - //check if a function has been passed in, otherwise, treat it as a normal search - if (typeof successCallback === "function") { - successCallback(_this.annotationsList); - } else { - _this.dfd.resolve(true); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - //Delete an annotation by endpoint identifier - deleteAnnotation: function(annotationID, successCallback, errorCallback) { - var _this = this; - jQuery.ajax({ - url: pragma_url, - type: 'DELETE', - dataType: 'json', - headers: { }, - contentType: "application/json; charset=utf-8", - success: function(data) { - if (typeof successCallback === "function") { - successCallback(); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - //Update an annotation given the OA version - update: function(oaAnnotation, successCallback, errorCallback) { - var _this = this; - - Annotation.update(oaAnnotation, function(annotation) { - if (typeof successCallback === "function") { - annotation.endpoint = _this; - successCallback(_this.getAnnotationInOA(annotation)); - } - }, errorCallback); - - }, - - //takes OA Annotation, gets Endpoint Annotation, and saves - //if successful, MUST return the OA rendering of the annotation - create: function(oaAnnotation, successCallback, errorCallback) { - var _this = this; - oaAnnotation.on = oaAnnotation.on[0]; - jQuery.ajax({ - url: pragma_url, - type: 'POST', - dataType: 'json', - headers: { }, - data: JSON.stringify(oaAnnotation), - processData: false, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - annotation.endpoint = _this; - if (typeof successCallback === "function") { - successCallback(_this.getAnnotationInOA(annotation)); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - userAuthorize: function(){ - return true; - }, - - set: function(prop, value, options) { - if (options) { - this[options.parent][prop] = value; - } else { - this[prop] = value; - } - }, - - //Convert Endpoint annotation to OA - getAnnotationInOA: function(annotation) { - annotation.on = [annotation.on]; - return annotation; - }, - - // Converts OA Annotation to endpoint format - getAnnotationInEndpoint: function(oaAnnotation) { - return oaAnnotation; - } - }; -}(Mirador)); diff --git a/iiify/static/mirador-2.1/js/app.js b/iiify/static/mirador-2.1/js/app.js deleted file mode 100644 index 349504a..0000000 --- a/iiify/static/mirador-2.1/js/app.js +++ /dev/null @@ -1,24 +0,0 @@ -var mirador; -$(document).ready(function() { - mirador = Mirador({ - "id": "viewer", - "layout": "1x1", - "data": [{ - "manifestUri": "https://iiif.archivelab.org/iiif/TheGeometry/manifest.json", "location": "Internet Archive" - }], - "windowObjects": [{ - "viewType": "ImageView", - "loadedManifest": "https://iiif.archivelab.org/iiif/TheGeometry/manifest.json", - "annotationLayer": true, - "annotationCreation": true, - "annotationState": 'on' - }], - "annotationEndpoint": { - - "name": "Local Storage", - "module": "PragmaEndpoint" - - } - }); - crosslink.setup(mirador); -}); diff --git a/iiify/static/mirador-2.1/js/crosslink.js b/iiify/static/mirador-2.1/js/crosslink.js deleted file mode 100644 index bd02e62..0000000 --- a/iiify/static/mirador-2.1/js/crosslink.js +++ /dev/null @@ -1,158 +0,0 @@ -var crosslink; -var loaded = false; -$(document).ready(function() { - crosslink = { - setup: function(mirador) { - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - if (!loaded) { - $('.mirador-main-menu').prepend( - '
  • xAnnotate
  • '); - $('.mirador-main-menu').prepend('
    '); - loaded = true; - } - }); - - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - - var isManifestLoaded = function(manifestUri) { - for (var m in mirador.viewer.data) { - if (mirador.viewer.data[m].manifestUri == manifestUri) { - return true; - } - } - return false; - } - - var splitAndLoad = function(manifest, canvas) { - mirador.viewer.eventEmitter.publish('SPLIT_RIGHT', mirador.viewer.workspace.slots[0]); - console.log(manifest) - var _config = { - manifest: manifest, - slotAddress: mirador.viewer.workspace.slots[1].getAddress(), - canvasID: canvas, - viewType: 'ImageView', - annotationLayer: true, - annotationCreation: true, - annotationState: 'on' - }; - mirador.reload(); - mirador.viewer.eventEmitter.publish('ADD_WINDOW', _config); - // load the manifest in the right slot - } - - mirador.reload = function() { - for (var i in mirador.viewer.workspace.windows) { - var window = mirador.viewer.workspace.windows[i]; - window.update(); - } - } - - $('.mirador-viewer').on('click', '.text-viewer a', function(event) { - var link = $(this).attr('href'), - canvas, - manifest; - - event.preventDefault(); - event.stopImmediatePropagation; - - $.get(link, function(anno) { - canvas = anno.annotation.on.full; - manifest = anno.annotation.on.within['@id']; - - // XXX this is breaking if manifest is the same - // check if manifest loadad - - - if (isManifestLoaded(manifest)) { - splitAndLoad(manifest, canvas); - } else { - mirador.viewer.addManifestFromUrl(manifest); - } - }); - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - splitAndLoad(manifest, canvas); - }); - - return false; - }); - - }); - } - } - - var insertCrosslinks = function(source_id, target_id, link_text) { - var hyperlink = function(annotation_id) { - return '

    ' + link_text + '

    '; - } - - console.log('attempting crosslink'); - console.log('fetching target:'); - Annotation.get(target_id, function(target_annotation) { - target_annotation.resource[0]['chars'] += hyperlink(source_id); - console.log('target, before update:'); - console.log(target_annotation); - Annotation.update(target_annotation, function(x) { - console.log('updated target:'); - console.log(x); - console.log('fetching source:'); - Annotation.get(source_id, function(source_annotation) { - console.log('source, before update:'); - console.log(source_annotation); - source_annotation.resource[0]['chars'] += hyperlink(target_id); - Annotation.update(source_annotation, function(y) { - console.log('updated source:'); - console.log(y); - //mirador.reload(); - }); - }); - }); - }); - } - - $(document).on('click', '#xannotate-submit', function(e) { - var source_annotation_id = $('.xannotate-source').val(); - var target_annotation_id = $('.xannotate-target').val(); - var link_text = $('.xannotate-text').val(); - insertCrosslinks(source_annotation_id, target_annotation_id, link_text); - e.stopImmediatePropagation(); - e.preventDefault(); - return false; - }); - - $(document).on('click', '.xannotate-activate', function() { - $('.xannotate-widget').toggle(); - }); - - $('.button-container').append( - '' + - 'crosslink'); - - $(document).on('click', '.annotation-tooltip', function(e) { - var anno_id = $(this).data('anno-id'); - console.log(anno_id); - if (anno_id) { - if (!$('.xannotate-source').val()) { - $('.xannotate-source').val(anno_id); - } else { - $('.xannotate-target').val(anno_id); - } - } - }); - - $('.xannotate-widget .xannotate-source').focus(function(e) { - $('.xannotate-target').removeClass('selected'); - $('.xannotate-source').addClass('selected'); - // change mouse cursor to crosshairs - }) - - $('.xannotate-widget .xannotate-target').focus(function(e) { - $('.xannotate-source').removeClass('selected'); - $('.xannotate-target').addClass('selected'); - // change mouse cursor to crosshairs - }); - - $(document).click(function() { - var selected = $('.xannotate-widget .selected'); - }); - -});