Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim C 161 posts 528 karma points
    Aug 25, 2016 @ 08:25
    Tim C
    0

    Run my own javascript in back end

    Following on from an earlier question of mine : is it possible to add javascript to the back end that runs when a user opens a document for editing?

  • David Peck 687 posts 1863 karma points c-trib
    Aug 25, 2016 @ 10:57
    David Peck
    1

    Adding in your own JavaScript is easy, but the tricky bit is detecting a document opening. I'm not aware of any such event that fire. You could create a property editor on the pages in question or you could just have a setInterval() running that detects a new edit state either by inspecting the DOM or the URL. This might help?

  • Tim C 161 posts 528 karma points
    Aug 25, 2016 @ 10:59
    Tim C
    0

    Would $(document).ready() not work - not aware, I suppose, of Angular having finished all its stuff.

  • David Peck 687 posts 1863 karma points c-trib
    Aug 25, 2016 @ 11:03
    David Peck
    0

    That will run when the entire page loads, but that doesn't happen when you select a new item to edit.

    What are you trying to do with your JavaScript? It's possible there is a better solution.

  • Tim C 161 posts 528 karma points
    Aug 25, 2016 @ 11:07
    Tim C
    0

    Basically, it's related to a question I posted earlier about making the back-office document editing screen lay out the fields in the same fashion as the published front-end page by using javascript to fetch the template (using a web service perhaps) and then moving properties or injecting css with jQuery so the editor sees the editing screen looking as close as to the actual final page view as possible.

    Not intending to change the editing at all, simply where the properties are laid out, and possibly injecting some new dom elements.

  • David Peck 687 posts 1863 karma points c-trib
    Aug 25, 2016 @ 11:33
    David Peck
    0

    The ordering in the document type isn't working? I think v.7.5 has some bug fixes for were it wasn't working so that might solve it. Otherwise polling with setInterval() should work.

Please Sign in or register to post replies

Write your reply to:

Draft