Skip to content

Instantly share code, notes, and snippets.

View jsicot's full-sized avatar

Julien Sicot jsicot

View GitHub Profile
@jsicot
jsicot / bookmarklet primo R2
Last active September 30, 2021 14:42
bookmarklet primo R2 pour faire apparaitre des liens vers notices sources (pnx, unimarc, sru, oai, etc)
javascript:(function() { var showPnxLinkElem = document.querySelectorAll('prm-brief-result-container'), urlParamVid = location.search.split('vid=')[1].split('&')[0]; function createLink (linkUrl, linkText) { var obj = document.createElement("a"); obj.setAttribute("href", linkUrl); obj.setAttribute("target", "_blank"); obj.style.margin = "0 0 0 2em"; obj.innerHTML = linkText; return obj; } for (var i=0, j=showPnxLinkElem.length; i < j; i++) { var showPnxRecId = showPnxLinkElem[i].querySelector('.list-item-primary-content').getAttribute('data-recordid'), resultItemChildren = showPnxLinkElem[i].parentNode.childNodes, resultItemLastChild = resultItemChildren[resultItemChildren.length-1], recordIdSpan = document.createElement("span"), hrefBase = showPnxLinkElem[i].querySelector('.media-thumbnail').querySelector('a').getAttribute('ng-href').replace(/docid=.*?(&|$)/, "docid="+showPnxRecId+"$1"), bn = showPnxRecId.replace(/33UDR2_KOHA/, ""), showIntranetLinkHref = "https://pro-koha.bu.univ-rennes2.fr/cgi-bin/koha/cat
@jsicot
jsicot / custom.js
Created May 15, 2020 13:00
intégration istex dans primo
(function() {
"use strict";
'use strict';
var app = angular.module('viewCustom', ['angularLoad']);
app.config(['$sceDelegateProvider', function($sceDelegateProvider) {
var urlWhitelist = $sceDelegateProvider.resourceUrlWhitelist();
urlWhitelist.push('https://api.istex.fr/document/openurl**');
@jsicot
jsicot / retrieve_author_ppn.py
Created October 16, 2018 18:46
Retrieve author PPN
import csv
import urllib.request,urllib.parse,json
import os, ssl
# SSL exception
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and
getattr(ssl, '_create_unverified_context', None)):
ssl._create_default_https_context = ssl._create_unverified_context
def getPpn(name,firstname,birthdate):
@jsicot
jsicot / pqf.properties
Created April 11, 2014 13:55
pqf.properties
#
# Propeties file to drive org.z3950.zing.cql.CQLNode's toPQF()
# back-end and the YAZ CQL-to-PQF converter. This specifies the
# interpretation of various CQL indexes, relations, etc. in terms
# of Type-1 query attributes.
#
# This configuration file generates queries using BIB-1 attributes.
# See http://www.loc.gov/z3950/agency/zing/cql/dc-indexes.html
# for the Maintenance Agency's work-in-progress mapping of Dublin Core
# indexes to Attribute Architecture (util, XD and BIB-2)
@jsicot
jsicot / json.getSru.php
Created June 16, 2014 17:24
json.getSru.php
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', '0');
include('QuiteSimpleXMLElement.php');
$amazonRemplacementImg = file_get_contents('http://www.bu.fr/images/defaultcover.jpg', false);
if (isset( $_GET['q'])) {
$q = $_GET['q'];
@jsicot
jsicot / local.js
Created October 16, 2013 15:53
Fix for summon 2.0 localization
if(__locale == "fr") {
jQuery(document).ready(function($){
$('div.languageSwitcher a.customSecondaryLink').text("Français ").append("<b class='caret'></b>");
})
__locale == "fr-FR";
__summonLocale = 'fr-FR';
__translations = {"Always check your references for accuracy":"Vérifiez toujours l'exactitude de vos références","Czech":"Tchèque","Kannada":null,"Clear":"Effacer","to present":"jusqu'à aujourd'hui","Sep":"Sept.","Danish":null,"only in unstable":"only in unstable","Publication":"Publication","Poem":"Poème","Newspaper Article":"Article de Presse","Type (e.g. book, journal article, etc.)":"Type (p. ex. livre, article de périodique, etc.)","Western Frisian":"Frison occidental","Standard":"Norme","Image (if any)":"Image (le cas échéant)","Journal Article":"Article de périodique","Publisher":"Éditeur","Azerbaijani":"Azerbaïdjanais","Serbian":"Serbe","inupiaq":null,"About":"À-propos","Try different keywords.":"Essayez avec d'autres mots-clés.","Kit":"Ensemble multi-supports","Personal Narrative":"Récit"
@jsicot
jsicot / gist:7008816
Last active December 25, 2015 16:49
Quick fix for summon localization
if((__locale == "en-US" && __summonLocale = 'en') || __locale == "en") {
__translations = {"Always check your references for accuracy":"Vérifiez toujours l'exactitude de vos références","Czech":"Tchèque","Kannada":null,"Clear":"Effacer","to present":"jusqu'à aujourd'hui","Sep":"Sept.","Danish":null,"only in unstable":"only in unstable","Publication":"Publication","Poem":"Poème","Newspaper Article":"Article de Presse","Type (e.g. book, journal article, etc.)":"Type (p. ex. livre, article de périodique, etc.)","Western Frisian":"Frison occidental","Standard":"Norme","Image (if any)":"Image (le cas échéant)","Journal Article":"Article de périodique","Publisher":"Éditeur","Azerbaijani":"Azerbaïdjanais","Serbian":"Serbe","inupiaq":null,"About":"À-propos","Try different keywords.":"Essayez avec d'autres mots-clés.","Kit":"Ensemble multi-supports","Personal Narrative":"Récit","Exclude Newspaper Articles":"Exclure les articles de presse","Available Online":"Accessible en ligne","Note This list of saved items may not
@jsicot
jsicot / bookreaderToItemShow
Created July 16, 2013 14:33
add bookreader viewer
echo get_specific_plugin_hook_output('BookReader' , 'public_items_show', array('view' => $this,'item' => $item,'page' => '0','embed_functions' => false,));
@jsicot
jsicot / UNIMARCslim2OPACDetail.xsl
Created March 22, 2013 10:51
UNIMARCslim2OPACDetail.xsl
<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:items="http://www.koha-community.org/items" xmlns:intralinks="http://www.koha.org/intralinks" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc items">
<xsl:import href="UNIMARCslimUtils.xsl"/>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:key name="intralinks" match="intralinks:intralinks" use="intralinks:ppn"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="marc:record">
@jsicot
jsicot / UNIMARCslimUtils.xsl
Created March 22, 2013 10:51
UNIMARCslimUtils.xsl
<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="datafield">
<xsl:param name="tag"/>
<xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="subfields"/>
<xsl:element name="datafield">
<xsl:attribute name="tag">
<xsl:value-of select="$tag"/>