djplaner / Content-Interface-Tweak

Improves both the task of creating content for Blackboard Learn, and reading that content.
https://djplaner.github.io/Content-Interface-Tweak/
GNU General Public License v3.0
0 stars 0 forks source link

Automate the page update process via a user script #33

Open djplaner opened 3 years ago

djplaner commented 3 years ago

The page update process is bit too manual for most. AUtomate it. User script - tampermonkey etc.

djplaner commented 3 years ago

Find other examples

Search greasy fork etc.

Google search

TinyMCE documentation

Experiment from console in Bb - WORKING!!!

tinymce.activeEditor.getContent()
"<p>Hello there.</p>"
tinymce.activeEditor.setContent("<p>I hope this works</p>")
"<p>I hope this works</p>"
djplaner commented 3 years ago

Experiment with userscript

djplaner commented 3 years ago

Plan

  1. User script only matches the manageCourseItem link
    1. The click on conversion page is required to copy to clipboard
  2. Looks for a parameter CI_update set to true and/or presence of GU_ContentInterface in clipboard, if there
    1. sets tinymce content to clipboard content
    2. hits the submit button

Status

Updating tinymce. But waitForKeyElements is required to wait for tinymce to load. Once in there, can't access the broader document - stuck in the iframe - and thus can't hit the submit button.

jQuery doesn't work. COuldn't get parameter passing working.

Can we pass a signal?

djplaner commented 3 years ago

Status

Figure out modifying TinyMCE. But can't use the clipboard to get the data to paste.

Plan

Problem

localstorage is not accessible across domain