.net 3d art blog c# coding college computers editorial entertainment firefox food freeware gaming hardware hdtp hiking humor ide japan japan, javascript linux mac mailbox milestone misc. mods momoiwa, mono movie nintendo philosophy php politics rant rebun review science software technology test time ucr wakkanai windows work wormholeftp 日本
I finally figured out a round-about way of disabling FKCEditor plugins based on the page the editor is being used on. As I mentioned earlier, I installed an autosave function that will preserve my new posts until I post them onto the front page; the problem I was having was that if I wanted to edit an existing post, the AutoSave would save that post's content over the saved new-post's content. What I needed to do was disable the auto-save script on the Edit Post page.
It turned out to be a fairly easy solution. Basically, I grab a GET variable related to the current page's function from the page's URL and load the AutoSave only when that variable is set to a specific value. On any other page (i.e. the Edit Post page), the auto-saver is not loaded. In the case of this blog, it was a rather small bit of code:
var windowCode = parent.window.location.href.split('specific_GET_variable=')[1] .split("&")[0]; //(multi-lined because it broke the layout) if(windowCode == 1) { //Load Plugin }
I have to call parent.window because FCKEditor is loaded into a frame. I also learned that if I want to grab the current page's URL as a string, I need to call window.location.href as opposed to simply calling window.location; window.location is an object, and it contains much more information than just the URL. After grabbing the URL, I split the string into an array using the GET variable I want to read as the point where I want the string divided into separate array elements. Then, I perform another split on the second element of the first array. The second split is performed to single out any other GET variables that may appear in the page's URL. I can then grab the value of the desired GET variable, which is stored in the first array element of the second split.
It's a simple yet elegant solution, if I do say so myself :P