Skip to content

Commit

Permalink
avoid non existent nameresolver
Browse files Browse the repository at this point in the history
  • Loading branch information
respinos committed Dec 21, 2023
1 parent 143b8ab commit fdad82c
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 32 deletions.
14 changes: 14 additions & 0 deletions src/js/text/viewers/viewer-mirador.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ window.addEventListener('message', (event) => {
history.pushState({}, document.title, newHref);
document.querySelector('.breadcrumb li:last-child').setAttribute('href', newHref);

const bookmarkItem = document.querySelector('dt[data-key="bookmark-item"] + dd span.url');
if ( bookmarkItem ) {
let itemHref = bookmarkItem.innerText.trim();
if ( itemHref.indexOf('/cgi/') > -1 ) {
// just use newHref
bookmarkItem.innerText = newHref;
} else {
// just pop on the new seq?
let tmp = itemHref.split('/');
tmp[tmp.length - 1] = newSeq.replace(/^0+/, '');
bookmarkItem.innerText = tmp.join('/');
}
}

tocbot.refresh();

ScreenReaderMessenger.getMessenger().say(`Viewing ${label}`);
Expand Down
1 change: 1 addition & 0 deletions templates/text/langmap.en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
<Item key="default-badge">more_vert</Item>
</Lookup>
<Lookup id="uplift">
<Item key="results.str.singlepage"> scan</Item>
<Item key="uplift.str.contents">Item Information</Item>
<Item key="uplift.str.page.contents">Browse: Collection Contents</Item>
<Item key="uplift.str.page.browse">Browse: Collection Contents</Item>
Expand Down
2 changes: 1 addition & 1 deletion templates/text/qbat/qbat.pageviewer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
</span>
</xsl:template>

<xsl:template match="qui:field[@key='bookmark']" priority="101">
<xsl:template match="qui:field[contains(@key, 'bookmark')]" priority="101">
<xsl:call-template name="build-content-copy-metadata">
<xsl:with-param name="term"><xsl:value-of select="qui:label" /></xsl:with-param>
<xsl:with-param name="key"><xsl:value-of select="@key" /></xsl:with-param>
Expand Down
9 changes: 7 additions & 2 deletions templates/text/qui/includes/qui.header-common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@
<qui:label>Link to this Item</qui:label>
<qui:values>
<qui:value>
<xsl:text>https://name.umdl.umich.edu/</xsl:text>
<xsl:value-of select="//ApiUrl" />
<xsl:text>/</xsl:text>
<xsl:value-of select="substring($collid, 1, 1)" />
<xsl:text>/</xsl:text>
<xsl:value-of select="$collid" />
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="local-name($item) = 'Item' and $item/@idno">
<xsl:value-of select="$item/@idno" />
Expand Down Expand Up @@ -979,7 +984,7 @@
<xsl:when test="contains(normalize-space(.), 'believed to be in the public domain')">
<xsl:apply-templates select="key('get-statement', 'u-m-research-access-believed')" mode="copy-guts" />
</xsl:when>
<xsl:when test="contains(normalize-space(.), 'are likely to be in the public domain.')">
<xsl:when test="contains(normalize-space(.), 'are likely in the public domain.')">
<xsl:apply-templates select="key('get-statement', 'u-m-research-access-believed')" mode="copy-guts" />
</xsl:when>
<xsl:when test="contains(normalize-space(.), 'with permission from copyright holder')">
Expand Down
20 changes: 11 additions & 9 deletions templates/text/qui/qui.header.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@

<xsl:template name="build-contents-navigation">
<qui:nav role="contents">
<xsl:if test="
/Top/AuthRequired != 'true' and
/Top/Item/DocEncodingType != 'serialissue' and
/Top/Item/ItemHeader/HEADER/@TYPE != 'noocr'">
<qui:link href="{//ViewEntireTextLink}" role="view-text">
<xsl:value-of select="key('get-lookup','header.str.viewentiretext')"/>
</qui:link>
</xsl:if>
<!-- <qui:link rel="bookmark" href="{/Top/BookbagAddHref}" label="{key('get-lookup', 'results.str.21')}" /> -->
<xsl:choose>
<xsl:when test="/Top/AuthRequired = 'true'"></xsl:when>
<xsl:when test="/Top/Item/DocEncodingType = 'serialissue'"></xsl:when>
<xsl:when test="/Top/Item/ItemHeader/HEADER/@TYPE = 'noocr'"></xsl:when>
<xsl:when test="//ViewEntireTextLink">
<qui:link href="{//ViewEntireTextLink}" role="view-text">
<xsl:value-of select="key('get-lookup','header.str.viewentiretext')"/>
</qui:link>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="/Top/BookbagResults/Item[@idno=$idno]">
<qui:form slot="bookbag" rel="remove" href="{/Top/BookbagResults/Item[@idno=$idno]/AddRemoveUrl}" data-identifier="{$idno}">
Expand Down
56 changes: 36 additions & 20 deletions templates/text/qui/qui.pageviewer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -509,26 +509,42 @@
</qui:values>
</qui:field> -->

<qui:field key="bookmark" component="input">
<qui:label>Link to this Item</qui:label>
<qui:values>
<qui:value>
<xsl:text>https://name.umdl.umich.edu/</xsl:text>
<xsl:choose>
<xsl:when test="//Param[@name='node']">
<xsl:value-of select="//Param[@name='node']" />
<xsl:if test="//Param[@name='seq']">
<xsl:text>/</xsl:text>
<xsl:value-of select="//Param[@name='seq']" />
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="dlxs:downcase(//Param[@name='idno'])" />
</xsl:otherwise>
</xsl:choose>
</qui:value>
</qui:values>
</qui:field>
<xsl:call-template name="build-bookmarkable-link">
<xsl:with-param name="item" select="/Top/DocMeta" />
</xsl:call-template>

<xsl:if test="//Param[@name='seq'] or
( //Param[@name='node'] and //Param[@name='node'] != //Param[@name='idno'] )">
<qui:field key="bookmark-item" component="input">
<qui:label>Link to this <xsl:value-of select="key('get-lookup', 'results.str.singlepage')" /></qui:label>
<qui:values>
<qui:value>
<xsl:value-of select="//ApiUrl" />
<xsl:text>/</xsl:text>
<xsl:value-of select="substring($collid, 1, 1)" />
<xsl:text>/</xsl:text>
<xsl:value-of select="$collid" />
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="//Param[@name='node']">
<xsl:value-of select="//Param[@name='node']" />
<xsl:if test="//Param[@name='seq']">
<xsl:text>/</xsl:text>
<xsl:value-of select="//Param[@name='seq']" />
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="dlxs:downcase(//Param[@name='idno'])" />
<xsl:if test="//Param[@name='seq']">
<xsl:text>/</xsl:text>
<xsl:value-of select="//Param[@name='seq']" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</qui:value>
</qui:values>
</qui:field>
</xsl:if>

</qui:section>
<!-- </qui:block> -->
Expand Down

0 comments on commit fdad82c

Please sign in to comment.