I'm trying to create a simple google gadget and am encountering trouble right out the door. I've read the getting started guide top to bottom and feel like i'm still missing something.
Starting with the Hello World gadget they have provided, how do I begin editing and testing? I'm using the Google Gadget Editor with the preview tab. This works for simple html, but any javascript (such as an "alert") I embed doesn't work.
I can publish the gadget and add it to iGoogle. When I do this, my embeded javascript works. However there seems to be a good bit of caching and latency going on behind the scenes. Right now this process of editing, uploading, publishing, debugging is quite painful. Am I missing something obvious here? What is the "correct" way to develop and test a gadget? Is there a program that can run gadget code on my machine without having to go online?
Ah, the joys of editing a Google Gadget.
From my experience the Google Gadget editor is VERY buggy. So that may be the Javascript issue you are having, try switching browsers.
Also, to disable caching:
http://www.google.com/ig/directory?type=gadgets&url=www.google.com/ig/modules/developer.xml
The answer appears to be "No" as far as I can tell. I have also suffered the painful latency you mention: one code/debug cycle can easily take 10 minutes of waiting for the gadget to update to my latest code.
I hope someone marks me down and provides a "Yes" answer.
Try appending a query string to your gadget URL and then add it to your gmail or iGoogle page. Use a different query parameter every time you make changes to your gadget. Like for example:
www.mycompany.com/gadgets/main.xml?q=1234
Google refreshes the cache every hour or so. So, adding a query string will force it to refresh the gadget immediately.
Related
I have a spreadsheet I manually fill out every day where I fill in sleep data recorded by my Whoop strap. As a fun project I thought I'd make this automatic and take advantage of the developer tools for Whoop and Google Sheets. Should be noted that I have experience in scientific computing (Matlab and Julia), but absolutely zero web dev experience.
I tried following the instructions in this link which goes through setting up the HTTP request to get sleep data. However, in order to get that to work, I first need to get an access token, so I tried following this tutorial which goes over authentication. I think I know what each of these is doing, but I'm struggling to put it into context of how the overall script will look. Should I just put all those bits of code into a single .js file and just run that? I see terms such as "middleware stack", "routing layer" and "server-side frameowrks" Are these relevant to the presumably simple script I'm trying to implement?
The perfect answer would be directions to any tutorials/books/articles/videos where someone implemented a similar idea just so I get a better idea of how it should all look.
Thanks in advance!
So there is a problem with JavaScript and requests (in Python) and that is, it does not use JavaScript when requesting a webpage.
The website I'm working with (https://access.paylocity.com/) requires JavaScript and without it, it changes the content of the page to just a text at the top saying, "Please enable JavaScript to view the page content."
(I could be wrong here but) I think one solution is the use of Selenium, but that would replace requests which I'm fine with as long as there are no other ways of fixing/bypassing this JavaScript detection.
(For those wondering, this python project of mine is supposed to automatically fetch the events on the Paylocity calendar, then port those events to another calendar that I frequently use everyday. It's also just intended for myself.)
Edit: Here is the code I have if that will help https://pastecode.io/s/GXTUO1BgtR (I didn't know where to paste my code, so I decided on that website. If I should change it, please comment or say something about it.)
Since the website you're working with is dynamically loading the JS as far I can tell, I think you have no other choice as to making use of Selenium. I had a project on my own a couple weeks ago and run into a similar problem which I could also solve using Selenium. But, I'm no expert, I'm just giving away my thoughts on this.
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.
Currently, I use Buffer (http://bufferapp.com) as a browser extension and noticed that it stopped working on Twitter recently. If you do not know, this extension adds a 'Buffer' button to many social media websites. Twitter made another UI change, and the Buffer extension no longer add its button to the bottom of tweets.
Thinking that I might do something along these lines in the future (i.e., adding content to other websites via a browser extension), I wanted to know if there are any standard practices when doing so. Are there good tips to avoid this breakage over time? I know its simply impossible to guarantee that the origin site won't break your code, but I hope there are some thoughts on how I can mitigate against it.
Thanks for any thoughts or insights!
copy paste this addon and edit in the "addDiv" and removeDiv functions.
https://addons.mozilla.org/en-US/firefox/addon/ghforkable/
this addon inects javascript into github. you can change it to twitter
https://github.com/Noitidart/ghForkable
if you need more help let me know i can change this to specifically insert on twitter in 10min
A few weeks ago I started learning Javascript and the Google Apps Script API, specifically in regard to spreadsheets. I have been trying to make a spreadsheet that fetches web pages and pulls stats about my friends for the game League of Legends. However, I have been running into a problem with the site I want to use, which is basically the only free LoL stats site that updates frequently. I'm not familiar at all with web development, but it seems when I try to access a page on lolking.net, for example http://www.lolking.net/summoner/na/60783 with Google's UrlFetchApp.fetch() it does not load the dynamic page. So instead of the final source, I get this which doesn't help me. Is there an easy way around this or would I simply have to use another website?
Thanks for thie info! Although it turns out I was mistaken. The UrlFetchApp was indeed returning the full source code, but I was using GAS's Logger to view the text. It seems the Logger has a length limit, so when I searched for the stats I wanted they weren't there simply because the source code got truncated. So, due to an oversight on my part, I never had a problem in the first place. For other people reading this question, in the end I have no idea how UrlFetchApp works with dynamic pages using clientside js (you'd probably want to talk to the poster below or post a new question).
You are getting fhe raw html page with clientside js included. That wont work from any system not just gas. You need to debug that page js and find where it does an ajax call to get the data you want.
Then do the same from your gas. Might not work if the call is authenticated etc.