I am curious about saving space and real time editing code. Google docs don't take up any space, so I'm curious to see if it's possible, and with that there could be extentions that color code Google docs? And i want to stay off saying i know this is a funky way to do it but I'm curious to see if it's possible.
The way I imagine it working is like this:
Google doc
If you look at the document, you see that it is named "script.js" and the text inside is printing hello world.
So then in the html page it could be something like
<script type=text/javascript src="https://docs.google.com/document/d/1-SCNoJSQlMGJh-hmBLIwlyh_4eM9IisJqspARMMNKg0?plaintext"></script>
(or plainhtml)
I have honestly no idea what the syntax could be of how to do it, but i hope i can get the point across.
And then for Google sheets, it could be something like
<script type=text/javascript src="https://docs.google.com/spreadsheets/d/1-cUUw0KJ8k87hTrPWhERRNyr8r-_hZn5tW5sbPsSiLc?plaintext&c=a&r=1"></script>
That would retrieve "hello world" from the Google sheet.
You could also go as far as doing this in the main html page:
<script type="text/javascript">
var sheet = "https://docs.google.com/spreadsheets/d/1-cUUw0KJ8k87hTrPWhERRNyr8r-_hZn5tW5sbPsSiLc"
// then getting the spot (c,4) where column is "c", and row is "r".
Document.write(sheet+"?c=c&r=4");
</script>
Any ideas?
Edit
It looks like the only way to get the raw text of the google doc would be to use the Drive API. But this is no good for your use case as it must be authenticated even when the file is publicly accessible. Leaving the possible awkward solution of downloading the file with JavaScript, and converting the text into functions.
Looks like this might be possible. However you will have to convert the doc from a editable state to a raw text state. You can take a look at this link for more info on that:
The URL for a document's raw text? (outdated)
But why not just use GitHub to host the code? (or other code oriented services) Github will even host your entire website (with restrictions).
If you looking for code collaboration Google docs is horrible for code formatting. I might point you towards this question for options other than Google Docs.
For Google sheets as a database That might be more feasible. I might take a look at this link. But now there are several free tier database as a service platforms with much richer features. (for databases)
In the end it might be a cool hack but ultimately painful for real use cases when compare to alternatives.
Related
I am just wondering if Google or other search engines execute JavaScript on your web page. For example, if you set the title tag using JavaScript, does the Google search engine see that?
There have been some experiments performed for SEO purposes which indicate that at least the big players (Google, for example) can and do follow some simple JavaScript. They avoid sneaky redirects and such, but some basic content manipulation does seem to get through. (I don't have a link handy for Google themselves confirming or denying this, it's just various posts I've come across when dealing with this before.)
However, this is generally considered unreliable. If SEO is being done for any important purpose, don't rely on the spiders indexing much dynamic content.
There's actually a very good (in my opinion, anyway) answer here to a very similar question. What I like about that answer is how it breaks down the steps for generating good, indexable, and best of all maintainable web pages with concerns properly separated. Adhering as much as possible to this process generally results in good SEO, good accessibility, and good design skills in general.
Yes, Google executes Javascript. How much is a moving target.
Google executed some Javascript as early as 2011: http://searchengineland.com/google-can-now-execute-ajax-javascript-for-indexing-99518
This article from 2012 documents some experiments on what Javascript Google did and did not run at the time: http://moz.com/ugc/can-google-really-access-content-in-javascript-really
In May 2014, Google said publicly that they execute Javascript: http://googlewebmastercentral.blogspot.com/2014/05/understanding-web-pages-better.html Although that post says that Google has been getting better, there are no publicly available details on what Javascript Google does and does not execute -- but presumably they are at least as good at it as they were in 2012.
I'm pretty sure they dont. However, you can see for yourself: google have a tool which will show you your page as it sees it as http://www.google.com/webmasters/
if the text is in the onpage javascript, google will see the text. but it will not be seen as the text of the title element.
but hey, this is quite easy to test. just do it. wait two days. if you then google your site with site:.... look whats in the headline. if it's in there then the answer is yes: google sees it, if not: no google doesn't. it's easily testable.
(p.s.: my money is on: no)
We need to remember that JavaScript is client-side language, and always start executing from client-side. If all of titles or contents are via javascript then it'll be output from client-side, and I doubt it'll show up on Google search (meanwhile if outputted on .html, then yes).
If I am correct as of latest, meta tags are "fuel for search-engine", and it have ties to SEO, where it is common robots to be scripted to crawl on your site.
I'm trying to extract the content of a PDF to obtain the equivalent HTML.
I'm using Nodejs to do so (it's a telegram bot).
I googled for a while and I've been able to find only HTML to PDF things like using poppetteer and similar. Do you know something that does the exact reverse thing?
Ty in advance.
Have a look at pdfjs-dist.
I haven't used that library, but it seems to be the one to take you a bit closer to your objective. Also, as you probably already know, a PDF can contain anything: scanned text, photos, drawings, what not.
It is probably impossible to have a library that is able to extract all the info a human can extract from a PDF.
I'm using the IMPORTXML function on google sheets to import the latest visa numbers from the Canadian government however I can import everything on the web page apart from the data/numbers which I think could be down to JavaScript.
I simply just need to find a way to pull that data into the spreadsheet but I'm not experienced with JS.
Here's the website and here's my query:
=IMPORTXML("https://www.cic.gc.ca/english/work/iec/selections.asp?country=au&cat=wh",
"//div[#class='col-md-8']")
Here is an example sheet.
Unfortunately Google Sheet's formula IMPORTXML is only able to read the static HTML source of the page so it will not be able to read any dynamically inserted element (as you guessed the visa number is dynamically inserted with a Javascript script).
If you inspect in your browser the page source of this site, you will see that the numbers like Candidates in the pool are not there and therefore, IMPORTXML will not be able to reach them.
In order to get them you will need to look for another web scraping technique (with libraries like scrappy and so on).
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
Hey so currently working on my first personal project so bear with the questions!
Currently trying to create a Javascript program that will parse info from google forms to produce slides displaying the info. So far from my research the best way I've found to facilitate this process is googles app script editor. However, I was wondering if I can run this code by requesting it from a different javascript (or maybe even java) program that I will write code on webstorm. If I cant do this what is the best way to utilize the google apps script editor?
Thanks!
Google Apps Script is just javascript with extra built-in APIs (like SpreadsheetApp, FormApp, etc.).
It also has a UrlFetchApp API.
So you can run code like this:
// The code below logs the HTML code of the Google home page.
var response = UrlFetchApp.fetch("http://www.google.com/");
Logger.log(response.getContentText());
As such, if you want to provide JavaScript from elsewhere, you could fetch it and then eval it on the Google Apps Script side. (but we all know how tricky eval can get)
One other option is to have your own server side written using Google App Engine (or any other framework) and use Google's OAuth and authorize your app to fetch data from the Forms form
Slides and Google Apps Script
You might like to take a look at the addon "Slides Merge" by Bruce McPherson. I've never used it but it sounds like it might work for you. Here's what it's looks like in the addon store:
Getting information from Google Forms is a snap with google apps script since your can link the form right up to a spreadsheet. The Google Apps Script documentation is really quite good these days. Here's the documentation link. Google Apps Script is loosely based on Javascript 1.6. If your already a programmer my guess is that you'll have few problems learning to use it. In my experience the most difficult thing was dealing with the arrays of arrays produced by the getValues() method of ranges in google apps script and I made a short video that might be of some help to you.
I also have a script that I wrote in Google Apps Script that produces a sheet show that is a slide show inside of a spreadsheet.
I've found that using the Script Editor is pretty easy. There's some documentation in the support section of the documentation. It can be a bit buggy at times but overall I think it's a pretty good tool.
I want to be able to open an Excel sheet using Office Web Viewer, HTML viewing component. (This seems to also be called the "Office Web Apps Viewer".) The viewer component is a really excellent HTML office document rendering engine, but I can find absolutely no documentation online for it. It's even hard to discern what its correct name is. (Does anyone have details on the API?)
I need to be able to load the document and immediately call a JavaScript function to do a search so that the document opens with the search result already highlighted. Even better would be to be able to set the search term in the query string given to the viewer component.
Does anyone know if this is possible and if so, how?
I can say with quite some certainty that there is no such API as the viewer is not intended for such usage. Yeah, I know, not the answer you wished to hear, but then again, that's just the way it is. It's just a viewer, not a component to be used as part of applications.
The quick & dirty solution: Using an extension
One way to achieve what you want is to write an extension that would expose this functionality to you. Of course this would require your users to install this extension, but it is definitely an option and such an extension would be relatively simple to write.
The better solution: PDF.js
Convert your documents to PDF's using some server side solution.
On Linux with OpenOffice.org this could for example look like oowriter -convert-to pdf:writer_pdf_Export doc_file.doc or swriter for LibreOffice.
Present them using Mozilla's cross browser PDF.js library.
Figure out the PDFFindController how to trigger the highlighting. Take a look at this demo and next at this source file. In there they are definitely triggering the highlighting (search for the object I named before), but as it is not directly addressing this question I am not going to figure that one out for you.