Bib-Tools

 view release on metacpan or  search on metacpan

examples/post.js  view on Meta::CPAN

            }
            i = i+1;
          }
        }
    }
    var jsonString = JSON.stringify(Obj);
    document.getElementById('out').innerHTML = document.getElementById('out').innerHTML+jsonString;
}

//--------------------------------------
// Code below creates popup for structured input of author details
//--------------------------------------

function initAuth() {
  // attach popups to every author list cell
  SetAuthEvents('doi');
  SetAuthEvents('nodoi');
}

function SetAuthEvents(dataTable) {
  // attach popups to every author list cell
  var table = document.getElementById(dataTable);
  if (table == null) return;
  var rows = table.rows;
  for (var i = 1; i<rows.length; i++) {
    if (rows[i].id == "cite") {
      var col = rows[i].cells[5];
      col.contentEditable=false;
      col.addEventListener("click",HandleAuth,false);
    }
  }

examples/post.js  view on Meta::CPAN


function ShowAuth(el) {
  // get author list
  var s = el.textContent;
  var bits = s.split(/ and /);
  var str = '';
  for (var i = 0; i<bits.length; i++) {
     str += bits[i]+"\n";
  }

  // create popup
  var m = document.createElement("div");
  m.id = "auth";
  m.style.cssText="position:absolute; background:#0E73B9; padding:10px; box-shadow:10px 10px 5px #888888; border:1px solid;";
  // textarea with authors, one per line
  m.innerHTML = '<textarea rows="'+(bits.length+2)+'">'+str+'</textarea><br>';
  // save button
  var save = document.createElement("input");
  save.type="button"; save.value="Save"; save.addEventListener("click", HandleAuth, false);
  // cancel button
  var cancel = document.createElement("input");

examples/post.js  view on Meta::CPAN

function CloseAuth(el) {
  var m = el.parentNode;
  var td = m.parentNode;
  if (td == null) return; // to handle multiple clicks due to bubbling
  if (el.value == "Save") {
    // extract author list info
    var auths = m.firstChild.value;
    auths = auths.replace(/\n+/g,' and ');
    auths = auths.replace(/^ and /,'');
    auths = auths.replace(/ and $/,'');
    // delete popup
    td.removeChild(td.firstChild);
    // update table entry
    td.textContent=auths;
  } else {
    // just delete popup
    td.removeChild(td.firstChild);
  }
}

function HandleAuth(e) {
  var el;
  if (!e) {
      el = event.target || event.srcElement;
  } else {
      el = e.target || e.srcElement;



( run in 3.040 seconds using v1.01-cache-2.11-cpan-364913b4093 )