[EXT] Norwell history tools

Announce and Discuss the Latest Theme and Extension Releases.
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

I went to C:\Users\x\AppData\Roaming\Mozilla\Firefox\Profiles\x\extensions located norvel@history.xpi opened it in WinRar commented out those lines inhistoryQuery.js, repacked the archive, and then restarted Firefox. The errors that appeared after restarting and opening Norwell are;

Code: Select all

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create browser.js:2645
uncaught exception: Invalid Date
no element found button_28:1
A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Date: Sun Jan 04 2015 18:57:26 GMT-0500 (Eastern Standard Time)
Full Message: null
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
uncaught exception: Invalid Date
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

what about loading

chrome://norwell/content/norwell.xul?k=http
or
chrome://norwell/content/norwell.xul?a=1

By any chance what kind of locale are you using? If not US english, would it be possible to switch to US english?
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

When I load
chrome://norwell/content/norwell.xul?k=http
I am able to see a list of entries. The second one doesn't do anything
I'm not sure which locale I'm using but it's more than likely english.
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

What about the console? Does it show any errors when loading norwell with ?k=http or ?a=1 ?

How about adding on very top of historyQeury.js

Code: Select all

alert (new Date().toLocaleString().slice(0, 10));


after you load norwell (try with ?k if doesn't work regular) - It will alert with you with date. Paste the result here.
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

The console wouldn't show the invalid date error if I just loaded chrome://norwell/content/norwell.xul?k=http. After adding that line to the beginning when I opened Norwell a dialog box with "1/4/2015," appeared with "uncaught exception: Invalid Date" error appear after hitting okay on the dialog box.
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

try replacing historyQuery.js with this:

Code: Select all

k = window.location.href.split('?k=')[1];
a = window.location.href.split('?a=')[1];
aa='';
fdt=new Date;
fdt=fdt.getFullYear()+"-"+((fdt.getMonth.length<10)?("0"+(fdt.getMonth()+1)):(fdt.getMonth()+1))+"-"+((fdt.getDate.length<10)?("0"+fdt.getDate()):fdt.getDate());
function remvD (str) {
  var removalMap = [
    {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},
    {'base':'aa','letters':/[\uA733]/g},
    {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},
    {'base':'ao','letters':/[\uA735]/g},
    {'base':'au','letters':/[\uA737]/g},
    {'base':'av','letters':/[\uA739\uA73B]/g},
    {'base':'ay','letters':/[\uA73D]/g},
    {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},
    {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},
    {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},
    {'base':'dz','letters':/[\u01F3\u01C6]/g},
    {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},
    {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},
    {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},
    {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},
    {'base':'hv','letters':/[\u0195]/g},
    {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},
    {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},
    {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},
    {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},
    {'base':'lj','letters':/[\u01C9]/g},
    {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},
    {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},
    {'base':'nj','letters':/[\u01CC]/g},
    {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},
    {'base':'oi','letters':/[\u01A3]/g},
    {'base':'ou','letters':/[\u0223]/g},
    {'base':'oo','letters':/[\uA74F]/g},
    {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},
    {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},
    {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},
    {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},
    {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},
    {'base':'tz','letters':/[\uA729]/g},
    {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},
    {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},
    {'base':'vy','letters':/[\uA761]/g},
    {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},
    {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},
    {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},
    {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}
  ];
  str1=str;
  for(var i=0; i<removalMap.length; i++) {
    str = str.replace(removalMap[i].letters, removalMap[i].base);
  }
  str2=convert(str1);
  return (str1==str)?[0,0,0]:[str,str2[0],str2[1]];
}
function convert(s) {
  function parse(a, c) {
    return String.fromCharCode(parseInt(c, 16));
  }
   s1=encodeURIComponent(s.replace(/%u([0-f]{4})/gi, parse));
   s2=s.substring(0,1).toLocaleUpperCase() + s.substring(1);
   s2=encodeURIComponent(s2.replace(/%u([0-f]{4})/gi, parse));
   return (s1==s)?0:[s1,s2];
}
function updateVisitsInRange()
{
   var range='';
   document.getElementById("cach").addEventListener("command", myfunction1, true);
   document.getElementById("cach").addEventListener("command", myfunction, true);
   document.getElementById("keyword").addEventListener("command", myfunction, true);
   function myfunction(event){ k=null;a=null;}
   function myfunction1(event)
   {
      var cx=document.getElementById("cach").hasAttribute("checked");
      var show = document.getElementById("caldou");
      if (cx)
      {
         document.getElementById("cahi").setAttribute("hidden","false");
         document.getElementById("cal1").addEventListener("change", myfunction1, true);
         document.getElementById("cal2").addEventListener("change", myfunction1, true);
         dx1=document.getElementById("cal1").value;
         dx2=document.getElementById("cal2").value;
         document.getElementById("dateH").value = fdt
         var dx3 = document.getElementById("dateH").value;
         if (dx1>dx3){document.getElementById("cal1").value=dx3;dx1=dx3;}
         if (dx2>dx3){document.getElementById("cal2").value=dx3;dx2=dx3;}
         show.setAttribute("style","color: red;min-width: 1em; ");
         show.label = ((dx1>dx2||(dx3 == dx1 && dx3 == dx2))?"beginning":dx1)+" to "+dx2;
      }
      else
      {
         for (var cax=1; cax <= 21; cax++)
         {
            if(document.getElementById("lt"+cax).hasAttribute("checked")) document.getElementById("lt"+cax).removeAttribute('checked');
            if (cax >15) document.getElementById("lt"+cax).reset();
         }
         if(!document.getElementById("lt30").hasAttribute("selected")||!document.getElementById("lt25").hasAttribute("selected"))
         {
            if(document.getElementById("lt31").hasAttribute("selected")) document.getElementById("lt31").removeAttribute('selected');
            if(document.getElementById("lt32").hasAttribute("selected")) document.getElementById("lt32").removeAttribute('selected');
            if(document.getElementById("lt26").hasAttribute("selected")) document.getElementById("lt26").removeAttribute('selected');
            if(document.getElementById("lt27").hasAttribute("selected")) document.getElementById("lt27").removeAttribute('selected');
            if(document.getElementById("lt28").hasAttribute("selected")) document.getElementById("lt27").removeAttribute('selected');
            document.getElementById("lt30").setAttribute('selected','true');
            document.getElementById("lt25").setAttribute('selected','true');
         }
         document.getElementById("cal1").dateValue=new Date();
         document.getElementById("cal2").dateValue=new Date();
         document.getElementById("cahi").setAttribute("hidden","true");
         show.label="Limits";
         show.setAttribute("style","");
      }
   }
   var key = document.getElementById("keyword").value;
   if (!key && k)
   {
      key=decodeURIComponent(k);document.getElementById("keyword").value =key.trim();
   }
   if (key)
   {
      key = key.replace(/[\-]+/g, "-");key = key.replace(/[<>]/g, ""); key = key.replace(/[\u00AD­­]/g,'');
      range+=" where ";
      var v=0;
      key = key.toLocaleLowerCase();
      newk=key;
      newk=newk.replace(/\s+/g, ' ');
      cam1=document.getElementById("lt31").hasAttribute("selected")?1:0;
      cam2=document.getElementById("lt32").hasAttribute("selected")?1:0;
      var cam1; var cam2; var rangec=''; var rango='';
      if (or = newk.match(/(?:['"]?)([^\s"]+)(?:['"]?\sor\s['"]?)([^\s\"]+)(?:['"]?)/))
      {
         newk=newk.replace(/[^\s]+\sor\s[^\s]+/, ""); newk=newk.replace(/\s+/g, ' ');
         for (var i=1; i < or.length; i++)
         {
             rango += (i==1)?"":" OR ";
            rango += (!cam1 && !cam2)?(" (instr(lower(+p.url), '"+or[i]+"') > 0 OR instr(lower(replace(+p.title,char(173),'')), '"+or[i]+"') >   0) "):(" ( instr(lower(replace(+p."+((!cam1)?"url":"title")+",char(173),'')), '"+or[i]+"') >   0) ");
            if (rmd = remvD(or[i])[0])
            {
               if (!cam1 && !cam2)
               {
                rango +=" OR (instr(lower(+p.url), '"+rmd+"') > 0 OR instr(lower(replace(+p.title,char(173),'')), '"+rmd+"') >   0)  OR (instr(lower(+p.url), '"+remvD(or[i])[1]+"') > 0 OR instr(lower(replace(+p.title,char(173),'')), '"+remvD(or[i])[1]+"') >   0)  OR (instr(lower(+p.url), '"+remvD(or[i])[2]+"') > 0 OR instr(lower(replace(+p.title,char(173),'')), '"+remvD(or[i])[2]+"') >   0) ";
               }
               else
               {
                rango +=" OR ( instr(lower(replace(+p."+((!cam1)?"url":"title")+",char(173),'')), '"+rmd+"') >   0)  OR (instr(lower(replace(+p."+((!cam1)?"url":"title")+",char(173),'')), '"+remvD(or[i])[1]+"') >   0)  OR (instr(lower(replace(+p."+((!cam1)?"url":"title")+",char(173),'')), '"+remvD(or[i])[2]+"') >   0) ";
               }
            }
         }
      }
      keob=[];
      var match;var regex = /(?:\s\-)([^\s]+)/g
      while (match = regex.exec(newk)) {keob.push(['neg',match[1],remvD(match[1])[0],remvD(match[1])[1],remvD(match[1])[2]]);}
      newk=newk.replace(/\s\-[^\s]+/g, ""); newk=newk.replace(/\s+/g, ' ');
      var match;var regex = /(?:^\"|\s\")([^\"]+)(?:\")/g
      while (match = regex.exec(newk)) {keob.push(['kab',match[1],remvD(match[1])[0],remvD(match[1])[1],remvD(match[1])[2]]);}
      newk=newk.replace(/(^|\s)\"[^\"]+\"/g, ""); newk=newk.replace('/\sand\s/g', ' ');newk=newk.replace(/\s+/g, ' '); newk=newk.replace(/^\s|\s$/g, '');
      var match;var regex = /(?:\s?)([^\s]+)/g
      while (match = regex.exec(newk)) {keob.push(['and',match[1],remvD(match[1])[0],remvD(match[1])[1],remvD(match[1])[2]]);}
      for (var kp=0; kp < keob.length; kp++)
      {
         rangec += (kp==0)?"":" AND ";
         var rangem='';
         for (var cm=1; cm <= 4; cm++)
         {
            if (keob[kp][cm])
            {
               if (rangem.length>0 && cm !=1) rangem +=(keob[kp][0]=='neg')?" AND ":" OR ";
               rangem += (((!cam1 && cam2)||(!cam1 && !cam2))?(" instr(lower(replace(+p.url,char(173),'')), '"+keob[kp][cm]+"') " +  ((keob[kp][0]=='neg')?"=":">") +" 0 "):"") + ((!cam1 && !cam2)?((keob[kp][0]=='neg')?" AND ":" OR "):"") + (((cam1 && !cam2)||(!cam1 && !cam2))?(" instr(lower(replace(+p.title,char(173),'')), '"+keob[kp][cm]+"') "+  ((keob[kp][0]=='neg')?"=":">") +" 0 "):"");
            }
         }
         rangec += " ( "+rangem+" ) ";
      }
      range += (rango?" ( ":"") + rango +(rango?" ) ":"") + ((rango && rangec)?" AND ":"") + rangec ;
      if (range.length<50) return 0;
   }
   if (document.getElementById("cach").hasAttribute('checked'))
   {
      if (a && !key) range ='';
      ca1=document.getElementById("cal1").value;
      ca2=document.getElementById("cal2").value;
      document.getElementById("dateH").value = fdt
      var ca3 = document.getElementById("dateH").value;
      if (ca3 != ca1 || ca3 != ca2)
      {
         range += ((range.length>1)?" AND ":" WHERE ");
         if (ca2<ca1)
         {
            range += " ( hv.visit_date <=  (strftime('%s','"+ca2+"','utc')*1000000)+86400000000 OR hv.visit_date is NULL ) ";
         }
         else
         {
            range += " ( hv.visit_date BETWEEN strftime('%s','"+ca1+"','utc')*1000000 AND (strftime('%s','"+ca2+"','utc')*1000000)+86400000000  ) ";
         }
      }
      var rangei=range;
      var ranged='';
      for (var caxt=9; caxt <= 15; caxt++)
      {
         if(document.getElementById("lt"+caxt).hasAttribute("checked"))   ranged +=((ranged.length>0)?" OR ":"") + " strftime('%w', datetime(hv.visit_date/1000000, 'unixepoch', 'localtime')) = '" + (caxt-9)+ "'" ;
      }
      if (ranged.length>0) range += " AND ("+ranged+")";
      var rangel=''; var ranga='';
      for (var caxv=1; caxv <= 8; caxv++)
      {
         if(document.getElementById("lt"+caxv).hasAttribute("checked"))   rangel += ((rangel.length>0)?" OR ":"") + " hv.visit_type = " +  caxv;
      }
      if (rangel.length>0) range += " AND ("+rangel+")";
      if (document.getElementById("lt18").value > -1)
      {
         ranga = " length(p.title) >=" + document.getElementById("lt18").value;
         if (document.getElementById("lt18").value<=0)
         {
            range += " AND (" + ranga + " OR p.title is null)";
         }
         else
         {
            range += " AND " + ranga;
         }
      }
      if (document.getElementById("lt19").value > -1) range += " AND ( length(p.title) <=" + document.getElementById("lt19").value + " OR p.title is null)";
      if (document.getElementById("lt20").value > 0) range +=" AND length(p.url) >=" + document.getElementById("lt20").value;
      if (document.getElementById("lt21").value > 0) range +=" AND length(p.url) <=" + document.getElementById("lt21").value;
      if (document.getElementById("lt16").value > -1) range +=" AND p.visit_count >= " + document.getElementById("lt16").value;
      if (document.getElementById("lt17").value > -1) range +=" AND p.visit_count <= " + document.getElementById("lt17").value;
      if (document.getElementById("lt26").hasAttribute("selected") || document.getElementById("lt27").hasAttribute("selected") || document.getElementById("lt28").hasAttribute("selected"))range += " GROUP BY " + (document.getElementById("lt26").hasAttribute("selected")?" gtitle ":(document.getElementById("lt28").hasAttribute("selected")?" p.title ":" p.id "));
   }
   else
   {
      if (!key)
      {
         if (a)
         {
            afdt=new Date(+a/1000);
            var dt = afdt.getFullYear()+"-"+((afdt.getMonth.length<10)?("0"+(afdt.getMonth()+1)):(afdt.getMonth()+1))+"-"+((afdt.getDate.length<10)?("0"+afdt.getDate()):afdt.getDate());
            var range="WHERE hv.visit_date BETWEEN strftime('%s','"+dt+"','utc')*1000000-86400000000 AND (strftime('%s','"+dt+"','utc')*1000000)+(86400000000*2) ";
         }
         else
         {
            document.getElementById("dateH").value = fdt
            var dt = document.getElementById("dateH").value;
            var range="WHERE hv.visit_date BETWEEN strftime('%s','"+dt+"','utc')*1000000 AND (strftime('%s','"+dt+"','utc')*1000000)+86400000000 ";
         }
         myfunction1();
      }
   }
   document.getElementById("goto_date").hidden=(key || (document.getElementById("cach").hasAttribute('checked') && rangei!=range))?0:1;
   document.getElementById("show_referer").hidden=(key || (document.getElementById("cach").hasAttribute('checked') && rangei!=range && !key))?1:0;
   document.getElementById("show_clicks").hidden=(key || (document.getElementById("cach").hasAttribute('checked') && rangei!=range && !key))?1:0;
   var sql="SELECT IFNULL(hv.visit_date,p.last_visit_date), p.url, p.title, p.visit_count, hv.id, hv.from_visit, hv.visit_type, IFNULL(p.title,p.url) as gtitle FROM moz_places p  LEFT OUTER JOIN  moz_historyvisits hv on p.id=hv.place_id " + range +" order by hv.visit_date";
   return sql;
};
function setView()
{
   start = Date.now(); hData =[]; visit_type = {1:"followed a link", 2:"typed or autocomplete", 3:"bookmark", 4:"embedded URL", 5:"permanent redirect", 6:"temporary redirect", 7:"download", 8:"framed link" , 9:"unknown"}; colnid = {'id0':0, 'id1':1, 'id2':2, 'id3':3, 'id5':5};
   document.getElementById("progrid").setAttribute("hidden","false"); document.getElementById("progrid").setAttribute("hidden","false"); document.getElementById("keyword").setAttribute("hidden","true"); document.getElementById('norwell_h').view = {rowCount : 0,getCellText: function(){},setTree: function() {},};
   var foo = document.getElementById("boxbox1"); while (foo.firstChild) foo.removeChild(foo.firstChild);
   var foo = document.getElementById("boxbox2"); while (foo.firstChild) foo.removeChild(foo.firstChild);
   document.getElementById("casio").label="0/0/0s";
   mDBConn = Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection;
   var statement = mDBConn.createStatement("SELECT count(*) FROM moz_places p LEFT OUTER JOIN moz_historyvisits h on p.id=h.place_id "); statement.executeStep(); casno=statement.getString(0);
   sql1=updateVisitsInRange();
   var statement = mDBConn.createAsyncStatement(sql1);
   statement.executeAsync(
   {
      handleResult: function(result)
      {
         while (row = result.getNextRow())
         {
            hData.push([row.getResultByIndex(0),row.getResultByIndex(1),row.getResultByIndex(2),row.getResultByIndex(3),row.getResultByIndex(4), row.getResultByIndex(6),row.getResultByIndex(5)]);
         }
         var end1 = Date.now();var elapsed = Math.round((end1 - start)/1000 * 10) / 10;
         document.getElementById("casio").label=hData.length+"/"+casno+"/"+elapsed+"s";
      },
      handleError:function(aError) {console.log(aError.message);},
      handleCompletion: function(aReason)
      {
         if (hData.length>0)
         {
            document.getElementById('norwell_h').view =
            {
               rowCount : hData.length,
               getCellText: function(row, column){return (column.id=='id0')?hdate(hData[row][colnid[column.id]]):(column.id=='id5')?visit_type[(hData[row][colnid[column.id]]>8||hData[row][colnid[column.id]]<1)?9:hData[row][colnid[column.id]]]:hData[row][colnid[column.id]];},
               setTree: function() {},
            };
         }
         if (a>0) { for(var i=0, len=hData.length-1; i < len; i++){ if (hData[i][0]==+a) break; }} else{i=0;}
         tree = document.getElementById("norwell_h");
         tree.view.selection.select(i);
         document.getElementById('norwell_h').focus();
         if (i> Math.abs(tree.treeBoxObject.getPageLength()/2)) {tree.treeBoxObject.scrollToRow(i-Math.abs(tree.treeBoxObject.getPageLength()/2))};   var end = Date.now();var finito = Math.round((end - start)/1000 * 10) / 10;
         document.getElementById("casio").label=(hData.length?hData.length:"0")+"/"+casno+"/"+finito+"s";
         document.getElementById("progrid").setAttribute("hidden","true");
         document.getElementById("keyword").setAttribute("hidden","false");
         document.getElementById("keyword").value=document.getElementById("keyword").value;
         if (!hData.length) alert ("no browsing history for" + (document.getElementById("keyword").value?" this search":" this period"));
      }
   });
};
function hdate(dat)
{
    return dat? ((new Date(dat/1000)).toLocaleString()): "n/a";
}
function interfaceClicks(num)
{
   var tree = document.getElementById("norwell_h");
   document.getElementById('norwell_h').focus();
   if (num == 1){ return (tree.view.selection.count>1)? alert("more than one row selected"):window.open(tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(1)));}
   if (num == 2 || num==21 || num==22)
   {
      var sterm = document.getElementById("keywith").value;
      var rest = new RegExp("("+sterm+")", "gi");
      stpos=(num==2)?0:tree.currentIndex;
      if (num!=2) (num==21)?stpos++:--stpos;
      ti=null;
      for(var i=stpos, len=hData.length; ((num==2 || num==21)?(i<len):(i>0)); ((num==2 || num==21)?(i++):(--i)))
      {
         sw1=hData[i][1]?hData[i][1].search(rest):-1;
         sw2=hData[i][2]?hData[i][2].search(rest):-1;
         if (sw1!=-1 ||sw2!=-1)
         {
            tree.view.selection.select(i);
            tree.treeBoxObject.ensureRowIsVisible(i);
            document.getElementById('norwell_h').focus();
            ti=i;
            break;
         }
      }
      if (ti===null)
      {
         alert((num==2 || num==21)?"reached the end":"reached the begining");
         return;
      }
      clearspan();
      createspan(hData[i][1],1,rest);
      hData[i][2]?createspan(hData[i][2],0,rest):createspan('',0,rest);
      return;
   }
   if (num == 3){ return (tree.view.selection.count>1)? alert("more than one row selected"): (!hData[tree.currentIndex][0])? alert("Last visit time is missing."): openUILinkIn( 'chrome://norwell/content/norwell.xul?a='+hData[tree.currentIndex][0], 'tab', false );}
   if (num == 4)
   {
      if (tree.view.selection.count>1){ alert("more than one row selected"); return;}
      var rcount=0;
      if (hData[tree.currentIndex][6]>0)
      {
         l=w=tree.currentIndex;
         for(var i = w; i > 0; --i)
         {
            if (hData[l][6]==hData[i][4])
            {
               l=i;
               tree.view.selection.toggleSelect(i);
               rcount++;
            }
         }
      }
      clearspan();
      createspan2(1,rcount);
      return;
   }
   if (num == 41)
   {
      if (tree.view.selection.count>1){ alert("more than one row selected"); return;}
      var e=u=tree.currentIndex;
      var h=hData.length-1;
      var rcount=0;
      for(var i = h ; i > 0; --i)
      {
         if (hData[e][4]==hData[i][6])
         {
            u=i;
            tree.view.selection.toggleSelect(i);
            rcount++;
         }
      }
      clearspan();
      createspan2(2,rcount);
      return;
   }
   if (num==5) { if (hData.length-tree.treeBoxObject.getPageLength()> 0) tree.treeBoxObject.scrollToRow(0);}
   if (num==6) { if (hData.length-tree.treeBoxObject.getPageLength()> 0) tree.treeBoxObject.scrollToRow(hData.length-tree.treeBoxObject.getPageLength());}
   if (num==8 && hData.length>0)
   {
      document.getElementById("goto_date").label="Open this time ("+tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(2)) +") in Norwell";
      dttx=tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(0));
      dutx=tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(1));
      if (dttx== null) dttx=" ";
      if (document.getElementById("keyword").value!='')
      {
         var rgx;
         for (var dp=0; dp < keob.length; dp++)
         {
            if (keob[dp][0] =="and" || keob[dp][0] =="kab" ) rgx=(rgx?rgx+"|":"")+keob[dp][1] + (keob[dp][2]?"|"+keob[dp][2]:"") + (keob[dp][3]?"|"+keob[dp][3]:"") + (keob[dp][4]?"|"+keob[dp][4]:"");
         }
         if (or!=null)
         {
            rgx=(rgx?rgx+"|":"")+or[1]+"|"+or[2];
            if (orvn = remvD(or[1])[0]) rgx +="|" + remvD(or[1])[0] + "|" + remvD(or[1])[2] + "|" + remvD(or[1])[3];
            if (orvn = remvD(or[2])[0]) rgx +="|" + remvD(or[2])[0] + "|" + remvD(or[2])[2] + "|" + remvD(or[2])[3];
         }
         rgx = rgx.replace(/(\.|\+|\$|\*|\^|\(|\)|\]|\[|\?|\\|\/)/g,'\\$1');
         var re = new RegExp("("+rgx+")", "gi");
      }
      createspan(dutx,1,re);
      createspan(dttx,0,re);
   }
   else
   {
      clearspan();
   }
   return;
}
function clearspan()
{
   var foo = document.getElementById("boxbox1");
   while (foo.firstChild) foo.removeChild(foo.firstChild);
   var foo = document.getElementById("boxbox2");
   while (foo.firstChild) foo.removeChild(foo.firstChild);
}
function createspan(string,x,re)
{
   var re=re;
   var foo = document.getElementById(x?"boxbox2":"boxbox1");
   while (foo.firstChild) foo.removeChild(foo.firstChild);
   var histr = re?string.replace(re,'<span>$1</span>'):string;
   var iMatch1 = histr.indexOf( "<span>" );
   var iMatch2 = histr.indexOf( "</span>" );
   do
   {
      if (iMatch1>-1 && iMatch1!=0)
      {
         createspan1(0,iMatch1,0,x,histr);
      }
      if (iMatch1 != -1 && iMatch2 != -1)
      {
         createspan1(iMatch1+6,iMatch2,1,x,histr);
      }
      else
      {
         createspan1(0,0,0,x,histr);
         var fff=1;
      }
      var histr = histr.substring(iMatch2+7);
      iMatch1 = histr.indexOf( "<span>" );
      iMatch2 = histr.indexOf( "</span>" );
   }while (iMatch1 != -1 && iMatch2 != -1)
   if (fff!=1)   createspan1(0,0,0,x,histr);
}
function createspan1(x,y,z,c,histr)
{
   var rtx=y?histr.substring(x, y):histr.substring(x);
   for (var zu=0; zu<=rtx.length; zu++)
   {
      var button = document.createElementNS("http://www.w3.org/1999/xhtml","span");
      button.setAttribute("style","-moz-user-select:text;"+(z?"background-color:yellow;":""));
      var textNode = document.createTextNode(rtx.substr(zu,1));
      var wbr = document.createElementNS("http://www.w3.org/1999/xhtml","html:wbr");
      button.appendChild(wbr);
      button.appendChild(textNode);
      document.getElementById(c?"boxbox2":"boxbox1").appendChild(button);
   }
}
function createspan2(y,x)
{
      var button = document.createElementNS("http://www.w3.org/1999/xhtml","span");
      button.setAttribute("style","-moz-user-select:text;");
      var textNode = document.createTextNode('total count of'+((y==1)?' referer/breadcrumbs ':' clicked links ')+': '+x);
      button.appendChild(textNode);
      document.getElementById("boxbox1").appendChild(button);
}

Last edited by pirst on January 4th, 2015, 6:55 pm, edited 2 times in total.
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

That seemed to work partially. Now when I open Norwell it will display my current days history. But it won't allow me to view other dates, change the date range, or double click on the headers to sort the list.
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

happyroot wrote:That seemed to work partially. Now when I open Norwell it will display my current days history. But it won't allow me to view other dates, change the date range, or double click on the headers to sort the list.

I updated above post. Try updating yours again.


P.S. Norwell history is not sortable. Never was.
edit updated once more without waiting for your reply
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

I applied the updated fix. How do I limited it by date range? I clicked enable set a date range then closed it and nothing happens. Then I tried setting a range and then using the upper search bar, but it seems to hang. Also sometimes when I try to search the progress bar with flash for a long period of time and nothing will be displayed. I thought the columns may have been sortable since when I tried to click them they posted an error. Thanks for all your help so far.
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

you select date range and then click search icon in search field or place cursor in search field and press enter.

Search time depends on your history size and query complexity.

It would be helpful if you post any errors from console with your corresponding actions.
happyroot
Posts: 9
Joined: January 4th, 2015, 4:18 am

Re: [EXT] Norwell history tools

Post by happyroot »

This is what happens when I try to use the search.

Code: Select all

TypeError: document.getElementById(...) is null historyQuery.js:226
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
no element found button_28:1
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

Is it when searching with limit panel enabled or simple keyword search or both?

try commenting out line 226 (thats the line in my code) - not sure if it's the same line in yours since you edited it:

Code: Select all

   //   if (document.getElementById("lt26").hasAttribute("selected") || document.getElementById("lt27").hasAttribute("selected") || document.getElementById("lt28").hasAttribute("selected"))range += " GROUP BY " + (document.getElementById("lt26").hasAttribute("selected")?" gtitle ":(document.getElementById("lt28").hasAttribute("selected")?" p.title ":" p.id "));


edit - I uploaded new version 2.2.4.6:
https://addons.mozilla.org/en-US/firefo ... /versions/
User avatar
pein0saga
Posts: 21
Joined: April 13th, 2011, 9:56 pm

Re: [EXT] Norwell history tools

Post by pein0saga »

Same with happyroot "When I open Norwell (chrome://norwell/content/norwell.xul) it displays nothing",and no toolbar icon and even no progress bar .
No chrome folder in norvel@history folder,only historyQuery.js import.js chrome.manifest ,a png , a rdf, 3 XUL files.
Eyesight and values conquer humans!
pirst
Posts: 206
Joined: January 2nd, 2008, 7:07 am
Contact:

Re: [EXT] Norwell history tools

Post by pirst »

There are no folders inside norvel@history.xpi - only 8 files. Icon is not displayed initially until you configure it - you have to drag it to your preferred location from customize menu/area.
Does it display any buttons? What about error console?
xola
Posts: 5
Joined: February 12th, 2015, 8:26 pm

Re: [EXT] Norwell history tools

Post by xola »

This really is a nice tool! :)

But is there any possibility to extend
VISIT TYPE
?

If i have an entry, i would like to know, which urls i visited before!
If "visit type" is "followed" a link, i would like to have
WHICH LINK(s).

So if i have an entry like this
http://imgur.com/EyYezyi
it says
"FOLLOWED A LINK"
But which one(s) ?!

That would be great!

Because i try to find a way to save a bookmark WITH previous VISITIED links
viewtopic.php?f=19&t=2913329&p=14028653#p14028653
Post Reply