Jump to content

User talk:JesseW/BookmarkletsUniversal

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Here's the Emacs regex's I used to make this: (Replace philburns address with the approprite site, of couse.)

Replace regexp ^\(.+\)\(javascript:.+\)QBREAKQ\(.+\)$ with: ====\1====
*<pre>
\2
</pre>
; Description : \3
; From : http://www.philburns.com/bookmarklets.html

To generate the data, I used a bookmarklet( ;-) ), which is here. If you have any questions, please ask me. JesseW 03:56, 4 Dec 2004 (UTC)

Putting each bookmarklet on one line (for sorting)

[edit]

Here's Emacs code I wrote to put each bookmarklet on one line.

(defun toggle-real-newlines () "Toggles newlines turning into fake newlines, and back." (interactive) 
(save-excursion (let ((fakenl "@This is a newline@")) 
  (beginning-of-buffer) (if (search-forward fakenl nil t) 
			    (progn (beginning-of-buffer) 
				   (replace-string fakenl "\n")) 
			  (progn (beginning-of-buffer) 
				 (replace-string "\n" fakenl))))))

(defun toggle-uniline-sections (replacement) 
"Makes everything into one line, divided by `replacement`. 

`replacement` should include %s, which is replaced with a real or fake newline as appropriate.  Uses toggle-real-newlines." (interactive "MReplacement: ") 
;; Written on Tue Dec  7 14:02:46 2004
  (save-excursion 
    (let* ((fakenl "@This is a newline@") 
	  (rep-real (format replacement "\n"))
	  (rep-fake (format replacement fakenl)))
      (beginning-of-buffer) 
      (if (search-forward fakenl nil t) 
	  (progn (beginning-of-buffer) (replace-string rep-real rep-fake)
		 (toggle-real-newlines))
	(progn (toggle-real-newlines)
	       (beginning-of-buffer) (replace-string rep-fake rep-real))))))

(defun toggle-uniline-universal-bookmarklets-page () 
;; Written on Tue Dec  7 13:49:10 2004 
"Makes each bookmarklet (and section title) into one line." (interactive)
(toggle-uniline-sections "%s==="))

Feel free to ask me if you have any questions about it. JesseW 22:10, 7 Dec 2004 (UTC)

Partial solution to getting subsimple's bookmarklets imported here

[edit]
(defun doit () "Function to organize stuff from subsimple. Sort-of-works." (interactive)
  (beginning-of-buffer)
  (replace-regexp " +<tr class='tablebody' valign='top' bgcolor='#002250'>" "BOOKMARKLET_BEGIN_QQ")
  (beginning-of-buffer)
  (replace-query-regexp " +<td><a name='.+'></a><b><span class='bmklname'>\(.+\)</span>" "BOOKMARKLET_NAME:\1")
  (beginning-of-buffer)
  (replace-string "\n    " " ")
  (beginning-of-buffer)
  (replace-regexp "<a href='\(.+?\)'.*?>\(.+?\)</a>" "[\1 \2]")
  (beginning-of-buffer)
  (replace-regexp "</b><br>\n" "</b><br>")
  (beginning-of-buffer)
  (replace-regexp "</b><br>" "\nBOOKMARKLET_DESCRIP:")
  (beginning-of-buffer)
  (replace-regexp "<span support=\".+?\">" "\nBOOKMARKLET_CODE:")
  (beginning-of-buffer)
  (replace-regexp "<a href=\"javascript:\(.+\)\">.+" "REALCODE: javascript:\1")
  (beginning-of-buffer)
  (replace-regexp "^[\n ]+$" "")
  (beginning-of-buffer)
  (replace-string "\n\n" "\n")
  (beginning-of-buffer)
  (replace-string "BOOKMARKLET_CODE:\n" "BOOKMARKLET_CODE:")
  (beginning-of-buffer)
  (replace-regexp "^[^A-Z].+$" "") ;; delete any lines not beginning with A-Z
  (beginning-of-buffer)
  (replace-string "\n\n" "\n")
  (beginning-of-buffer))

This is mainly just saved here for my convinence.