Bugzilla – Attachment 107711 Details for
Bug 25639
Add search queries to HTML so queries can be retrieved via JS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25639: Add query strings as global JS variables
Bug-25639-Add-query-strings-as-global-JS-variables.patch (text/plain), 2.46 KB, created by
Nick Clemens (kidclamp)
on 2020-08-03 14:02:30 UTC
(
hide
)
Description:
Bug 25639: Add query strings as global JS variables
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-08-03 14:02:30 UTC
Size:
2.46 KB
patch
obsolete
>From 0d51a5cd0292f295cf44b871db98a4c7a1560bd9 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 29 Jul 2020 10:56:37 +0000 >Subject: [PATCH] Bug 25639: Add query strings as global JS variables > >To test: >1 - Search on OPAC for "qwertyuiop" >2 - View the HTML source >3 - Find 'qwertyuiop' in the source, it is not easily accessible via JS >4 - Apply patch >5 - Repeat >6 - Note that now there are global variables with the query strings >7 - Add to OpacUserJs: > console.log( query_desc ); > console.log( querystring ); > console.log( query_cgi ); >8 - Reload page and confirm variables are warned in the JS console (Press F12) >9 - Sign off >--- > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 6 ++++++ > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 -- > 2 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index d4d8b23bb0..623ef2dfde 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -176,6 +176,12 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > var MSG_OVERDRIVE_DOWNLOAD_AS = _( "Download as: " ); > var MSG_OVERDRIVE_CANNOT_CHECKOUT = _("Item cannot be checked out. There are no available formats"); > [% END %] >+ [% IF (query_desc) %] >+ var query_desc = "[% query_desc | html %]"; >+ var querystring = "[% querystring | html %]"; >+ var query_cgi = "[% query_cgi | html %]"; >+ [% END %] >+ > [% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %] > $(window).load(function() { > verify_images(); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index 3fd522cf62..fd5091dd27 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -880,8 +880,6 @@ $(document).ready(function(){ > [% END %] > > [% IF ( query_desc ) %] >- var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]"; >- var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]"; > [% IF ( OpacHighlightedWords ) %] > q_array = query_desc.split(" "); > // ensure that we don't have "" at the end of the array, which can >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25639
:
105458
|
105487
|
106112
|
107440
|
107486
|
107711
|
107712
|
107713
|
107714
|
107715
|
107745
|
109120
|
109221
|
109258