Fix up library link from Clara item page

This commit is contained in:
David Rowe 2016-11-10 18:20:36 +13:00 committed by Seth Alves
parent f7503ba46c
commit c7c3dfef3e

View file

@ -96,6 +96,17 @@ Rectangle {
});
}';
// In item page:
// - Fix up library link URL.
property string updateItemPage: 'if ($) {
var element = $("a[href=\'/library\']")[0];
var parameters = "?gameCheck=true&public=true";
var href = element.getAttribute("href");
if (href.slice(-parameters.length) !== parameters) {
element.setAttribute("href", href + parameters);
}
}';
// Overload Clara FBX download link action.
property string replaceFBXDownload: 'var element = $("a.download-file");
element.removeClass("download-file");
@ -117,6 +128,11 @@ Rectangle {
// Catalog page.
runJavaScript(updateLibraryPage, function() { console.log("Library link JS injection"); });
}
if (location.indexOf("clara.io/view/") !== -1) {
// Item page.
runJavaScript(updateItemPage, function() { console.log("Item link JS injection"); });
}
}
onLinkHovered: {