Google Docs Sharing Container Bound Script - javascript

i have a simple google doc running a basic script enabling a sidebar containing a playable mp3.
My goal is to be able to share this document with any anonymous user
and have them view the document and script the same way i do.
what steps can i take to make this happen? if i cant use a container bound scrip, how do i make a stand alone sidebar script? and if none of those are possible, is there another option for including audio in a document without having to open it in another tab?
i am extremely amateur at scripts, plz forgive me
and thanks for any info you can share!
example: https://i.stack.imgur.com/SJH63.png

Related

How to capture events in an window that is loaded within a page

Let's say I have a website called https:// www.mysite.com. I am trying to figure out how I can capture events (like button click) on some other site (say - https://www.othersite.com that is willingly loaded) inside of mysite (something like a iframe).
Note: I do not have access to https://www.othersite.com
Something like :
<my-site>
// load external site https://www.othersite.com here
</my-site>
I tried using iframes but I realised it's not possible due to Same Origin Policy. (Please do not suggest the php solution with file_get_contents. I have gone through all the articles here on stackoverflow in the last couple of days but could not find a JS solution to this).
Basically, I was looking at something similar to Selenium IDE (It's extension here) where I want to capture events carried out by the user on https://www.othersite.com but its loaded on/inside mysite.
Any pointers to what can be some of the right approaches/strategies for solving this?
This is very fundamental question in what I am trying to achieve and I want to do it the right way. Any guidance is greatly appreciated!

Javascript load iframe asynchonous and auto resize

For our website we would like to give users the availability to include content of our website on their own website in an iframe. For this we would like to give the user a little piece of javascript code that they can include on their page without the need of too much programming knowledge. (like e.g. Facebook does for adding facepile to your page)
There are two concerns from my side. I want the content to be loaded asynchronous so the inclusion of our code will not affect original page load times ans secondly I want the script to automaticaly sets the height of the iframe based on the loaded external content.
I do not want to make use of frameworks like jquery, again to make it as simple as possible for a non code aware user.
I hope that someone can point me to the right direction. I've seen a lot of partial answers on the net, but I am looking for a more all in one solution. Any help would be high appreciated!
Maybe this helps: http://www.aaronpeters.nl/blog/iframe-loading-techniques-performance. Take a look at the "Dynamic async iframe" section. They are using a nice trick by putting a onload event in the iframe document.
Check out this little library for resizing iFrames.
https://github.com/davidjbradshaw/iframe-resizer
The code that goes into the iframe, has no dependancies and does nothing until called by the parent page. So it's a good guest on other peoples sites.
All you would need to do is give people a link the js file hosted on your site.

how to find and mark all links in the web page?

I'm making an application which finds all links and buttons on the web page and
shows marks over the links and buttons (with any browser or custom application window).
Now, I'm trying to implement it with browser helper object(BHO)
and javascript. The BHO injects javascript code in the existing web site and the injected javascript finds the location of links and buttons and marks the links in the web page by analyzing DOM of the page.
However, it has many problems because there are lots of links that are coded by DHTML, javascript, flash and the like. What makes me difficult is that it is not easy to mark these links because it often moves and disappear after the page is completely loaded.
In particular, flash buttons cannot be accessed by HTML DOM, so I'm in trouble with finding such flash buttons with the above method. Therefore, it may be necessary for me to implement this application with different method or framework, but I can't find any other way to do. I think any method to find click-able object on the webpage of screen would be helpful to me. I hope you have some suggestions for me?
To highlight all normal links on a site you can use this jQuery snippet:
$('a').css('color', '#F00');
There is no easy way to highlight flash links or links by window.location in JavaScript.

Controlling the ShareThis javascript window opens

I have just started using ShareThis Widget to help handle social media integration with one of our sites. While the functionality is great, I feel I lose a lot of the capabilities I have if I were to code each item by hand, such as the ability to control the size of the windows opened by clicking a 'share' functionality.
While their site shows basic functions you can add to the buttons (url, etc) I am looking to customize the feel such that when a button is clicked, I can control the size of that window or even possibly open in an existing colorbox snippet.
Has anybody had luck with this before? When I try to control via javascript function it just seems to get overwritten or ignored.
You'd need to unbind their events and handle them all yourself. It probably isn't a good idea, as your code will be at the mercy of their implementation.
I am not sure if your question is resolved, but you will need to add as following inside JS.
popup: 'true'
The same is on their Support Page

Un-obtrusive modal window in external site

Sorry for the title.....bit difficult to word what I really want to ask.
Some websites allow a user to copy and paste some widget for use with their own site. For example, getsatisfaction. Yes, those feedback icons that I hope most of you see in various places.
If you have a look at twitterfeed, on the left there will be a feedback icon, once clicked on a nice modal window comes up. the modal windows content is in an iframe to an external source.
I really like this, but my question is:
I could do the same by using some jQuery library for the modal window and then linking the modal content to a site on my page, but how do I stop this from becoming obtrusive to a sites other javascript files?
For example, let's say i'm using my js code and the relevant jquery code, and i've minified it into one file. The user adds my widget to their site. If they're using jQuery, how do I make sure my code isn't going to interfere with theirs?
Would the best way be to use a modal window library which is not very popular?
Thanks very much. Hope that makes sense!
EDIT: I could write my own modal window functionality code, but i'd much rather use a library which already does it.
You can dynamically load jQuery only if it is needed.
First check for the existance of the jQuery object. If not add the script tag.
There are some challenges to this, as there is no onload event when adding a script tag to a page, that works consistently accross browsers, so you will have to poll to see if it fully loaded, and only then run your code.
There is an article on how to do this:
http://www.squidoo.com/load-jQuery-dynamically
You may still have an issue if the user has a differnt version of the jquery library though, although you can probably get around this with some additional checks.
jQuery UI has very nice dialog components that should fit your purpose. Inside them you can instantiate an iframe. see:
http://elijahmanor.com/demos/jqueryuidialogiframe/index.html
If I understand all this correctly, the iframe content is a separate page, so there is no case where your javascript code in that page would interfere with the javascript of the calling page, but maybe I haven't understood that part correctly?
EDIT:
I think I understand what you meant, in that you want to package up the code that you will write that opens the modal window with the iframe. SO you want to make sure that this code does not interfere with existing jQuery code that the user is using.
I think this is a good use case for a jQuery plugin. This way the user of the page can use your function like any jQuery function, so less likelyhood of collisions

Categories