├── _config.yml ├── alma_print_slip-1.2-fx.xpi ├── chrome_alma_print_slip_extension ├── icons │ ├── .directory │ ├── alma_slip-48.png │ └── alma_slip-96.png ├── background.js ├── manifest.json ├── configure_slip.html ├── configure_slip.js └── alma_print_slip.js ├── firefox_alma_print_slip_extension ├── icons │ ├── alma_slip-48.png │ └── alma_slip-96.png ├── background.js ├── manifest.json ├── configure_slip.html ├── configure_slip.js └── alma_print_slip.js ├── LICENSE └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /alma_print_slip-1.2-fx.xpi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bediniupi/Alma-print-slip/HEAD/alma_print_slip-1.2-fx.xpi -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/icons/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2019,3,13,11,47,17 3 | Version=3 4 | -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/icons/alma_slip-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bediniupi/Alma-print-slip/HEAD/chrome_alma_print_slip_extension/icons/alma_slip-48.png -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/icons/alma_slip-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bediniupi/Alma-print-slip/HEAD/chrome_alma_print_slip_extension/icons/alma_slip-96.png -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/icons/alma_slip-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bediniupi/Alma-print-slip/HEAD/firefox_alma_print_slip_extension/icons/alma_slip-48.png -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/icons/alma_slip-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bediniupi/Alma-print-slip/HEAD/firefox_alma_print_slip_extension/icons/alma_slip-96.png -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/background.js: -------------------------------------------------------------------------------- 1 | function call_alma_print_slip() { 2 | chrome.tabs.executeScript({ 3 | file: "alma_print_slip.js" 4 | }); 5 | } 6 | 7 | function open_options_page() { 8 | chrome.runtime.openOptionsPage(); 9 | } 10 | 11 | chrome.webRequest.onCompleted.addListener(call_alma_print_slip, {urls: ["*://*.alma.exlibrisgroup.com/*"]}); 12 | chrome.browserAction.onClicked.addListener(open_options_page); 13 | -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/background.js: -------------------------------------------------------------------------------- 1 | function call_alma_print_slip() { 2 | browser.tabs.executeScript({ 3 | file: "alma_print_slip.js" 4 | }); 5 | } 6 | 7 | function open_options_page() { 8 | browser.runtime.openOptionsPage(); 9 | } 10 | 11 | browser.webRequest.onCompleted.addListener(call_alma_print_slip, {urls: ["*://*.alma.exlibrisgroup.com/*"]}); 12 | browser.browserAction.onClicked.addListener(open_options_page); 13 | -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Alma Print Slip", 4 | "version": "1.2", 5 | "author": "Nazzareno Bedini - Università di Pisa", 6 | "description": "Create a button to print loans slip immediately in Alma ExLibris.", 7 | "homepage_url": "https://github.com/bediniupi/Alma-print-slip", 8 | "icons": { 9 | "48": "icons/alma_slip-48.png", 10 | "96": "icons/alma_slip-96.png" 11 | }, 12 | "permissions": [ 13 | "activeTab", 14 | "*://*.alma.exlibrisgroup.com/*", 15 | "webRequest", 16 | "storage" 17 | ], 18 | "background": { 19 | "scripts": ["background.js"] 20 | }, 21 | "browser_action": { 22 | "default_icon": { 23 | "48": "icons/alma_slip-48.png", 24 | "96": "icons/alma_slip-96.png" 25 | }, 26 | "default_title": "Alma Print Slip" 27 | }, 28 | 29 | "options_ui": { 30 | "page": "configure_slip.html" 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Alma Print Slip", 4 | "version": "1.2", 5 | "author": "Nazzareno Bedini - Università di Pisa", 6 | "description": "Create a button to print loans slip immediately in Alma ExLibris.", 7 | "homepage_url": "https://github.com/bediniupi/Alma-print-slip", 8 | "icons": { 9 | "48": "icons/alma_slip-48.png", 10 | "96": "icons/alma_slip-96.png" 11 | }, 12 | "permissions": [ 13 | "activeTab", 14 | "*://*.alma.exlibrisgroup.com/*", 15 | "webRequest", 16 | "storage" 17 | ], 18 | "background": { 19 | "scripts": ["background.js"] 20 | }, 21 | "browser_action": { 22 | "browser_style": true, 23 | "default_icon": { 24 | "48": "icons/alma_slip-48.png", 25 | "96": "icons/alma_slip-96.png" 26 | }, 27 | "default_title": "Alma Print Slip" 28 | } , 29 | "options_ui": { 30 | "page": "configure_slip.html", 31 | "browser_style": true 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Nazzareno Bedini 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## New version as bookmarklet is available ## 2 | 3 | check at [Alma-Print-slip-bookmarklet](https://github.com/bediniupi/Alma-Print-slip-bookmarklet) 4 | (no more need to install extensions) 5 | 6 | # Alma-print-slip 7 | 8 | Alma-Print Slip browser extensions 9 | 10 | The source code of this extension is available for Firefox and Chrome. 11 | 12 | ## What it does 13 | 14 | Add a "Print Slip" button in the fulfillment Patron services Alma page when loans are made and/or displayed, when it pressed displays and print a loan slip/receipt immediately bypassing the Alma email based circulation desks printers. 15 | 16 | ## Installation 17 | 18 | Firefox: go to about:addons and install the extension from the alma_print_slip-1.2-fx.xpi file. 19 | 20 | Chrome: go to chrome://extensions, activate developer mode, and then load non packaged extension from the chrome Alma Print Slip extension directory saved locally. 21 | 22 | ## Configuration 23 | 24 | Click on the Alma Print slip icon on the toolbar. 25 | Here you can personalize the button and the slip appearance (css and text) and behaviour (display or display and print the receipt immediately). 26 | 27 | ## Tips and tricks 28 | 29 | If you do not want to display some data (for example, the signature part) simply add a display:none; to the relative css textbox of the element to delete. 30 | 31 | To reorder the elements swap the "order n" part of css. 32 | 33 | Remember that the data displayed in loans table are the same and in the same order of the datas displayed in the table you visualize in the fulfillment Patron services Alma page: if you want to avoid displaying the author/s simply check "Only title" in configuration page. 34 | 35 | If you use a receipt printer you can check "Two column table" to get a tighter table to print. 36 | 37 | You can add a image adding its url: for example, you can add the Alma email logo from Configuration Branding management adding the url https://[...].alma.exlibrisgroup.com/infra/branding/logo/logo-email.png?[...]. 38 | 39 | If you use Alma in another languange than english please fill the "Sortable translation" field with the word translated in your language (for example, in italian is "ordinabile") to avoid printing it in the loan table; separate each term with pipe "|" (ex., "ordinabile|ordine ascendente"). 40 | 41 | In general use your css knowlewdge to personalize the aspect of the receipts: in case you messed it up, reset the values to the default values simply delete the content of the textbox. 42 | 43 | ## Troubleshooting 44 | 45 | After installation you have to save the configuration even if you don't change it, or the button will be "undefined". 46 | -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/configure_slip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 |To reset the values to the default values simply delete the content of the textbox.
13 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/configure_slip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |Per ripristinare i valori di default basta cancellare il contenuto della casella relativa.
13 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/configure_slip.js: -------------------------------------------------------------------------------- 1 | function saveOptions(e) { 2 | e.preventDefault(); 3 | chrome.storage.local.set({ 4 | slip_name: document.querySelector("#slip_name").value, 5 | button_name: document.querySelector("#button_name").value, 6 | institution_name: document.querySelector("#institution_name").value, 7 | institution_logo: document.querySelector("#institution_logo").value, 8 | button_css: document.querySelector("#button_css").value, 9 | body_css: document.querySelector("#body_css").value, 10 | table_css: document.querySelector("#table_css").value, 11 | institution_css: document.querySelector("#institution_css").value, 12 | library_css: document.querySelector("#library_css").value, 13 | title_css: document.querySelector("#title_css").value, 14 | user_css: document.querySelector("#user_css").value, 15 | loans_css: document.querySelector("#loans_css").value, 16 | signature_css: document.querySelector("#signature_css").value, 17 | date_format: document.querySelector("#date_format").value, 18 | signature: document.querySelector("#signature").value, 19 | print_now: document.querySelector("#print_now").checked, 20 | table_rotate: document.querySelector("#table_rotate").checked, 21 | only_title: document.querySelector("#only_title").checked, 22 | sortable_translated: document.querySelector("#sortable_translated").value 23 | }); 24 | 25 | if (sessionStorage.getItem("is_reloaded")) { 26 | document.querySelector("#updated").style.display="block"; 27 | sessionStorage.clear(); 28 | 29 | } else { 30 | location.reload(true); 31 | sessionStorage.setItem("is_reloaded", "1"); 32 | 33 | } 34 | } 35 | 36 | function restoreOptions() { 37 | 38 | function setCurrentChoice(result) { 39 | document.querySelector("#slip_name").value = result.slip_name || "Loan Receipt"; 40 | document.querySelector("#button_name").value = result.button_name || "Print the Receipt"; 41 | document.querySelector("#institution_name").value = result.institution_name || "[My Institution]"; 42 | document.querySelector("#institution_logo").value = result.institution_logo || "[Logo Url]"; 43 | document.querySelector("#button_css").value = result.button_css || "background-color:red; color:white; height: 32px; padding: 6px 12px 6px 12px; border: 1px solid transparent; border-radius:4px"; 44 | document.querySelector("#body_css").value = result.body_css || "font-family: Arial, Helvetica, sans-serif;"; 45 | document.querySelector("#table_css").value = result.table_css || "border-collapse: collapse;"; 46 | document.querySelector("#institution_css").value = result.institution_css || "order: 0; font-size: medium;"; 47 | document.querySelector("#library_css").value = result.library_css || "order: 1; font-size: medium;"; 48 | document.querySelector("#title_css").value = result.title_css || "order: 2; font-size: large;"; 49 | document.querySelector("#user_css").value = result.user_css || "order: 3; font-size: small; font-weight:bold;"; 50 | document.querySelector("#loans_css").value = result.loans_css || "order: 4; padding-top: 20px;"; 51 | document.querySelector("#signature_css").value = result.signature_css || "order: 5; padding-top:50px;"; 52 | document.querySelector("#date_format").value = result.date_format || "en-US"; 53 | document.querySelector("#signature").value = result.signature || "Signature _________________________"; 54 | document.querySelector("#print_now").checked = result.print_now; 55 | document.querySelector("#table_rotate").checked = result.table_rotate; 56 | document.querySelector("#only_title").checked = result.only_title; 57 | document.querySelector("#sortable_translated").value = result.sortable_translated || ""; 58 | } 59 | 60 | 61 | chrome.storage.local.get(setCurrentChoice); 62 | } 63 | 64 | document.addEventListener("DOMContentLoaded", restoreOptions); 65 | document.querySelector("form").addEventListener("submit", saveOptions); 66 | -------------------------------------------------------------------------------- /firefox_alma_print_slip_extension/configure_slip.js: -------------------------------------------------------------------------------- 1 | function saveOptions(e) { 2 | e.preventDefault(); 3 | browser.storage.local.set({ 4 | slip_name: document.querySelector("#slip_name").value, 5 | button_name: document.querySelector("#button_name").value, 6 | institution_name: document.querySelector("#institution_name").value, 7 | institution_logo: document.querySelector("#institution_logo").value, 8 | button_css: document.querySelector("#button_css").value, 9 | body_css: document.querySelector("#body_css").value, 10 | table_css: document.querySelector("#table_css").value, 11 | institution_css: document.querySelector("#institution_css").value, 12 | library_css: document.querySelector("#library_css").value, 13 | title_css: document.querySelector("#title_css").value, 14 | user_css: document.querySelector("#user_css").value, 15 | loans_css: document.querySelector("#loans_css").value, 16 | signature_css: document.querySelector("#signature_css").value, 17 | date_format: document.querySelector("#date_format").value, 18 | signature: document.querySelector("#signature").value, 19 | print_now: document.querySelector("#print_now").checked, 20 | table_rotate: document.querySelector("#table_rotate").checked, 21 | only_title: document.querySelector("#only_title").checked, 22 | sortable_translated: document.querySelector("#sortable_translated").value 23 | }); 24 | 25 | if (sessionStorage.getItem("is_reloaded")) { 26 | document.querySelector("#updated").style.display="block"; 27 | sessionStorage.clear(); 28 | 29 | } else { 30 | location.reload(true); 31 | sessionStorage.setItem("is_reloaded", "1"); 32 | 33 | } 34 | } 35 | 36 | function restoreOptions() { 37 | 38 | function setCurrentChoice(result) { 39 | document.querySelector("#slip_name").value = result.slip_name || "Loan Receipt"; 40 | document.querySelector("#button_name").value = result.button_name || "Print the Receipt"; 41 | document.querySelector("#institution_name").value = result.institution_name || "[My Institution]"; 42 | document.querySelector("#institution_logo").value = result.institution_logo || "[Logo Url]"; 43 | document.querySelector("#button_css").value = result.button_css || "background-color:red; color:white; height: 32px; padding: 6px 12px 6px 12px; border: 1px solid transparent; border-radius:4px"; 44 | document.querySelector("#body_css").value = result.body_css || "font-family: Arial, Helvetica, sans-serif;"; 45 | document.querySelector("#table_css").value = result.table_css || "border-collapse: collapse;"; 46 | document.querySelector("#institution_css").value = result.institution_css || "order: 0; font-size: medium;"; 47 | document.querySelector("#library_css").value = result.library_css || "order: 1; font-size: medium;"; 48 | document.querySelector("#title_css").value = result.title_css || "order: 2; font-size: large;"; 49 | document.querySelector("#user_css").value = result.user_css || "order: 3; font-size: small; font-weight:bold;"; 50 | document.querySelector("#loans_css").value = result.loans_css || "order: 4; padding-top: 20px;"; 51 | document.querySelector("#signature_css").value = result.signature_css || "order: 5; padding-top:50px;"; 52 | document.querySelector("#date_format").value = result.date_format || "en-US"; 53 | document.querySelector("#signature").value = result.signature || "Signature _________________________"; 54 | document.querySelector("#print_now").checked = result.print_now; 55 | document.querySelector("#table_rotate").checked = result.table_rotate; 56 | document.querySelector("#only_title").checked = result.only_title; 57 | document.querySelector("#sortable_translated").value = result.sortable_translated || ""; 58 | } 59 | 60 | 61 | function onError(error) { 62 | console.log(`Error: ${error}`); 63 | } 64 | var res = browser.storage.local.get(null); 65 | res.then(setCurrentChoice, onError); 66 | } 67 | 68 | document.addEventListener("DOMContentLoaded", restoreOptions); 69 | document.querySelector("form").addEventListener("submit", saveOptions); 70 | -------------------------------------------------------------------------------- /chrome_alma_print_slip_extension/alma_print_slip.js: -------------------------------------------------------------------------------- 1 | function onGot(item) { 2 | 3 | 4 | var body_css = item.body_css; 5 | var table_css = item.table_css; 6 | // div 7 | var institution_css = item.institution_css; 8 | var library_css = item.library_css; 9 | var title_css = item.title_css; 10 | var user_css = item.user_css; 11 | var loans_css = item.loans_css; 12 | var signature_css = item.signature_css; 13 | var date_format = item.date_format; 14 | var d = new Date(); 15 | var today = d.toLocaleDateString(date_format); 16 | var slip_name = item.slip_name; 17 | var button_name = item.button_name; 18 | var button_style = item.button_css; 19 | var institution_name = item.institution_name; 20 | var institution_logo_link = item.institution_logo; 21 | var data = "Date "+today; 22 | var firma = item.signature; 23 | var print_now = item.print_now; 24 | var table_rotate = item.table_rotate; 25 | var only_title = item.only_title; 26 | var sortable_translated = "|sortable|sorted descending|sorted ascending|"+item.sortable_translated+"|"; 27 | var user_name = document.getElementById("pageBeanfullPatronName").innerHTML; 28 | var user_id = document.getElementById("pageBeanuserIDisplay").value; 29 | var library = document.getElementById("locationButton").innerText; 30 | var rowLength = loan_table.rows.length; 31 | var header_ray = []; 32 | var loan_ray = []; 33 | var i,j; 34 | var h,l; 35 | var loan_row, loan_rows; 36 | var loan_list_table; 37 | var header_el = document.querySelectorAll('th[id^="SELENIUM_ID_loanList_HEADER"]'); 38 | for(i=0; i