EzDevInfo.com

clippy.js

Add Clippy or his friends to any website for instant nostalgia. ClippyJS - Add Clippy or his friends to any website for instant nostalgia add clippy or his friends to any website for instant nostalgia. our research shows that people love two things: failed microsoft technologies and obscure javascript libraries. naturally, we decided to combine the two.

how to get clippy-jquery activate using javascript or jquery

Just using clippy-jquery and want to hide the main swf object but activate the functionality with another regular button. It has a function to update the text to by sent to the clipboard so I'm guessing that there must be a function to simulate the "click" event?

EDIT: For anyone who wants the answer to this. Use zeroClipboard instead. Works and is much easier to customise visually.


Source: (StackOverflow)

Ruby on Rails - can't render a variable in a function

I have some HAML code like this:

.clearfix
  =f.label t("labels.shortened_urls.fqdn_url")
  =f.url_field :fqdn_url, {:readonly => true}
.span1
  =link_to((t "links.shortened_urls.view"), f.object.fqdn_url(true), :target => :_blank)
  .clippy-container=clippy(fqdn_url,"#ffffff")

it does nto render because of the last line. If I change the last line to a simple string like this, it will work:

.clippy-container=clippy("test","#ffffff")

but I am not certain of the variables syntax that I need to use and I tried this:

.clippy-container=clippy(fqdn_url,"#ffffff")

or this:

.clippy-container=clippy(:fqdn_url,"#ffffff")

but none of them work. Any idea how to make it work with that fqdn_url variable?

Thanks!


Source: (StackOverflow)

Advertisements

Ruby on Rails - how to make a clippy widget work from a helper file?

I have a app/helpers/application_helper.rb file with this code:

  def clippy(text, bgcolor = "#ffffff")
    text.gsub!('"',"'")
    path_to_swf = "/flash/clippy/clippy.swf"
    html = <<-EOF
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
              width="110"
              height="14"
              id="clippy" >
      <param name="movie" value="#{path_to_swf}"/>
      <param name="allowScriptAccess" value="always" />
      <param name="quality" value="high" />
      <param name="scale" value="noscale" />
      <param NAME="FlashVars" value="text=#{text}">
      <param name="bgcolor" value="#{bgcolor}">
      <embed src="#{path_to_swf}"
             width="110"
             height="14"
             name="clippy"
             quality="high"
             allowScriptAccess="always"
             type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"
             FlashVars="text=#{text}"
             bgcolor="#{bgcolor}"
      />
      </object>
    EOF
    raw(html)
  end

and I am trying to use it in an HTML file (I use HAML so it is really a HAML file) but I am not sure what I need to do in order to actually call that code above and render the little clippy widget.

I have this HAML code to try to render the clippy:

.clippy-container=clippy("hello","#ffffff")

and I do that in a file located in app/views/my_file.html.haml

Any idea what I need to do in order to make the clippy render?

Thanks!


Source: (StackOverflow)

Use Clippy to copy javascript function output

I would like to copy the output of a JavaScript function to my clipboard. I already read that with JavaScript alone, this is not possible (apart for an outdated IE version), and that brought me to Clippy. I would like the text of Clippy to be the output of a JavaScript function.

JS function:

function copyToClipboard() {
  var oTable = document.getElementById('Info');
  var rowLength = oTable.rows.length;
  var text = ""
  for (i = 0; i < rowLength; i++){
    var oCells = oTable.rows.item(i).cells;
    var cellLength = oCells.length;
    var attribute = oCells.item(0).innerHTML;
    var value = oCells.item(1).innerHTML;
    var toAdd = attribute + ": \t" + value;
    text = text + toAdd + "\n";
  }
  text = text.replace(/<\/?[^>]+(>|$)/g, "");
  text = text.replace(/\n\s+\n/g, "\n");
  text = text.trim();
  return text;
}

The implementation of Clippy is the following:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
        width="110"
        height="14"
        id="clippy" >
<param name="movie" value="/static/flash/clippy.swf"/>
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param NAME="FlashVars" value="text=#{text}">
<param name="bgcolor" value="#FFFFFF">
<embed src="/static/flash/clippy.swf"
       width="110"
       height="14"
       name="clippy"
       quality="high"
       allowScriptAccess="always"
       type="application/x-shockwave-flash"
       pluginspage="http://www.macromedia.com/go/getflashplayer"
       FlashVars="text=#{text}"
       bgcolor="#FFFFFF"
/>
</object>

The "#{text}" part has to be the output of the copyToClipboard() function. How would I do such a thing? Or are there other/better ways?


Source: (StackOverflow)