I'm using the Moxie code TinyMCE text editor (http://www.tinymce.com/) for content entry on a number of sites. At the moment I have the tiny_mce folder sitting in the folder of each site. This means that I have lots of copies of the same .js files.
I think it would be better to have one copy of the tiny_mce folder and reference it for each site - so if I make a change, or upgrade the tiny_mce I only have to do it once. Also, if I make a new site I can reference the same one to save needing to upload or copy another 9Mb of duplicated files onto the server.
I have tried putting the tiny_mce into a folder outside the individual websites and setting it up as a site on localhost that they can see.
I then include the javascript from each site like this:
<script type="text/javascript" src="http://localhost/MCE/tiny_mce/tiny_mce.js"></script>
I'm pretty sure the the file can be found by the site - I've tested with a simple javascript alert box test which works fine - and if I "View Source" and check the link it's using, I can access the tiny_mce.js file - which is the correct file.
However, the tiny_mce doesn't work.
I'm guessing there are some kind of dependencies or configurations that I'm not aware of that are causing a problem, but I'm not sure quite where to start to find out what isn't working. (I don't get any errors, it just doesn't load the tiny_mce)
Has anyone managed to get tiny_mce to share it's source files across multiple sites? Does tiny_mce require the .js files to be inside the root folder of the site in order to work?
Has anyone managed to get tiny_mce to share it's source files across
multiple sites?
I have not tried it yet.
Does tiny_mce require the .js files to be inside the root folder of
the site in order to work?
No.
Depending on your server system and in case your different website files are stored on one physical server device you could use a hardlink or softlink to the shared tiny_mce_folder (which should be accessible from the net too).
Related
I create an HTML document using Sphinx. When I click on the index.html file it opens a browser and looks like this. The look depends on some .CSS and .JS files being executed:
If I open the same file from the JupyterLab file browser, it opens in a tab but looks much worse: .CSS and .JS are not displayed, and images are not displayed. It looks like this:
Is there a way to get JupyterLab to get JupyterLab to execute the .CSS and .JS and pass through any images linked in the text? The JupyterLab is running on a remote server, so I don't have the option of having it create a new browser process on my local machine, because the files are remote.
Using JupyterLab within JupyterHub (old school install with conda, no docker and such)
I've been stuck at this HTML Preview issue for a few weeks.
I have the very same use case as you (Sphinx stuff for a team to work on their docs).
So far, no luck.
It may or may not work (depending on... I'm not sure of...) if I'm using JupyterLab from the browser on the hypervisor hosting JupyterHub itself
It won't work if I'm using JupyterLab from the browser on my client machine.
I tried to mess around with
c.NotebookApp.allow_remote_access = True parameter with no luck
tried to put it in my profile ~/.jupyter/jupyter_notebook_config.py
tried to add it to general config file /path/to/conf/jupyterhub_config.py
=> Not sure of the right way to set this option on JupyterLab's JupyterHub install, nor if it's even a relevant option...
Well, security wise, it's not, that's a given (^^'), but Preview HTML is an important feature for Sphinx users, hope someone can help with this...
I also looked after nginx config, but you get the issue with or without the reverse proxy anyway...
Problem Description:
I have a problem at work where I should create a link to a html page which shows public data related to the customer.
www.example.com/content/user_123456/output.html
After I upload a user's data user_123456 folder to the /content/ directory.
style.css
main.js
The user_123456 folder contains linked styles and linked javascript
Expected Output:
When I load www.example.com/content/user_123456/output.html in a Web Browser I expect it to load the html page and the linked styles and javascript. Instead it shows me an error that indicates the directory is not visible.
Tested:
I have tried uploading images to the directory www.example.com/content/user_123456/image01.jpg and they load just fine in the browser so it can not be directory visibility problem.
I realise this is a broad question, but I want to estimate the technical cost of solving this problem and it would go a long way to understand the undertaking of such a solution.
Questions:
What is different about serving html files in comparison to jpg
files?
What needs to be done in a broad manner that the file functions the
way I expect it to?
I have these two files on my server:
/react/build/static/js/stats.js
and
/react/build/static/js/main.5c7483.js
In the stats.js file, it has this line at the bottom:
//# sourceMappingURL=main.8c33616f.js.map (I noticed the filename does not match)
The react app works fine, but I want to make some small changes. However, the developer has told me they completely lost the original source files due to a hard drive failure.
Is it possible to recover source files (or even anything that resembles source code?) I found this debundle package but couldn't get the configuration to work properly.
They told me the project was created using create-react-app.
In chrome dev tools, it says "Source Map Detected" - but using ctrl+p does not show any components. Just a few random js files like page.js, inject.js, common.js, etc
Well, this answer is late but just in case other people come here looking for answers (like me), here's how I solved it:
If you're lucky and the developers generated and uploaded the source maps then you shouldn't have any issue accessing the source codes.
I am not allowed to embed images yet so you may have to use the image links provided to see sample images.
Using Chrome(or any modern browser), browse to the website where the react app is hosted. Right-click anywhere on the page and select Inspect. Ctrl+Shift+I works too.
This will open up the dev tools window. Select the Sources tab.
Image showing the inspector tabs with the Sources option highlighted
Depending on the website's dependencies, you'll probably see several folders here. The first folder will be titled similar to the name of the website's URL. Open that up, that's where the sources for your website is located. Opening that folder will show yet another list of folders (assets, static, modules, react-components, src).
At this point, you may think your source codes are inside the src folder but that's not where yours are. To find yours, open up the static folder.
Selecting the static folder
This folder has three inner folders: css, js and node_modules. Your JS source files are inside the js folder so that's where to look for your source codes.
Image showing the expanded js folder
So that's it. I hope this helps. It definitely did help me when I needed it!
Here is the problem. The company I work for has a number of sites, and many of them use the same jQuery UI widgets, like datepicker. I would really like to have just one copy of each widget in an _javascript folder on the top level of the server. The problem is that because the code is outside of the site folder, I need to use ColdFusion mappings to point to it. Apparently you can't use these with script or link tags however. It doesn't expand the mapping. So I tried using "ExpandPath" and got a message that it doesn't have permission to access that resource. Some research turned up that JavaScript can't access files on local file systems because that would be a security hole. So, although it was ugly, I tried wrapping the CSS file in tags and the JS file in tags, and then included them with cfinclude. That worked- sort of. The main issue is that apparently the css uses relative links to link to the images used, and those are all broken because the JS is included on a page in another folder from the script and images themselves.
Here is my question. Is there any good solution here? I don't think that what I want to do is unreasonable, but should I give up and just keep a copy of the widgets in every site folder? Thanks in advance for any help.
Included javascript files, like CSS files, don't have to be touched at all by the ColdFusion processor. You just use ColdFusion to craft the link and feed it to the browser like you would any image, attachment, or link to another site. The only difference is that this link is in a <script tag. So if you have several sites and want to access a common /js directory on all of them the work has to be done in the web server itself (IIS/Apache).
In your web server of choice make a virtual directory (or symbolic link) to your javascript directory called /js (or whatever name you choose). Do this for all the sites, and you have one /js directory that is accessible from all the hosted domains.
My situation is that all our ColdFusion work is intranet only. While we only have a few sites, that is more than one. We also use a development server as opposed to having people develop on their hard drives.
The first thing we did was to create a mapping on "/" to point to a certain directory. Let's say that it's c:\fred. In c:\fred we have subdirectories named images, css, js, udf, etc. That allows us to do stuff like this:
<cfinclude template = "/Templates/Reportheader.cfm">
<link rel= "stylesheet" type= "text/css" href= "/css/cashflow.css" title= "style1">
<script type="text/javascript" src="/JS/browserDetect.js" ></script>
in any application.
I am a newbie, but I have spend the last 2 days reading so may things on this, and the more I read, the more confusing it gets. Not able to find one simple instruction or example to follow, or a simple and complete answer of this very important problem.
I simply want to include a common javascript file using src=. Then when I copy this tree to the server, I do not want to change anything in the code. I do not want to use relative path, since I do not want to edit the HTML file each time I change the tree layout. I want one solution that works when the tree is on the server, and also when it is locally on my PC during development.
I am not looking for something advanced or fancy. But a very simple solution. All what I want is to be able to use a common javascript file between all the HTML files I have in my tree.
The problem is that I do how to load it, since I can't use something like $HOME or ~ or an environment variable and so on, so that the same code works on my home PC, and also when I upload it to my personal web site.
To make it simple to answer this, I show the layout at my PC:
C:/public_html/common_files/common.js
C:/public_html/report/index.htm
On the server, say my site is called www.ABC.com, and I see, when I ftp to it, that there the public_html/ folder where I am supposed to put everything. So on the server, I created the same setup as above
/public_html/common_files/common.js
/public_html/report/index.htm
So far so good. Now the hard part.
How do I load common.js from index.htm file? I do not want to use src=../../common_files/common.js, why? Because I might want to change the layout of the tree, and if I move my report to another level, I do not want to edit it and keep changing the path and counting "../../../../.." etc..
I looked at many things, like ResolverURL but could not figure how to use it.
I tried
<script src="<%=Page.ResolveUrl("~/")%>public_html/common_files/common.js"></script>
But did not work. Remember, this has to work on the PC and on the server.
Here is my current index.htm.
<!DOCTYPE HTML>
<html>
<head>
<script src="../common_files/common.js"></script>
</head>
<body>
my site
</body>
</html>
To explain what I am looking for, assume for the moment that $HOME works in this env., which it does not offcourse, then I could have written
<!DOCTYPE HTML>
<html>
<head>
<script src="{$HOME}/common_files/common.js"></script>
</head>
<body>
my site
</body>
</html>
and this would have worked on the PC and on the server (well, at least it would work on a PC using linux). But the above is just an example of what I am looking for, on windows, I am not sure where $HOME is or how it is used if it is.
question: How to change the above src to load the common.js so that it works both on the PC and on the server but without using relative path?
Please do not give my more links to see, or partial answers, or ask me to download some commercial software to do this or complicated very advanced commands. This problem is so basic and the solution should be simple to follow.
By the looks of it, you seem to run your files locally on your PC. Try installing a server on your PC instead, to replicate the structure of your server. Something like XAMPP would do. On your server, the root of your domain would be the public_html. On a XAMPP setup, that would be the htdocs folder.
If you move files that much, then consider a location from the root of the domain, like a "styles" and "scripts" folder.
public_html/
'-- scripts/
'-- styles/
'-- everything else
Then load them with a leading /. The leading / means from the root of your domain.
<link href="/styles/your.css" type="text/css">
<script src="/scripts/your.js"></script>
<!-- similar to: -->
<link href="http://yourdomain.com/styles/your.css" type="text/css">
<script src="http://yourdomain.com/scripts/your.js"></script>
To prevent the comments turning into a very long conversation, I'll try to answer with some extra information.
Firstly, the term "absolute path" refers to the complete path of the file, as compared with the web root.
When you open files without an independant web server, the web root is the root of the drive you opened it from (in Windows this will usually start with the drive letter, but it can also just start with a slash).
This means, that unless you duplicate your entire drive to the hosting company (bad idea) you will usually need to run a web server to provide a web root that isn't the root of the file-system.
I understand that solutions such as XAMPP (which is awesome) are probably overkill if you only want to serve static pages (html, js, css, images etc.) that don't require any server-side processing, especially if you're running it on an aging laptop!
I've written (in Go) a very simple web server consisting of a single executable, around 3 or 4 MB in size, which will serve everything out of a folder named www on http://localhost by default. It also has command line switches to change the port from the default of 80, and to listen on more than just localhost. See http://github.com/Intermernet/ssws for details.
You can download the 64bit Windows version directly from https://github.com/Intermernet/ssws/blob/master/bin/windows_amd64/ssws_windows_amd64.zip?raw=true . If you require a 32bit version, tell me and I'll compile one for you, upload it and send you the link.
This should be saved somewhere on your local computer (Documents\WebDev or wherever) and then you just need to make a www folder in the same folder, and copy your website files into the www folder.
When you start (double-click) the exe file it will start serving your site files on localhost by default. If you don't want to start the server manually, put it in your Startup folder.
This will allow you to edit the files under the www folder and just refresh the browser to see the changes immediately.
Doing local web development without a local web server is possible, but has, as you've discovered, many pit-falls.
I hope you do manage to get this happening as I'd hate to see you lose faith or confidence in web development. These "sys-admin" tasks aren't really what programmers want to deal with, but sometimes they have to!
Also, when you get to the stage of trying to write dynamic server based code (PHP, Ruby, Python, Node.js etc.), you'll almost certainly need to ditch my simple server, and go with something like XAMPP.
Good luck!