Inlining the runtime in Ads

Inlining the runtime … I was exploring this in a exporter script. Although I haven’t found a easy solution with a custom exporter script. My thinking I could hardcode the runtime content into the exporter… and regex it into my position of desire but that would require constant updating of the exporter script. Any thounghts on that… I am talking min runtime (no waypoints and ie 6789).

Anybody had similar thoughts? Suggestions? Remarks?

I don’t understand what you’re trying to do. Are you trying to exclude the IE stuff or are you trying to inline it?

(In general, I’ve had trouble with inline code. Sometimes it breaks, like when exporting to an app.)

I have two export scripts I’m waiting to launch. They’re really good too. I’m surprised by what’s possible with Hype export scripts.

I just wanted to inline the runtime on export (for example HYPE-596.thin.min.js) into the HTML-File. Just like you can with the hype documents json.

You can copy + paste the entirety of that .js code into the .html file, just make sure it is first and above the other inlined code. I agree that we should have an export script for this.

Hello Max, last I checked that option isn’t there yet. Would be nice if it was. So we could add it as 1 line in the html head. And also had a version check to auto update it.

This is how you'd do it; if you look at the sample export script there's the insert_at_head_start variable and subsequent replacement which is how I'd recommend going about it for now. There's a good bet there will always be a <head> element :slight_smile:.

I would like to add this as an option.


This would be really useful as an option for future updates guys.


Yes please.

1 Like

So I have been doing something similar with GAS. Google App-Script enviroment.
I want all the .js files to run from within google drive.

App-script sandboxing and G-Drive infrastructure with link files and type prevents us from linking directly to .js files (for example) unless they are external to G-Drive.

My work around is to pust the code into a G-Drive Doc and use App-Script html templating to place the code in the HTML.

This works for the hype_generated_script.js file, And initali in the HTML I just have to have a div with the
id for the ‘_hype_container’.

But for the life of me cannot get the runtime to work. Unless I point to it externally.

The problem is not getting the code into the HTML it is getting the hype_generated_script.js to not look for the runtime in a resource file and just assume it exists… which I am hoping it will in the HEAD via the app-scrip template, the same as the hype_generated_script.js does.

Any ideas.

I will likely at some point put up an example showing how to do this.
This is similar to accessing the jsonp google sheet idea of dynamic data editing by third partt ( clients )
But using App-Script we can keep things restricted the domains and users. All data would be linked to shared docements per person ( i.e restricted via google share permissions) as apossed to the jsonp way which is all public facing. You also have direct access to files,contacts email etc on google.

Hmm that's weird, I assumed that it would work if the Hype runtime had previously been loaded. In my manual test, the external Hype document will attempt to be loaded (perhaps triggering a 404), but it will fail otherwise gracefully since the runtime had been loaded.

Wondering then if it is a timing thing within the app-script environment.

I will see if I can add the runtime first via template get and then either delay the load of the container or load the container via a call from the html to the app script code. Although I foresee issues with that

The two most important items for inlining the runtime are:

  1. Include it first, before the *_hype_generated_script.js in the head.
  2. Always use the “full” version, or if you are going to use the thin one make sure your document does not need it.

Beyond this, I’d ask if there are any specific errors in the console? I haven’t used the app-script environment but it could be there’s something in that preventing the execution.

(also looks very cool, I’d love to hear more)

@jonathan, @Daniel Thanks Both,

It was a combination of things that it seems I had to line up.

When I templated the hype_generated_script I used new Function to parse the text as a function.
Then just have a div with the container name.

That worked without messing about. ( surprised the heck out of me also )

So I assumed the hype runtime text to new function would be the same.

I had to do two things to get it to work.

I had to call the var name I assigned to the new function i.e window.hy() . ( I assume () somewhere at the end of the runtime function would also work)

Did not need to do that for the hype_generated_script

The second thing I had to do was put the hype_generated_script new Function in a settimeout with a 0s time out

Those two steps got it working.

If you both have gmail accounts and pm them to me I will setup a couple of working examples for you to look at.

I am totally enjoying being able to mix Hype within the Google / app-script environment.
It is proving to be so useful. And google take care of permissions to data for me.

1 Like

Interesting - those types of assignments aren’t necessary for simple inlining to a .html page, but maybe they are required in the App Script environment.

(we can continue this via DM and maybe post later with a full solution for others interested in running Hype animations this way!)

2 posts were split to a new message: Your post in “Inlining the runtime in Ads” [again]