Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

tweak swfPath config for js module definitions #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions app/assets/javascripts/zeroclipboard/asset-path.js.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
//= depend_on_asset "ZeroClipboard.swf"
ZeroClipboard.config({
swfPath: '<%= image_path "ZeroClipboard.swf" %>'
});
(function(window, undefined) {
"use strict";
var settings = {
swfPath: <%= image_path("ZeroClipboard.swf").to_json %>
};
if (typeof define === "function" && define.amd) {
require(["ZeroClipboard"], function(ZeroClipboard) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this specific to RequireJS?

ZeroClipboard.config(settings);
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
require("ZeroClipboard").config(settings);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untested

} else {
window.ZeroClipboard.config(settings);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untested

}
})(function() {
return this || window;
}());