<img wicket:id="copyIcon" wicket:message="title:gb.copyToClipboard"></img>\r
</span>\r
</wicket:fragment>\r
- \r
\r
-<!-- flash-based button-press copy & paste -->\r
-<wicket:fragment wicket:id="clippyPanel">\r
- <object wicket:message="title:gb.copyToClipboard" style="vertical-align:middle;"\r
- wicket:id="clippy"\r
- width="14" \r
- height="14"\r
- bgcolor="#ffffff" \r
- quality="high"\r
- wmode="transparent"\r
- scale="noscale"\r
- allowScriptAccess="sameDomain"></object>\r
-</wicket:fragment>\r
+\r
+ <!-- JavaScript automatic copy to clipboard -->\r
+ <wicket:fragment wicket:id="clippyPanel">\r
+ <span class="tooltipped tooltipped-n">\r
+ <img class="ctcbtn" wicket:id="copyIcon" wicket:message="title:gb.copyToClipboard" />\r
+ </span>\r
+ </wicket:fragment>\r
\r
</wicket:extend> \r
</body>\r
import com.gitblit.wicket.panels.DiffStatPanel;\r
import com.gitblit.wicket.panels.IconAjaxLink;\r
import com.gitblit.wicket.panels.LinkPanel;\r
-import com.gitblit.wicket.panels.ShockWaveComponent;\r
import com.gitblit.wicket.panels.SimpleAjaxLink;\r
\r
/**\r
\r
protected Fragment createCopyFragment(String wicketId, String text) {\r
if (app().settings().getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {\r
- // clippy: flash-based copy & paste\r
+ // javascript: browser JS API based copy to clipboard\r
Fragment copyFragment = new Fragment(wicketId, "clippyPanel", this);\r
- String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
- ShockWaveComponent clippy = new ShockWaveComponent("clippy", baseUrl + "/clippy.swf");\r
- clippy.setValue("flashVars", "text=" + StringUtils.encodeURL(text));\r
- copyFragment.add(clippy);\r
+ ContextImage img = WicketUtils.newImage("copyIcon", "clippy.png");\r
+ // Add the ID of the target element that holds the text to copy to clipboard\r
+ img.add(new SimpleAttributeModifier("data-clipboard-text", text));\r
+ copyFragment.add(img);\r
return copyFragment;\r
} else {\r
// javascript: manual copy & paste with modal browser prompt dialog\r