Commits

Anonymous committed f321df6

back to bookmarklet approach for trx export with ids
- can't figure out user.js security model

  • Participants
  • Parent commits a4389fd

Comments (0)

Files changed (2)

mint-gdocs-bookmarklet.html

 <body>
 <h1>Toward Mint/Google Docs Sync</h1>
 
+<ul>
+  <li>
 <a href='javascript:(function(){var s=document.createElement("script"); s.src="http://0.0.0.0:8000/quacken/mint_gdocs.js"; document.body.appendChild(s);})();'>budget sync bookmarklet</a>
+</li>
+<li>
+<a
+  href="javascript:(function(){var D=document, s=D.createElement('script'); s.src='http://0.0.0.0:8000/quacken/mint_iwmdb.user.js'; D.body.appendChild(s);})();">IWMDB</a>  (<a href="mint_iwmdb.user.js">source</a>)
+</li>
+</ul>
 
 <p>cribbed from <cite><a href="http://www.hunlock.com/blogs/Bookmarklets_--_The_Evil_Lurking_In_Your_Browser">Bookmarklets -- The Evil Lurking In Your Browser</a></cite> of Feb 2007</p>
 

mint_iwmdb.user.js

 
 // http://wiki.greasespot.net/Content_Script_Injection
 // http://userscripts.org/scripts/source/100842.user.js
-function contentEval(source) {
-  // Check for function input.
-  if ('function' == typeof source) {
-    // Execute this function with no arguments, by adding parentheses.
-    // One set around the function, required for valid syntax, and a
-    // second empty set calls the surrounded function.
-    source = '(' + source + ')();'
-  }
-
-  // Create a script node holding this  source code.
-  var script = document.createElement('script');
-  script.setAttribute("type", "application/javascript");
-  script.textContent = source;
-
-  // Insert the script node into the page, so it will run, and immediately
-  // remove it to clean up.
-  document.body.appendChild(script);
-  document.body.removeChild(script);
-}
+// function contentEval(source) { ...
 
 function iwmdb(id) {
+    alert(location.href);
     var tl_elt = document.getElementById(id);
     var btn = document.createElement('button');
-    btn.textContent='IWMDB';
+    btn.textContent='IWMDB @@';
     tl_elt.parentNode.appendChild(btn);
     btn.addEventListener("click", function(event) {
-	contentEval( function() {
-	    var tl = new $MW.TxnList("transaction-list",
-				     {prefix: "transaction-"});
-
-            $MC.useJson(C.JSON_TRANSACTIONS, function (trxs) {
-                tl.setItemsData(trxs);
-		alert('transaction data: ', trxs);
-		alert('transaction data length: ', trxs.length);
-            });
-	});
+        alert('IWMDB!');
+        alert('$MW: ' + $MW);
     });
 }