Author Topic: Where is the Javascript generated?  (Read 5051 times)

Offline Nathalie

  • Newbie
  • *
  • Posts: 2
Where is the Javascript generated?
« on: November 16, 2012, 05:45:34 AM »
I was trying to find out where the Javascript in the source of a webpage of RoundCube is generated but I can't find where this part of JS is generated:

Code: [Select]
<script type="text/javascript">

// UI startup
var UI = new rcube_mail_ui();
$(document).ready(function(){
UI.set('errortitle', 'An error occurred!');
UI.init();
});

</script>

The include statements for external Javascript files are generated in rcube_template.php line 90+.
The other JS in the source is generated in rcube_html_page.php +- line 200+.

I expected that those lines in rcube_template.php (before line 90) would add it:
Code: [Select]
// add common javascripts
        $this->add_script('var '.JS_OBJECT_NAME.' = new rcube_webmail();', 'head_top');

        // don't wait for page onload. Call init at the bottom of the page (delayed)
        $this->add_script(JS_OBJECT_NAME.'.init();', 'docready');

But when I comment them (just for testing) they don't disappear from the source so I think it's not the correct spot.

Can anyone tell me where it comes from?

I'm using version 0.8.2

Greetings,
Nathalie

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: Where is the Javascript generated?
« Reply #1 on: November 16, 2012, 06:20:27 AM »
Its in <RC root>/skins/larry/includes/footer.html out of curiosity why do you want to find that block of js?

Offline Nathalie

  • Newbie
  • *
  • Posts: 2
Re: Where is the Javascript generated?
« Reply #2 on: November 16, 2012, 07:56:26 AM »
Thanks!

I'm doing my master thesis for which I have to develop a CSP-plugin for a framework. First step is to retro-fit an existing web application to add CSP support. But CSP doesn't allow inline javascript (together with other things). So right now I'm trying to remove all inline javascript which is quite a challenge.

More on Content Security Policy: http://www.w3.org/TR/CSP/

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: Where is the Javascript generated?
« Reply #3 on: November 16, 2012, 07:42:53 PM »
Very interesting, I'm sure some people would be interested in being able to do that with RoundCube.