View | Details | Raw Unified | Return to bug 10858
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+4 lines)
Lines 79-84 Link Here
79
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery-ui.js"></script>
79
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery-ui.js"></script>
80
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
80
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
81
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
81
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
82
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery.js"></script>
83
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.json.js"></script>
84
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
85
<script type="text/javascript" src="[% interface %]/[% theme %]/js/commons.js"></script>
82
<script type="text/javascript">
86
<script type="text/javascript">
83
    Modernizr.load([
87
    Modernizr.load([
84
        // Test need for polyfill
88
        // Test need for polyfill
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc (-2 / +2 lines)
Lines 8-18 Link Here
8
            [% IF ( PAGE_NUMBER.highlight ) %]
8
            [% IF ( PAGE_NUMBER.highlight ) %]
9
                <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
9
                <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
10
            [% ELSE %]
10
            [% ELSE %]
11
                <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li>
11
                <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li>
12
            [% END %]
12
            [% END %]
13
        [% END %]
13
        [% END %]
14
        [% IF ( next_page_offset ) %]
14
        [% IF ( next_page_offset ) %]
15
            <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Next &raquo;</a></li>
15
            <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Next &raquo;</a></li>
16
        [% END %]
16
        [% END %]
17
        </ul>
17
        </ul>
18
    </div>
18
    </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-32 / +38 lines)
Lines 1027-1033 Link Here
1027
                                    <span>Previous</span>
1027
                                    <span>Previous</span>
1028
                                [% END %]
1028
                                [% END %]
1029
                            </li>
1029
                            </li>
1030
                            <li class="back_results"><a href="opac-search.pl?[% busc |url %]" title="Back to the results search list">Back to results</a></li>
1030
                            <li class="back_results"><a href="opac-search.pl?[% busc |url %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1031
                            <li class="right_results">
1031
                            <li class="right_results">
1032
                                [% IF ( next ) %]<a href="[% next %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next &raquo;</a>
1032
                                [% IF ( next ) %]<a href="[% next %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next &raquo;</a>
1033
                                [% ELSE %]
1033
                                [% ELSE %]
Lines 1049-1081 Link Here
1049
                    </div>
1049
                    </div>
1050
                [% END # / IF OpacBrowseResults && busc %]
1050
                [% END # / IF OpacBrowseResults && busc %]
1051
1051
1052
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1052
                <div id="sidebar">
1053
1053
                  [% INCLUDE 'opac-detail-sidebar.inc' %]
1054
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1054
1055
                    <div id="NovelistSelect">
1055
                  [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1056
                        <h4>Novelist Select</h4>
1056
                      <div id="NovelistSelect">
1057
                        <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1057
                          <h4>Novelist Select</h4>
1058
                    </div>
1058
                          <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1059
                [% END %]
1059
                      </div>
1060
1060
                  [% END %]
1061
                [% IF ( Babeltheque ) %]
1061
1062
                    <div class="babeltheque_adds">
1062
                  [% IF ( Babeltheque ) %]
1063
                        <div id="BW_critiques_aj"></div>
1063
                      <div class="babeltheque_adds">
1064
                        <div id="BW_citations_aj"></div>
1064
                          <div id="BW_critiques_aj"></div>
1065
                    </div>
1065
                          <div id="BW_citations_aj"></div>
1066
                [% END %]
1066
                      </div>
1067
1067
                  [% END %]
1068
                [% IF ( SocialNetworks ) %]
1068
1069
                    <div id="social_networks" class="clearfix">
1069
                  [% IF ( SocialNetworks ) %]
1070
                        <span>Share</span>
1070
                      <div id="social_networks" class="clearfix">
1071
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1071
                          <span>Share</span>
1072
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1072
                          <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1073
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1073
                          <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1074
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1074
                          <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1075
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1075
                          <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1076
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1076
                          <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1077
                    </div>
1077
                          <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1078
                [% END %]
1078
                      </div>
1079
                  [% END %]
1080
                </div>
1079
            </div> <!-- / .ulactioncontainer -->
1081
            </div> <!-- / .ulactioncontainer -->
1080
        </div> <!-- / .span4 -->
1082
        </div> <!-- / .span4 -->
1081
    </div> <!-- / .row-fluid -->
1083
    </div> <!-- / .row-fluid -->
Lines 1364-1369 Link Here
1364
            renderPagIndexList(pag_index_ini, $("#listResults"));
1366
            renderPagIndexList(pag_index_ini, $("#listResults"));
1365
        }
1367
        }
1366
        $("#a_listResults").click(function(e) {
1368
        $("#a_listResults").click(function(e) {
1369
            $("#sidebar").toggle();
1367
            if (arrPagination.length > 0) {
1370
            if (arrPagination.length > 0) {
1368
                e.preventDefault();
1371
                e.preventDefault();
1369
                var navigation = $(".results-pagination");
1372
                var navigation = $(".results-pagination");
Lines 1383-1388 Link Here
1383
            e.preventDefault();
1386
            e.preventDefault();
1384
            var navigation = $(".results-pagination");
1387
            var navigation = $(".results-pagination");
1385
            navigation.hide();
1388
            navigation.hide();
1389
            $("#sidebar").toggle();
1386
        });
1390
        });
1387
    [% END %]
1391
    [% END %]
1388
[% IF ( OPACShelfBrowser ) %]
1392
[% IF ( OPACShelfBrowser ) %]
Lines 1547-1554 Link Here
1547
        var timeoutRFW;
1551
        var timeoutRFW;
1548
        var totalPagItemList = 10;
1552
        var totalPagItemList = 10;
1549
1553
1550
        function rewindList()
1554
        function rewindList(e)
1551
        {
1555
        {
1556
            e.preventDefault();
1552
            var ul = $("#listResults");
1557
            var ul = $("#listResults");
1553
            var li_ini = ul.children(':first').next();
1558
            var li_ini = ul.children(':first').next();
1554
            var index_ini = pag_index_ini;
1559
            var index_ini = pag_index_ini;
Lines 1566-1573 Link Here
1566
            }
1571
            }
1567
        }//rewindList
1572
        }//rewindList
1568
1573
1569
        function forwardList()
1574
        function forwardList(e)
1570
        {
1575
        {
1576
            e.preventDefault();
1571
            var ul = $("#listResults");
1577
            var ul = $("#listResults");
1572
            var li_ini = ul.children(':first').next();
1578
            var li_ini = ul.children(':first').next();
1573
            var index_ini = pag_index_ini;
1579
            var index_ini = pag_index_ini;
Lines 1598-1604 Link Here
1598
            var ini = index - 1;
1604
            var ini = index - 1;
1599
            var end = ini + totalPagItemList - 1;
1605
            var end = ini + totalPagItemList - 1;
1600
            li = $("<li />");
1606
            li = $("<li />");
1601
            html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList()' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>&laquo;</a>":"&laquo;";
1607
            html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList(event)' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>&laquo;</a>":"&laquo;";
1602
            li.html(html);
1608
            li.html(html);
1603
            ul.append(li);
1609
            ul.append(li);
1604
            var title = "";
1610
            var title = "";
Lines 1620-1626 Link Here
1620
            li = $("<li />");
1626
            li = $("<li />");
1621
            ini = index + 1;
1627
            ini = index + 1;
1622
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1628
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1623
            html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList()' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>&raquo;</a>":"&raquo;";
1629
            html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList(event)' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>&raquo;</a>":"&raquo;";
1624
            li.html(html);
1630
            li.html(html);
1625
            ul.append(li);
1631
            ul.append(li);
1626
        }//renderPagIndexList
1632
        }//renderPagIndexList
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-4 / +32 lines)
Lines 162-167 Link Here
162
                                                    Tag status here.
162
                                                    Tag status here.
163
                                                </div>
163
                                                </div>
164
                                            [% END %]
164
                                            [% END %]
165
                                            <span class="details_link"><a href="#">Browse selected records</a></span>
165
                                        </span> <!-- / .links -->
166
                                        </span> <!-- / .links -->
166
                                </div> <!-- / #selections-toolbar -->
167
                                </div> <!-- / #selections-toolbar -->
167
168
Lines 626-636 function tagAdded() { Link Here
626
627
627
function enableCheckboxActions(){
628
function enableCheckboxActions(){
628
    // Enable/disable controls if checkboxes are checked
629
    // Enable/disable controls if checkboxes are checked
629
    var checkedBoxes = $(".checkboxed input:checkbox:checked");
630
    var bibnums = getContextBiblioNumbers();
630
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
631
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
631
    if ($(checkedBoxes).size()) {
632
    if ( bibnums.length > 0 ) {
632
      $("#selections").html(_("With selected titles: "));
633
      $("#selections").html(_("With selected titles: "));
633
      $(controls).removeClass("disabled");
634
      $(controls).removeClass("disabled");
635
      // Hide or show details link
636
      // Update with first biblionumber in queue
637
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]);
634
    } else {
638
    } else {
635
      $("#selections").html(_("Select titles to: "));
639
      $("#selections").html(_("Select titles to: "));
636
      $(controls).addClass("disabled");
640
      $(controls).addClass("disabled");
Lines 657-662 function highlightOn() { Link Here
657
    $(".highlight_toggle").toggle();
661
    $(".highlight_toggle").toggle();
658
}
662
}
659
[% END %]
663
[% END %]
664
660
$(document).ready(function(){
665
$(document).ready(function(){
661
    [% IF ( OpacHighlightedWords ) %]
666
    [% IF ( OpacHighlightedWords ) %]
662
        $('a.title').each(function() {
667
        $('a.title').each(function() {
Lines 665-673 $(document).ready(function(){ Link Here
665
    [% END %]
670
    [% END %]
666
671
667
    $(".cb").click(function(){
672
    $(".cb").click(function(){
673
      if ( $(this).is(':checked') == true ) {
674
        addBibToContext( $(this).val() );
675
      } else {
676
        delBibToContext( $(this).val() );
677
      }
668
      enableCheckboxActions();
678
      enableCheckboxActions();
669
    });
679
    });
670
    enableCheckboxActions();
680
681
682
    $("#bookbag_form").ready(function(){
683
      $("#bookbag_form").unCheckCheckboxes();
684
      var bibnums = getContextBiblioNumbers();
685
      if (bibnums) {
686
        for (var i=0; i < bibnums.length; i++) {
687
          var id = ('#bib' + bibnums[i]);
688
          if ($(id)) {
689
            $(id).attr('checked', true);
690
          }
691
        }
692
      }
693
    });
671
694
672
    [% IF ( IDreamBooksResults ) %]
695
    [% IF ( IDreamBooksResults ) %]
673
        $('.idbresult').each(function() {
696
        $('.idbresult').each(function() {
Lines 806-816 $(document).ready(function(){ Link Here
806
    $("#CheckAll").click(function(){
829
    $("#CheckAll").click(function(){
807
        $("#bookbag_form").checkCheckboxes();
830
        $("#bookbag_form").checkCheckboxes();
808
        enableCheckboxActions();
831
        enableCheckboxActions();
832
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
833
            $(this).change();
834
        } );
809
        return false;
835
        return false;
810
    });
836
    });
811
    $("#CheckNone").click(function(){
837
    $("#CheckNone").click(function(){
812
        $("#bookbag_form").unCheckCheckboxes();
838
        $("#bookbag_form").unCheckCheckboxes();
813
        enableCheckboxActions();
839
        enableCheckboxActions();
840
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
841
            $(this).change();
842
        } );
814
        return false;
843
        return false;
815
    });
844
    });
816
845
Lines 912-918 $(document).ready(function(){ Link Here
912
            });
941
            });
913
        });
942
        });
914
[% END %]
943
[% END %]
915
916
});
944
});
917
//]]>
945
//]]>
918
</script>
946
</script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js (-13 / +29 lines)
Lines 157-173 function SelectAll(){ Link Here
157
}
157
}
158
158
159
function addMultiple(){
159
function addMultiple(){
160
    var bibnums = getContextBiblioNumbers();
160
    var c_value = "";
161
    var c_value = "";
161
    if(document.bookbag_form.biblionumber.length > 0) {
162
    if ( bibnums.length > 0 ) {
162
        for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
163
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
163
            if (document.bookbag_form.biblionumber[i].checked) {
164
            c_value = c_value + bibnums[i] + "/";
164
                c_value = c_value + document.bookbag_form.biblionumber[i].value + "/";
165
            }
166
        }
165
        }
167
        addSelRecords(c_value);
166
        addSelRecords(c_value);
168
    } else {
167
    } else {
169
        c_value = c_value + document.bookbag_form.biblionumber.value + "/";
168
        if(document.bookbag_form.biblionumber.length > 0) {
170
        addSelRecords(c_value);
169
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
170
                if (document.bookbag_form.biblionumber[i].checked) {
171
                    c_value = c_value + document.bookbag_form.biblionumber[i].value + "/";
172
                }
173
            }
174
            addSelRecords(c_value);
175
        } else {
176
            c_value = c_value + document.bookbag_form.biblionumber.value + "/";
177
            addSelRecords(c_value);
178
        }
171
    }
179
    }
172
}
180
}
173
181
Lines 433-452 function addSelToShelf() { Link Here
433
///  vShelfAdd()  builds url string for multiple-biblio adds.
441
///  vShelfAdd()  builds url string for multiple-biblio adds.
434
442
435
function vShelfAdd() {
443
function vShelfAdd() {
436
        bibs= new Array;
444
    var bibnums = getContextBiblioNumbers();
445
    bibs = new Array;
446
    if ( bibnums.length > 0 ) {
447
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
448
            bibs.push("biblionumber=" + bibnums[i]);
449
        }
450
        return bibs.join("&");
451
    } else {
437
        if(document.bookbag_form.biblionumber.length > 0) {
452
        if(document.bookbag_form.biblionumber.length > 0) {
438
                for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
453
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
439
                        if (document.bookbag_form.biblionumber[i].checked) {
454
                if (document.bookbag_form.biblionumber[i].checked) {
440
                                bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
455
                    bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
441
                        }
442
                }
456
                }
443
        if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
457
            }
458
            if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
444
            return bibs.join("&");
459
            return bibs.join("&");
445
        } else {
460
        } else {
446
            if (document.bookbag_form.biblionumber.checked) {
461
            if (document.bookbag_form.biblionumber.checked) {
447
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
462
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
448
            }
463
            }
449
        }
464
        }
465
    }
450
}
466
}
451
467
452
function showCart(){
468
function showCart(){
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js (+72 lines)
Line 0 Link Here
1
// Extends jQuery API
2
// http://www.wskidmore.com/downloads/jquery-uniqueArray.min.js
3
jQuery.extend({uniqueArray:function(e){if($.isArray(e)){var c={};var a,b;for(b=0,a=e.length;b<a;b++){var d=e[b].toString();if(c[d]){e.splice(b,1);a--;b--}else{c[d]=true}}}return(e)}});
4
5
function removeByValue(arr, val) {
6
    for(var i=0; i<arr.length; i++) {
7
        if(arr[i] == val) {
8
            arr.splice(i, 1);
9
            break;
10
        }
11
    }
12
}
13
14
function paramOfUrl( url, param ) {
15
    param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
16
    var regexS = "[\\?&]"+param+"=([^&#]*)";
17
    var regex = new RegExp( regexS );
18
    var results = regex.exec( url );
19
    if( results == null ) {
20
        return "";
21
    } else {
22
        return results[1];
23
    }
24
}
25
26
function addBibToContext( bibnum ) {
27
    var bibnums = getContextBiblioNumbers();
28
    bibnums.push(bibnum);
29
    setContextBiblioNumbers( bibnums );
30
    //var store = sessionStorage.getItem( "bibs_selected" );
31
}
32
33
function delBibToContext( bibnum ) {
34
    var bibnums = getContextBiblioNumbers();
35
    removeByValue( bibnums, bibnum );
36
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
37
}
38
39
function setContextBiblioNumbers( bibnums ) {
40
    //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) );
41
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
42
}
43
44
function getContextBiblioNumbers() {
45
    //var r = sessionStorage.getItem("bibs_selected");
46
    var r = $.cookie('bibs_selected');
47
    if ( r ) {
48
        return JSON.parse(r);
49
    }
50
    r = new Array();
51
    return r;
52
}
53
54
function resetSearchContext() {
55
    setContextBiblioNumbers( new Array() );
56
}
57
58
$(document).ready(function(){
59
    // forms with action leading to search
60
    $("form[action*='opac-search.pl']").submit(function(){
61
        resetSearchContext();
62
    });
63
    // any link to launch a search except navigation links
64
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
65
        resetSearchContext();
66
    });
67
    // any link to a detail page from the results page.
68
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
69
        resetSearchContext();
70
    });
71
});
72
(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js (+1 lines)
Line 0 Link Here
1
jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.json.js (-1 / +199 lines)
Line 0 Link Here
0
- 
1
/**
2
 * jQuery JSON plugin 2.4-alpha
3
 *
4
 * @author Brantley Harris, 2009-2011
5
 * @author Timo Tijhof, 2011-2012
6
 * @source This plugin is heavily influenced by MochiKit's serializeJSON, which is
7
 *         copyrighted 2005 by Bob Ippolito.
8
 * @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org
9
 *         website's http://www.json.org/json2.js, which proclaims:
10
 *         "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
11
 *         I uphold.
12
 * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
13
 */
14
(function ($) {
15
	'use strict';
16
17
	var escape = /["\\\x00-\x1f\x7f-\x9f]/g,
18
		meta = {
19
			'\b': '\\b',
20
			'\t': '\\t',
21
			'\n': '\\n',
22
			'\f': '\\f',
23
			'\r': '\\r',
24
			'"' : '\\"',
25
			'\\': '\\\\'
26
		},
27
		hasOwn = Object.prototype.hasOwnProperty;
28
29
	/**
30
	 * jQuery.toJSON
31
	 * Converts the given argument into a JSON representation.
32
	 *
33
	 * @param o {Mixed} The json-serializable *thing* to be converted
34
	 *
35
	 * If an object has a toJSON prototype, that will be used to get the representation.
36
	 * Non-integer/string keys are skipped in the object, as are keys that point to a
37
	 * function.
38
	 *
39
	 */
40
	$.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
41
		if (o === null) {
42
			return 'null';
43
		}
44
45
		var pairs, k, name, val,
46
			type = $.type(o);
47
48
		if (type === 'undefined') {
49
			return undefined;
50
		}
51
52
		// Also covers instantiated Number and Boolean objects,
53
		// which are typeof 'object' but thanks to $.type, we
54
		// catch them here. I don't know whether it is right
55
		// or wrong that instantiated primitives are not
56
		// exported to JSON as an {"object":..}.
57
		// We choose this path because that's what the browsers did.
58
		if (type === 'number' || type === 'boolean') {
59
			return String(o);
60
		}
61
		if (type === 'string') {
62
			return $.quoteString(o);
63
		}
64
		if (typeof o.toJSON === 'function') {
65
			return $.toJSON(o.toJSON());
66
		}
67
		if (type === 'date') {
68
			var month = o.getUTCMonth() + 1,
69
				day = o.getUTCDate(),
70
				year = o.getUTCFullYear(),
71
				hours = o.getUTCHours(),
72
				minutes = o.getUTCMinutes(),
73
				seconds = o.getUTCSeconds(),
74
				milli = o.getUTCMilliseconds();
75
76
			if (month < 10) {
77
				month = '0' + month;
78
			}
79
			if (day < 10) {
80
				day = '0' + day;
81
			}
82
			if (hours < 10) {
83
				hours = '0' + hours;
84
			}
85
			if (minutes < 10) {
86
				minutes = '0' + minutes;
87
			}
88
			if (seconds < 10) {
89
				seconds = '0' + seconds;
90
			}
91
			if (milli < 100) {
92
				milli = '0' + milli;
93
			}
94
			if (milli < 10) {
95
				milli = '0' + milli;
96
			}
97
			return '"' + year + '-' + month + '-' + day + 'T' +
98
				hours + ':' + minutes + ':' + seconds +
99
				'.' + milli + 'Z"';
100
		}
101
102
		pairs = [];
103
104
		if ($.isArray(o)) {
105
			for (k = 0; k < o.length; k++) {
106
				pairs.push($.toJSON(o[k]) || 'null');
107
			}
108
			return '[' + pairs.join(',') + ']';
109
		}
110
111
		// Any other object (plain object, RegExp, ..)
112
		// Need to do typeof instead of $.type, because we also
113
		// want to catch non-plain objects.
114
		if (typeof o === 'object') {
115
			for (k in o) {
116
				// Only include own properties,
117
				// Filter out inherited prototypes
118
				if (hasOwn.call(o, k)) {
119
					// Keys must be numerical or string. Skip others
120
					type = typeof k;
121
					if (type === 'number') {
122
						name = '"' + k + '"';
123
					} else if (type === 'string') {
124
						name = $.quoteString(k);
125
					} else {
126
						continue;
127
					}
128
					type = typeof o[k];
129
130
					// Invalid values like these return undefined
131
					// from toJSON, however those object members
132
					// shouldn't be included in the JSON string at all.
133
					if (type !== 'function' && type !== 'undefined') {
134
						val = $.toJSON(o[k]);
135
						pairs.push(name + ':' + val);
136
					}
137
				}
138
			}
139
			return '{' + pairs.join(',') + '}';
140
		}
141
	};
142
143
	/**
144
	 * jQuery.evalJSON
145
	 * Evaluates a given json string.
146
	 *
147
	 * @param str {String}
148
	 */
149
	$.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
150
		/*jshint evil: true */
151
		return eval('(' + str + ')');
152
	};
153
154
	/**
155
	 * jQuery.secureEvalJSON
156
	 * Evals JSON in a way that is *more* secure.
157
	 *
158
	 * @param str {String}
159
	 */
160
	$.secureEvalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
161
		var filtered =
162
			str
163
			.replace(/\\["\\\/bfnrtu]/g, '@')
164
			.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
165
			.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
166
167
		if (/^[\],:{}\s]*$/.test(filtered)) {
168
			/*jshint evil: true */
169
			return eval('(' + str + ')');
170
		}
171
		throw new SyntaxError('Error parsing JSON, source is not valid.');
172
	};
173
174
	/**
175
	 * jQuery.quoteString
176
	 * Returns a string-repr of a string, escaping quotes intelligently.
177
	 * Mostly a support function for toJSON.
178
	 * Examples:
179
	 * >>> jQuery.quoteString('apple')
180
	 * "apple"
181
	 *
182
	 * >>> jQuery.quoteString('"Where are we going?", she asked.')
183
	 * "\"Where are we going?\", she asked."
184
	 */
185
	$.quoteString = function (str) {
186
		if (str.match(escape)) {
187
			return '"' + str.replace(escape, function (a) {
188
				var c = meta[a];
189
				if (typeof c === 'string') {
190
					return c;
191
				}
192
				c = a.charCodeAt();
193
				return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
194
			}) + '"';
195
		}
196
		return '"' + str + '"';
197
	};
198
199
}(jQuery));

Return to bug 10858