Success - Part 2
A big disclaimer: What I am about to describe, you have to use this at your own risk. This could compromise the security of your system, so only try this if you are the risky type or know what you're doing. I am also a big novice at all this, so I may also be using very round-a-bout, inefficient, insecure, etc. means to achieve this. I hope others may either direct me to better solutions if there are any (as long as they are sufficiently powerful and sufficiently simple) as well as expand the ideas and implementations. This is mostly a proof-of-concept experiment (with hopefully some interim utility), though I do hope I can gradually make more secure and powerful versions.
So, continuing from my last post, in order to allow the user the freedom to choose to add notation alongside even specific columns of tabular data (I'm still working on the for-some-reason more difficult task of getting frames to work with having just one column successfully added alongside ANY webpage, with or without tabular data--the files I have been working on are here (the Javascript), here (the main PHP processing file) and here (an additional file I was not sure was necessary or not to facilitate loading of the data into the new frame/iframe), I developed this Javascript (visit the page then select all to copy the code). This code will not do anything successfully at this point. In this code, you will need to edit it to be able to work on your computer. Find the line "/Users/Brett/Sites/textarea/" in the Javascript above (you can copy the link then edit it in a text editor before pasting it into your bookmarks--it's handy to have on your bookmarks toolbar, if nothin else in a drop-down menu--I use one for all my Javascript bookmarklets) and then replace it with the base folder where you wish your notes to be saved (actually where the folders will be saved where your notes will be stored). You could just replace "Brett" with your user folder's name.
You will also need to have a number of items installed first for this to work (I have only implemented it on a Mactinosh OS 10.4, using the Firefox browser (see my sidebar to get it)). You will need to have PHP installed (the shareware "PageSpinner" has good instructions on how to do this) and Personal Web Sharing enabled on your computer (in Mac System Preferences under "Sharing"). You will also need to load this PHP file into the directory described above (For testing, you could also try this file as it is an HTML file with the Javascript already built in, and has a few more comments about my design of the script).
Once you have these items in place, you should be able to visit a website with tables (it seems to only work with simple tables... try http://bahai-library.com/browse0.php and choose a small range of paragraphs from one of the books in the list (e.g., paragraphs 5 to 10 of the Kitab-i-Aqdas) and then run the javascript (called a bookmarklet) you copied and edited by placing it, after you have loaded the page with tabular data, in the URL window and hitting return. This will run the script against the current webpage. It should then add a column to the table with cells at the right-most end of each row which will allow you to store and save notes corresponding to that paragraph. Just type some notes and save them (for each cell you add data, click the "save" button in its window). They will persist there the next time you run the script on the same URL
One big disadvantage at this time is that the script only stores a folder for the exact URL (converting slashes into + signs since slashes are not allowed in Mac folder names) and doesn't intelligently sense out the data you are using. For example, if you do another search (let's say paragraphs 3-8 of the same book), it will start a new folder for these notes (since the URL is different for such a browse request), even though you are referring to some of the same contents. So, if you want to see these notes again, you will need to come back to the exact URL. At least this will in fact keep your notes there.
I do hope to add intelligent storage (e.g., using Javascript with specified wildcards to realize that a slightly different URL will still apply to the same book and then perhaps detect whether the number in the paragraph cell is the same as one already in storage). And as mentioned before, I also hope to create a script to just add one simple large textbox which could appear alongside any webpage. Ideally, I could also develop a Greasemonkey script which would determine whether this bookmarklet should be automatically run on websites that one wishes to use them for.
Although it is presently a little complicated, I think that this approach has a number of advantages (though I admit I am not familiar enough with dealing with its potential security risks--i.e., in mixing local content with web content--but I'm sure this can be surmounted in some way, since it is too powerful an opportunity to avoid by simply accepting this division as a unsacrificeable sacred cow). I also know that there are some Javasript tools to directly manipulate the file structure, but it is complicated for me (I just discovered this which apparently makes it easier for PHP users, but still).
The advantages of this overall approach of saving personal notes as individual files and folers into the file hiearchy include:
1) Allowing the user the ability to add notation even when the site's developer did not allow for this (and the notes can be stored locally rather than publicly if one is concerned about privacy, even for password-protected sites)
2) One could conceivably expand the features of this script to not only be able to save the notes, but actualy email them from the same interface, save the notes as a webpage, add categories (such as through a pop-up menu), add tasks (such as through a WYSIWYG Javascript expandable add an infinite number of tasks/calendar events pertaining to the textbox in question--this would be useful to store one's goals pertaining to a particular sacred verse, but also view it in one's task manager/calendar--ideally also a Mozilla product integrated into Firefox, as such a calendar-integrated-into-the-browser product is intended to be released in a future Firefox edition as I recall reading), etc. I desperately hope someone will answer my question here to allow us to transclude wiki pages here without all the extra sidebar junk (just converting the wiki code into formatted content (or getting a WYSIWYG one to work in these windows instead) and only adding back a few important links like "edit"/"save" and forward and backward links for the individual iframe (the main back/forward buttons on the browser will trace the exact sequence, and not allow tracing the sequence for an individual window--it may also bump one out of the framed setting entirely--note: Mediawiki servers must be manualy configured to allow frames--I have the webpage stored somewhere if anyone needs it). One could even have the PHP script write and open an Applescript to interface this data to send it to other scriptable programs such as an Instant Messaging program (though I hope fully open source programs can be made to work with it, especially within Firefox itself without needing the proprietary, albeit system-included Applescript).
3) One of the coolest advantages of this approach is that, especially using some of the extensions I mentioned in an earlier blog posting (which allow viewing the folder contents while also viewing the files themeslves--if HTML, images, text, PDF, etc.), one can use Firefox as a file browser. Thus, these notes that one is storing will also be accessible as individual files (as well as corresponding to individual files--you could even take notes about your notes!). In the future, I hope even better extensions may be developed for Firefox which allow convenient file browsing and previewing/editing (e.g., column/list-tree/icon views for websites and local files through Firefox itself--i.e., everything that Mac OSX can do and more!). Thus, if one saves other files in these URL-specific directories, one can choose to view all of one's files together. No more developing a category hierarchy separately for one's emails, for one's webpages, and for one's notes, etc. One can simply opt to view all of them together (and if good sorting options become available--some Javascript bookmarklets actually works when one browses the local file structure in Firefox--one of the most useful is to Sort tables--perhaps one could be developed to detect what type of data was being stored, and even add columns to indicate what type of file it is intended to be--e.g., an email, note, etc.--as it is now, you will notice that these comment fields can even be added to files--thus, one could take notes alongside one's specific files and view them later). Thus, one should be able to selectively view the fields (automatically (through Greasemonkey?) if, for example, one is choosing to only browse emails at the time) though one could also view all the data types together (if Greasemonkey's built-in wildcard search patterns are too simplistic, one could perhaps design a Javascript to run against all websites to make the determination itself as to whether the add-notes bookmarklet should be run against it).
4) If MySQL could be made to automatically store all files stored to this program-set's directory and subdirectories whenever a change was made (is this the support for "events" that I remember reading newer versions of MySQL support?), one could then design a PHP front-end to allow the user to perform sophisticated searches and sorts on these notes, categories, etc. (or other files stored in this hierarchy--potentially all files on one's hard-drive, I hope?!?) one had assigned to particular websites. Ideally, one could also use this to store information not pertaining to specific websites (though one could ideally also assign data after-the-fact to be cross-listed with the URL-sorted data).
The goal of all of this is to provide a fully open source (Firefox/XUL, PHP, Javascript) means of creating not only a cross-platform expandable web browser, but also file browser--one which might even be a bridge for those wishing to support and take advantage of full open source, but not (yet) willing to switch to Linux (and unlike Linux, as I understand it, Mozilla applications have not significantly forked away into being mutually incompatible). Rather than waiting or hoping for Apple or Microsoft to add the feature to one's desktop browser, this could, I imagine, perhaps be a powerful means to do so, only limited by one's familiarity with the above, fairly easy-to-learn-at-a-basic-level technologies, and one's imagination.
Please let me have any comments, especially if you decide to try this out (or if you are a developer and can anticipate problems, etc.).
So, continuing from my last post, in order to allow the user the freedom to choose to add notation alongside even specific columns of tabular data (I'm still working on the for-some-reason more difficult task of getting frames to work with having just one column successfully added alongside ANY webpage, with or without tabular data--the files I have been working on are here (the Javascript), here (the main PHP processing file) and here (an additional file I was not sure was necessary or not to facilitate loading of the data into the new frame/iframe), I developed this Javascript (visit the page then select all to copy the code). This code will not do anything successfully at this point. In this code, you will need to edit it to be able to work on your computer. Find the line "/Users/Brett/Sites/textarea/" in the Javascript above (you can copy the link then edit it in a text editor before pasting it into your bookmarks--it's handy to have on your bookmarks toolbar, if nothin else in a drop-down menu--I use one for all my Javascript bookmarklets) and then replace it with the base folder where you wish your notes to be saved (actually where the folders will be saved where your notes will be stored). You could just replace "Brett" with your user folder's name.
You will also need to have a number of items installed first for this to work (I have only implemented it on a Mactinosh OS 10.4, using the Firefox browser (see my sidebar to get it)). You will need to have PHP installed (the shareware "PageSpinner" has good instructions on how to do this) and Personal Web Sharing enabled on your computer (in Mac System Preferences under "Sharing"). You will also need to load this PHP file into the directory described above (For testing, you could also try this file as it is an HTML file with the Javascript already built in, and has a few more comments about my design of the script).
Once you have these items in place, you should be able to visit a website with tables (it seems to only work with simple tables... try http://bahai-library.com/browse0.php and choose a small range of paragraphs from one of the books in the list (e.g., paragraphs 5 to 10 of the Kitab-i-Aqdas) and then run the javascript (called a bookmarklet) you copied and edited by placing it, after you have loaded the page with tabular data, in the URL window and hitting return. This will run the script against the current webpage. It should then add a column to the table with cells at the right-most end of each row which will allow you to store and save notes corresponding to that paragraph. Just type some notes and save them (for each cell you add data, click the "save" button in its window). They will persist there the next time you run the script on the same URL
One big disadvantage at this time is that the script only stores a folder for the exact URL (converting slashes into + signs since slashes are not allowed in Mac folder names) and doesn't intelligently sense out the data you are using. For example, if you do another search (let's say paragraphs 3-8 of the same book), it will start a new folder for these notes (since the URL is different for such a browse request), even though you are referring to some of the same contents. So, if you want to see these notes again, you will need to come back to the exact URL. At least this will in fact keep your notes there.
I do hope to add intelligent storage (e.g., using Javascript with specified wildcards to realize that a slightly different URL will still apply to the same book and then perhaps detect whether the number in the paragraph cell is the same as one already in storage). And as mentioned before, I also hope to create a script to just add one simple large textbox which could appear alongside any webpage. Ideally, I could also develop a Greasemonkey script which would determine whether this bookmarklet should be automatically run on websites that one wishes to use them for.
Although it is presently a little complicated, I think that this approach has a number of advantages (though I admit I am not familiar enough with dealing with its potential security risks--i.e., in mixing local content with web content--but I'm sure this can be surmounted in some way, since it is too powerful an opportunity to avoid by simply accepting this division as a unsacrificeable sacred cow). I also know that there are some Javasript tools to directly manipulate the file structure, but it is complicated for me (I just discovered this which apparently makes it easier for PHP users, but still).
The advantages of this overall approach of saving personal notes as individual files and folers into the file hiearchy include:
1) Allowing the user the ability to add notation even when the site's developer did not allow for this (and the notes can be stored locally rather than publicly if one is concerned about privacy, even for password-protected sites)
2) One could conceivably expand the features of this script to not only be able to save the notes, but actualy email them from the same interface, save the notes as a webpage, add categories (such as through a pop-up menu), add tasks (such as through a WYSIWYG Javascript expandable add an infinite number of tasks/calendar events pertaining to the textbox in question--this would be useful to store one's goals pertaining to a particular sacred verse, but also view it in one's task manager/calendar--ideally also a Mozilla product integrated into Firefox, as such a calendar-integrated-into-the-browser product is intended to be released in a future Firefox edition as I recall reading), etc. I desperately hope someone will answer my question here to allow us to transclude wiki pages here without all the extra sidebar junk (just converting the wiki code into formatted content (or getting a WYSIWYG one to work in these windows instead) and only adding back a few important links like "edit"/"save" and forward and backward links for the individual iframe (the main back/forward buttons on the browser will trace the exact sequence, and not allow tracing the sequence for an individual window--it may also bump one out of the framed setting entirely--note: Mediawiki servers must be manualy configured to allow frames--I have the webpage stored somewhere if anyone needs it). One could even have the PHP script write and open an Applescript to interface this data to send it to other scriptable programs such as an Instant Messaging program (though I hope fully open source programs can be made to work with it, especially within Firefox itself without needing the proprietary, albeit system-included Applescript).
3) One of the coolest advantages of this approach is that, especially using some of the extensions I mentioned in an earlier blog posting (which allow viewing the folder contents while also viewing the files themeslves--if HTML, images, text, PDF, etc.), one can use Firefox as a file browser. Thus, these notes that one is storing will also be accessible as individual files (as well as corresponding to individual files--you could even take notes about your notes!). In the future, I hope even better extensions may be developed for Firefox which allow convenient file browsing and previewing/editing (e.g., column/list-tree/icon views for websites and local files through Firefox itself--i.e., everything that Mac OSX can do and more!). Thus, if one saves other files in these URL-specific directories, one can choose to view all of one's files together. No more developing a category hierarchy separately for one's emails, for one's webpages, and for one's notes, etc. One can simply opt to view all of them together (and if good sorting options become available--some Javascript bookmarklets actually works when one browses the local file structure in Firefox--one of the most useful is to Sort tables--perhaps one could be developed to detect what type of data was being stored, and even add columns to indicate what type of file it is intended to be--e.g., an email, note, etc.--as it is now, you will notice that these comment fields can even be added to files--thus, one could take notes alongside one's specific files and view them later). Thus, one should be able to selectively view the fields (automatically (through Greasemonkey?) if, for example, one is choosing to only browse emails at the time) though one could also view all the data types together (if Greasemonkey's built-in wildcard search patterns are too simplistic, one could perhaps design a Javascript to run against all websites to make the determination itself as to whether the add-notes bookmarklet should be run against it).
4) If MySQL could be made to automatically store all files stored to this program-set's directory and subdirectories whenever a change was made (is this the support for "events" that I remember reading newer versions of MySQL support?), one could then design a PHP front-end to allow the user to perform sophisticated searches and sorts on these notes, categories, etc. (or other files stored in this hierarchy--potentially all files on one's hard-drive, I hope?!?) one had assigned to particular websites. Ideally, one could also use this to store information not pertaining to specific websites (though one could ideally also assign data after-the-fact to be cross-listed with the URL-sorted data).
The goal of all of this is to provide a fully open source (Firefox/XUL, PHP, Javascript) means of creating not only a cross-platform expandable web browser, but also file browser--one which might even be a bridge for those wishing to support and take advantage of full open source, but not (yet) willing to switch to Linux (and unlike Linux, as I understand it, Mozilla applications have not significantly forked away into being mutually incompatible). Rather than waiting or hoping for Apple or Microsoft to add the feature to one's desktop browser, this could, I imagine, perhaps be a powerful means to do so, only limited by one's familiarity with the above, fairly easy-to-learn-at-a-basic-level technologies, and one's imagination.
Please let me have any comments, especially if you decide to try this out (or if you are a developer and can anticipate problems, etc.).
0 Comments:
Post a Comment
<< Home