0

I'm having a lot of trouble with JavaScript elements in themes. All of my CSS is loading correctly, but my JavaScript doesn't seem to be.

I'm working with a combination of resource JS files uploaded as resources to the Database, JavaScript script libraries, server-stored JavaScript files, and Javascript files at http locations.

I've tried setting content-type to application/x-javascript, but that doesn't seem to work. Anything uploaded as a file resource I'm able to include by omitting the content-type, but if I add the content-type, it becomes invalid.

Example:

<resource>
    <href>anytime.js</href>
</resource>

Will show up as /anytime.js"> when the page renders, but

<resource>
    <content-type>application/x-javascript</content-type>
    <href>anytime.js</href>
</resource>

doesn't render anything.

Additionally, trying to access something remote, like http://code.jquery.com/jquery-1.7.1.js doesn't work either way. Both omitting the content type and setting it to application/x-javascript result in nothing rendering to the browser. I'm hoping someone will be able to help me out with this one.

4

2 回答 2

2

This is an attempt you answer your question on auto-formatting that you ask in your own answer. So this is not an attempt to answer the original question.

Yes, you can control what auto-formatting does.

For instance, you can control the XML editor auto formatting in Domino Designer Preferences under XML - XML Files - Editor. This controls XPages, custom control, themes and faces-config editing. Here you can control line width and whether to split multiple attributes each on a new line.

You can also control Java formatting in Domino Designer Preferences under Java - Code Style - Formatter. Here you can edit the existing profile or create your own profile and edit that.

I am sure there are several other places in Preferences that could be useful. Lessons learned is that whenever auto-formatting does something, you can change its behaviour.


Have a look at Nathan Freemans "Making Domino Designer work like you want" for more useful stuff that you can change in Preferences.

于 2013-06-18T18:31:53.343 回答
1

好的,所以,经过更多的测试和挫折,我弄清楚了这里发生了什么。输入代码后,我正在执行 ctrl+alt+F 来自动格式化代码,以便缩进保持一致。这导致结束标签 for 出现在第二行,如下所示:

<resource>
    <href>URL
    </href>
</resource>

如果我尝试像这样渲染它,它不起作用。因此,这不是 css 与 js 的问题,而是文件长度的问题。虽然这确实让我想知道是否有任何方法可以更改自动格式的行长阈值设置?

于 2013-06-18T15:57:07.837 回答