Changeset 31627

Show
Ignore:
Timestamp:
21.04.2017 11:24:50 (2 years ago)
Author:
davidb
Message:

Changed to static home page with choice of DL to go to. Initial Google Scholar support added

Location:
other-projects/meddle/trunk
Files:
4 added
3 modified

Legend:

Unmodified
Added
Removed
  • other-projects/meddle/trunk/INSTALL.sh

    r31612 r31627  
    2727/bin/cp index.* "$MEDDLE_WEBDIR/." 
    2828/bin/cp meddle-fixup.js "$MEDDLE_WEBDIR/." 
    29 /bin/cp meddle-icon-*.png "$MEDDLE_WEBDIR/." 
     29/bin/cp meddle-*.png "$MEDDLE_WEBDIR/." 
    3030 
    3131echo "Installing/Updating $MEDDLE_CGIDIR" 
  • other-projects/meddle/trunk/index.html

    r31605 r31627  
    22  <head> 
    33    <meta charset="UTF-8"> 
     4    <link rel="stylesheet" type="text/css" href="index.css"> 
    45    <script 
    56       src="https://code.jquery.com/jquery-2.2.4.min.js" 
    67       integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" 
    78       crossorigin="anonymous"></script> 
    8      
     9<!--     
    910    <script src="index.js"></script> 
     11--> 
    1012 
    1113  </head> 
    1214  <body id="body"> 
    13     Loading in the MEDDLE ACM DL home page ... 
     15     
     16 
     17<div id="outer"> 
     18    <div id="header"> 
     19 
     20      <h2> 
     21    <img src="//bedrock.resnet.cms.waikato.ac.nz/meddle/meddle-icon-large.png" height="40" width="40"> 
     22    MEDDLE Proxy: ModifiED Digital Library Proxy 
     23      </h2> 
     24    </div> 
     25<!-- 
     26    <div id="nav"> 
     27        <h4>Navigation</h4> 
     28        <ul> 
     29            <li>Item 1</li> 
     30            <li>Item 2</li> 
     31            <li>Item 3</li> 
     32        </ul> 
     33    </div> 
     34--> 
     35    <div id="main"> 
     36      <p> 
     37    Which Digital Library would you like to MEDDLE with? 
     38      </p> 
     39      <ul style="list-style: none;"> 
     40    <li> 
     41      <a href="https://bedrock.resnet.cms.waikato.ac.nz/cgi-bin/meddle/nph-proxy-meddle.cgi/en/20/http/dl.acm.org/"> 
     42        <img class="dllogo" src="meddle-acmdl.png"> 
     43      </a> 
     44    </li> 
     45    <li> 
     46      <a href="https://bedrock.resnet.cms.waikato.ac.nz/cgi-bin/meddle/nph-proxy-meddle.cgi/en/20/http/ieeexplore.ieee.org/"> 
     47        <img class="dllogo" src="meddle-xplore.png"> 
     48      </a> 
     49    </li> 
     50    <li> 
     51      <a href="https://bedrock.resnet.cms.waikato.ac.nz/cgi-bin/meddle/nph-proxy-meddle.cgi/en/20/https/scholar.google.com/"> 
     52        <img class="dllogo" src="meddle-gscholar.png"> 
     53      </a> 
     54    </li> 
     55      </ul> 
     56    </div> 
     57    <div id="footer"> 
     58        <p></p> 
     59    </div> 
     60 
     61</div> 
     62 
     63 
     64 
     65 
    1466  </body> 
    1567</html> 
  • other-projects/meddle/trunk/meddle-fixup.js

    r31612 r31627  
    1 // https://en.wikipedia.org/wiki/List_of_precomposed_Latin_characters_in_Unicode 
    2 // https://en.wikipedia.org/wiki/Typographic_ligature#Ligatures_in_Unicode_.28Latin_alphabets.29 
     1// MEDDLE version 0.9 
     2 
     3 
     4// Ligature lookup info: 
     5//   https://en.wikipedia.org/wiki/List_of_precomposed_Latin_characters_in_Unicode 
     6//   https://en.wikipedia.org/wiki/Typographic_ligature#Ligatures_in_Unicode_.28Latin_alphabets.29 
    37 
    48function trim(str) 
     
    203207function meddleInfoBox() { 
    204208 
    205     $('#_proxy_css_top_insertion').append('<form name="MeddleForm" style="padding-bottom: 20px;"><center><table cellpadding="5" border="1"><tbody><tr><td align="center"><img src="http://bedrock.resnet.cms.waikato.ac.nz/meddle/meddle-icon-large.png" width="64" height="64" /></td><td><b><font size="+1">MEDDLE Proxy: ModifiED Digital Library Proxy</font></b><br /><div id="dlcontext"></div><div id="dlcontextoptions"</div></td></tr></tbody></table></center></form>'); 
     209    $('#_proxy_css_top_insertion').append('<form name="MeddleForm" style="padding-bottom: 20px;"><center><table cellpadding="5" border="1"><tbody><tr><td align="center"><img src="http://bedrock.resnet.cms.waikato.ac.nz/meddle/meddle-icon-large.png" width="64" height="64" /></td><td><b><font size="+1"><a href="https://bedrock.resnet.cms.waikato.ac.nz/meddle/">MEDDLE Proxy: ModifiED Digital Library Proxy</a></font></b><br /><div id="dlcontext"></div><div id="dlcontextoptions"</div></td></tr></tbody></table></center></form>'); 
    206210 
    207211    // Icon image 
    208212    // By VistaICO.com (VistaICO Toolbar Icons) [CC BY 3.0 ] 
    209213 
    210     // if (window.location.matches(/^h 
    211214 
    212215    var dlcontextoptions = '<input id="meddle-lig" name="meddle-lig" type="checkbox"><label for="meddle-lig" style="display: inline">&nbsp;Ligature&nbsp;expansion</label>&nbsp;&nbsp;<input id="meddle-acc" name="meddle-acc" type="checkbox"><label for="meddle-acc" style="display: inline">&nbsp;Accent&nbsp;folding</label>'; 
     
    243246 
    244247 
    245  
    246 //var acmdl_fixup_div = document.getElementById("acmdl-fixup"); 
    247  
    248  
    249 //window.onload = function(e) { 
    250  
    251248function acmdlFixupInit() { 
    252249 
    253250    console.log("amc-dl-fixup initiated"); 
    254  
    255     meddleInfoBox(); 
    256251 
    257252    var query_form = document.getElementsByName("qiksearch")[0]; 
     
    260255    } 
    261256 
    262     //query_form.setAttribute("onsubmit", "encodeInput(this) ; _proxy_jslib_flush_write_buffers();"); 
    263  
    264257/* 
    265     var query_box_val = query_form.elements['query'].value; 
    266  
    267     //var ft_regex = /content.ftsec:\(\+(.*?)\)/g; 
    268     //var match = ft_regex.exec(query_box_val); 
    269  
    270     query_form.value = query_box_val.replace(/content.ftsec:\(\+(.*)\)/g,"$1"); 
    271  
    272258    //var query_box = document.getElementsByName("query")[0]; 
    273259    //var query_box_val = query_box.getAttribute("value"); 
     
    292278 
    293279 
     280function fixupGScholarSubmit(evt) { 
     281    //alert("Bar"); 
     282    console.log( "gscholar-dl-fixup fixupEncodeInput(form) called" ); 
     283 
     284    var event = evt || window.event; 
     285    form = event.target.id; 
     286 
     287    event.preventDefault(); // to stop the form from submitting 
     288 
     289    if (ligature_re === null) { 
     290        var ligature_str = Object.keys(ligature_map).join("|"); 
     291        ligature_re = new RegExp(ligature_str); 
     292    } 
     293 
     294    //console.log("*** ligature_str = " + ligature_str); 
     295 
     296    //var query_box_val = form.elements['q'].value; 
     297    var query_box = document.getElementById("gs_hp_tsi"); 
     298    var query_box_val = query_box.value; 
     299 
     300    var detected_ligatures = ligature_re.test(query_box_val); 
     301    if (detected_ligatures) { 
     302    //var do_replacement = confirm("Detected ligatures in query. Replace with individual characters?"); 
     303    var do_replacement = $('#meddle-lig').is(":checked"); 
     304 
     305    if (do_replacement) { 
     306            var query_chars = query_box_val.split(""); 
     307            var query_chars_fixed = []; 
     308         
     309            for (var i=0; i<query_chars.length; i++) { 
     310        var c = query_chars[i]; 
     311        if (ligature_map[c]) { 
     312            c = ligature_map[c]; 
     313        } 
     314        query_chars_fixed.push(c); 
     315            } 
     316            query_box_val = query_chars_fixed.join(""); 
     317    } 
     318    } 
     319 
     320    var do_accent_replacement = $('#meddle-acc').is(":checked"); 
     321    if (do_accent_replacement) { 
     322    query_box_val = accent_fold(query_box_val); 
     323    } 
     324 
     325 
     326    //form.elements['q'].value = query_box_val; 
     327    query_box.value = query_box_val; 
     328 
     329    _proxy_jslib_flush_write_buffers(); 
     330 
     331    var query_form = document.getElementsByName("f")[0]; 
     332    query_form.submit(); 
     333    //form.submit();  
     334} 
     335 
     336function gscholarFixupInit() { 
     337 
     338    console.log("gscholar-fixup initiated"); 
     339 
     340    var query_form = document.getElementsByName("f")[0]; 
     341    if (query_form) { 
     342    //query_form.setAttribute("onsubmit", "fixupGScholarSubmit(this) ; _proxy_jslib_flush_write_buffers();"); 
     343    //query_form.setAttribute("onsubmit", fixupGScholarSubmit); 
     344    //query_form.setAttribute("onsubmit", 'function(evt) { fixupGoogleSubmit(evt,this) }'); 
     345 
     346    query_form.onsubmit = fixupGScholarSubmit; 
     347/* 
     348function(evt)  { 
     349            var event = evt || window.event; 
     350        fixupGScholarSubmit(event,event.target.id); 
     351 
     352            //console.log(event.target.id); // myform 
     353         
     354    } 
     355*/ 
     356 
     357    } 
     358 
     359 
     360 
     361/* 
     362    //var query_box = document.getElementsByName("query")[0]; 
     363    //var query_box_val = query_box.getAttribute("value"); 
     364    //query_box.setAttribute("value", "Foo"); 
     365*/ 
     366    console.log("gscholar DOM tweaks done"); 
     367} 
     368 
     369 
     370// Google Scholar 
     371// <input class="gs_in_txt" name="q" value="" data-iq="" id="gs_hp_tsi" size="57" maxlength="256" autocapitalize="off" autocomplete="off" aria-label="Search" dir="ltr" type="text"> 
     372 
    294373$(document).ready(function() { 
    295374  console.log( "jquery DOM ready" ); 
     375  meddleInfoBox(); 
     376 
    296377  acmdlFixupInit() 
     378  gscholarFixupInit() 
     379 
    297380}); 
    298381