Commit Graph

72 Commits

Author SHA1 Message Date
Nathan Adams 077c3ec973 web: Fix broken version comparison logic 2020-05-16 01:58:18 -07:00
Nathan Adams 18d747d5fa web: Fix eslint: Unexpected duplicate 'super()' (constructor-super) 2020-05-16 01:58:18 -07:00
Nathan Adams efe33e1631 web: Fix eslint: Don't access Object.prototype method directly (no-prototype-builtins) 2020-05-16 01:58:18 -07:00
Nathan Adams 2c0b12a93f web: Fix eslint: Variable is defined but not used (no-unused-vars) 2020-05-16 01:58:18 -07:00
Nathan Adams 0b445bee1c web: Fix eslint: Unnecessary semicolon (no-extra-semi) 2020-05-16 01:58:18 -07:00
Nathan Adams 43ee0e499e web: Add eslint to web projects, mostly unopinionated 2020-05-16 01:58:18 -07:00
Mike Welsh d15a4ed994 web: Fallback to canvas render backend in more cases (fix #545) 2020-05-14 22:36:19 -07:00
Justin-CB ee69f77126
web: Don't polyfill elements with no src or data attributes (fix #542)
* Don't polyfill elements with no src or data attributes
* Move elem.src check to ruffle-embed and add param check to ruffle-object

Co-authored-by: Toad06 <toad06@foo.bar>
Co-authored-by: JustinCB <JustinCB@opmbx.org>
2020-05-11 23:33:46 -07:00
Justin-CB f9767e0da4
web: Simplify play button code
Co-authored-by: JustinCB <JustinCB@opmbx.org>
2020-05-04 16:12:55 -07:00
JustinCB a3733705a8 web: Add "frames" polyfill setting 2020-04-29 23:23:25 -07:00
Mike Welsh 4a53d95753 web: Add width and height to observed attributes for Ruffle elements 2020-04-28 06:10:41 -07:00
Mike Welsh 46b14e5a7f web: Tweak shadow template CSS to ensure default width/height (fix #529) 2020-04-28 05:50:50 -07:00
Mike Welsh c94df5243e web: Add nicer play button 2020-04-27 04:45:53 -07:00
Sean-Thomas 4d91a202e1 web/demo: Add dropdown to select sample SWF
- replaced static polyfill embed on web demo with JS API code.
- added swf_lib JSON file for sample SWFs.
- added console logs for when a Ruffle instance is created or destroyed in ruffle-player.js.
- more minor styling changes to the web demo index page.
2020-04-13 04:55:57 -07:00
Justin-CB ba19e6c2e1
web: Add additional flash MIME types to polyfill
Co-authored-by: Justin Bester <justin@frankenmando.local>
2020-04-01 18:45:32 -07:00
Mike Welsh c1abbdacdd chore: Fix naming convention 2020-03-26 02:55:25 -07:00
Mike Welsh e237536293 web: Blacklist "Adobe Flash Player" title attribute (fix #468)
The "Click to activate Flash" box from Chrome stomps on the title
attribute of a Flash embed when you mouse over it. This causes
an annoying "Adobe Flash Player" tooltip to appear even after
Ruffle replaces the embeds.

Now we check for this specific title and remove it.
2020-03-26 02:37:25 -07:00
Mike Welsh c2e9d5d757 web: Install plugin spoof immediately on script load
Scripts like SWFObject check for the Flash plugin immediately when
they load, so we can't defer installing the spoof. Fixes #448.
2020-03-25 20:14:31 -07:00
Mike Welsh 353eeec6c3 web: Return matching Flash Player version for MIME type description
The plugin detection spoofer would add " "Shockwave Flash 32.0 r0
(compatible; Ruffle 0.1)" to the Flash MIME type description in
the plugins array. However, this breaks SWFObject's version
detection, which does a simple String split.

Now we return the same value as the official player:
"Shockwave Flash 32.0 r0"
2020-03-25 20:14:31 -07:00
Mike Welsh 774aa59210 web: Default public_path to currentScript URL
Also automatically add trailing slash on public_path if necessary.
2020-03-25 00:54:21 -07:00
Mike Welsh fa063a6f53 web: Enable dynamic-content polyfill by default
Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
Mike Welsh e332e5c24c web: Simplify polyfill code
Addresses #464. Use `document.getElementsByTagName` to find all
object and embed tags in the document. For dynamic content,
we keep these live collections around, and re-check them whenever
a MutationObserver fires.

Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
Mike Welsh 4561b591bf web: Handle percentage dimensions in polyfill (fix #433)
When Ruffle replaces a Flash embed, the width/height of the embed
are copied over to CSS of the Ruffle element. "px" was being
appended even if the dimensions were a % value, which CSS rejected.

Try to be a little smarter about parsing out the HTML dimension
attributes (HTML is more lenient). Append "px" only if the value
isn't a percentage.

Fixes #433.
2020-03-21 01:23:23 -07:00
Mike Welsh 9e6fe41a91 web: Ignore errors on `Element.setAttribute` in polyfill
Ruffle would not polyfill a Flash embed if it had bogus attributes
in the embed tag. Now these errors are silently ignored.

Fixes the other part of #457.
2020-03-20 20:47:58 -07:00
Mike Welsh 099c497a91 web: Activate polyfill if embed src ends in .swf
Fixes part of #457. Even if the MIME type/class IDs are missing
on the embed/object tags, browsers will still attempt to play
the file as Flash if it ends in a .swf extension.
2020-03-20 20:47:58 -07:00
Mike Welsh 0e228441e1 web: Add missing returns to RufflePlayer.local/local_compatible 2020-01-13 12:28:30 -08:00
David Wendt 51023145c8 Build the extension using webpack, the same as the local version. 2020-01-10 22:10:43 -05:00
Mike Welsh 29754eace8 web: Avoid `copyToChannel` on Safari
`AudioBuffer.copyToChannel` does not work on Safari, so switch to
using `getChannelData` to fill the audio buffers.

Limitations in wasm-bindgen prevent us from actually modifying the
data returned by `getChannelData` on the Rust side, so import a JS
function to fill the audio buffer (js-src/ruffle-imports.js).
2019-12-03 23:05:42 -08:00
Mike Welsh 9f85686666 web: Add missing return to VersionRange.from_requirement_string 2019-11-17 17:43:19 -05:00
Mike Welsh f41708a584 web: Add missing return to Ruffle.newest() 2019-11-17 17:43:19 -05:00
David Wendt 5d8d02a5a2 Add `local` and `local_compatible` methods to the Public API. 2019-11-17 17:43:19 -05:00
David Wendt ab9af6958e Enforce the opt-out entirely within trusted extension space, so that we don't load any untrusted world code at all in that case. 2019-11-17 17:43:19 -05:00
David Wendt 5aab97053b Don't depend on the legacy elements polyfill anymore, as that no longer exists, and we define all elements on demand. 2019-11-17 17:43:19 -05:00
David Wendt d964afe72e Expose the `RufflePlayer` element directly. 2019-11-17 17:43:19 -05:00
David Wendt 75e00aff7b Allow looking up sources directly by version. 2019-11-17 17:43:19 -05:00
David Wendt 99714d445c Expand version handling to support ranges and requirements. 2019-11-17 17:43:19 -05:00
David Wendt 3b1ab0e987 Fix the fallback object detection. 2019-11-17 17:43:19 -05:00
David Wendt 5b5aaecb83 Interdictions are now called polyfills 2019-11-17 17:43:19 -05:00
David Wendt 2fa42e3b31 Allow fault tolerance for naming conflicts with Ruffle elements 2019-11-17 17:43:19 -05:00
David Wendt d53f9c8f47 Allow configuring the Webpack path 2019-11-17 17:43:19 -05:00
David Wendt fbca5a0a6f Fix broken interdictions 2019-11-17 17:43:19 -05:00
David Wendt ccd763b696 Tolerate Ruffle loading after the page loads 2019-11-17 17:43:19 -05:00
David Wendt 6d34997975 Fix some bugs in the Public API 2019-11-17 17:43:19 -05:00
David Wendt 4163ea7975 Add the ability to upgrade the Public API itself.
This isn't intended to be used right away.
2019-11-17 17:43:19 -05:00
David Wendt 6b0881e3f2 Add proper version negotiation 2019-11-17 17:43:19 -05:00
David Wendt db01ee8984 Add class to parse version strings 2019-11-17 17:43:19 -05:00
David Wendt bb184469d8 Actually install new sources 2019-11-17 17:43:19 -05:00
David Wendt f957ec4744 Create a standard list of interdictions rather than checking for specific strings. 2019-11-17 17:43:19 -05:00
David Wendt d1aa71e488 Add explicit classes for the Ruffle Public API. 2019-11-17 17:43:19 -05:00
David Wendt 5dcbe43fe1 Consolidate public API into a shared module 2019-11-17 17:43:19 -05:00