scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 89  →  ?path2? @ 90
/file.html
@@ -87,6 +87,9 @@
<button id="btn-mailto" class="btn btn-default" type="button"><i class="glyphicon glyphicon-envelope"></i></button>
</span>
<span class="input-group-btn">
<button id="btn-facebook" class="btn btn-default" type="button" disabled="disabled"><i class="fa fa-facebook"></i></button>
</span>
<span class="input-group-btn">
<button id="btn-clipboard" class="btn btn-default" type="button"><i class="glyphicon glyphicon-paperclip"></i></button>
</span>
</div>
@@ -300,6 +303,47 @@
encodeURIComponent("Can't scratch this!") + "&body=" +
encodeURIComponent($('#' + boxURLID).val());
});
// Set the ID of the facebook button.
const faceBookButtonID = '_' + Math
.random()
.toString(36)
.substr(2, 9);
 
file
.previewElement
.querySelector("#btn-facebook")
.setAttribute('id', faceBookButtonID);
switch(data.opengraph) {
case true:
// Enable the facebook button.
file
.previewElement
.querySelector('#' + faceBookButtonID)
.removeAttribute("disabled");
// Change the URL when the user clicks the button.
$('#' + faceBookButtonID).on('click', () => {
$('#' + boxURLID)
.val(
location.protocol.concat("//")
.concat(window.location.hostname)
.concat("/")
.concat("og")
.concat("/")
.concat(data.hash)
);
});
break;
default:
// Disable the facebook button.
file
.previewElement
.querySelector('#' + faceBookButtonID)
.setAttribute("disabled", "disabled");
break;
}
});
document.querySelector("#actions .start").onclick = () => {