Skip to content

Commit

Permalink
Fixes brownplt#492 and cleans up unused code.
Browse files Browse the repository at this point in the history
  • Loading branch information
asolove committed Nov 7, 2023
1 parent e24469f commit f9814c6
Showing 1 changed file with 1 addition and 66 deletions.
67 changes: 1 addition & 66 deletions src/web/js/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ window.makeShareAPI = function makeShareAPI(pyretVersion) {
text: importCode
},
{
message: "You can also click Update below to copy the current version to the published version, or click Close to exit this window."
message: "You can also click Update below to copy the current version to the published version, or click Cancel to exit this window."
}
]
});
Expand Down Expand Up @@ -181,71 +181,6 @@ window.makeShareAPI = function makeShareAPI(pyretVersion) {
}
}

function autoHighlightBox(text) {
var textBox = $("<input type='text'>").addClass("auto-highlight");
textBox.attr("size", text.length);
textBox.attr("editable", false);
textBox.on("focus", function() { $(this).select(); });
textBox.on("mouseup", function() { $(this).select(); });
textBox.val(text);
return textBox;
}

function getLanguage() {
if(typeof navigator !== "undefined") {
return navigator.language || "en-US"; // Biased towards USA
}
else {
return "en-US";
}
}

var dateOptions = {
weekday: "short",
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric"
};

function drawShareRow(f) {
var container = $("<div>").addClass("sharebox");
var shareUrl = makeShareUrl(f.getUniqueId());
var displayDate = new Date(f.getModifiedTime()).toLocaleString(getLanguage, dateOptions);
var hoverDate = String(new Date(f.getModifiedTime()));
container.append($("<label>").text(displayDate).attr("alt", hoverDate));
var shareLink = $("<a href='javascript:void()'>").text("(Share Link)").addClass("copy-link");
var importLink = $("<a href='javascript:void()'>").text("(Import Code)").addClass("copy-link");
container.append(shareLink);
container.append(importLink);
function showCopyText(title, text) {
var linkDiv = $("<div>").css({"z-index": 15000});
linkDiv.dialog({
title: title,
modal: true,
overlay : { opacity: 0.5, background: 'black'},
width : "70%",
height : "auto",
closeOnEscape : true
});
var box = autoHighlightBox(text);
linkDiv.append(box);
box.focus();
}
shareLink.click(function() {
showCopyText("Copy Share Link", shareUrl);
});

var importLetter = getImportLetter(f.getName()[0]);
var importCode = "import shared-gdrive(\"" + f.getName() +
"\", \"" + f.getUniqueId() + "\") as " + importLetter;
importLink.click(function() {
showCopyText("Copy Import Code", importCode);
});
return container;
}

return {
makeShareLink: makeShareLink,
//makeHoverMenu: makeHoverMenu,
Expand Down

0 comments on commit f9814c6

Please sign in to comment.