You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.0 KiB

  1. // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // http://rust-lang.org/COPYRIGHT.
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. /*jslint browser: true, es5: true */
  11. /*globals $: true, rootPath: true */
  12. (function() {
  13. if (window.playgroundUrl) {
  14. $('pre.rust').hover(function() {
  15. var a = $('<a>').text('⇱').attr('class', 'test-arrow');
  16. var code = $(this).prev(".rusttest").text();
  17. a.attr('href', window.playgroundUrl + '?code=' +
  18. encodeURIComponent(code));
  19. a.attr('target', '_blank');
  20. $(this).append(a);
  21. }, function() {
  22. $(this).find('a.test-arrow').remove();
  23. });
  24. }
  25. }());