Displays the document properties of the projectdoc document currently shown in the browser.
Bookmarklet
The bookmarklet is ready to use. Simply drag and drop the bookmarklet button to the bookmarks in your browser.
Code
The code is available on the resource repository.
var pageId = AJS.Meta.get('page-id');
var locale = AJS.Meta.get('user-locale');
var baseURL = AJS.Meta.get('base-url');
var result = $.ajax({
url: baseURL + "/rest/projectdoc/1/document/" + pageId + ".json?expand=property&resource-mode=html",
async: false,
dataType: 'json'
}).responseText;
var htmlTitle = "Page Properties";
var html = "<html lang='" + locale + "'><head><title>" + htmlTitle + "</title><style>" +
" .table-sm td, .table-sm th {padding: .1rem !important;}" +
" .table td, .table th { font-size: 10px !important;}" +
"</style>" +
"<link rel=\"stylesheet\"" +
" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\"" +
" integrity=\"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T\"" +
" crossorigin=\"anonymous\">" +
"</head><body><h6>" + htmlTitle + "</h6>";
html += "<table class=\"table table-sm table-bordered table-striped\">";
$.each($.parseJSON(result).property,
function (index, obj) {
html = html + "<tr><th>" + obj.name + "</th><td>" + obj.value + "</td></tr>"
}
);
html += "</table></body></html>";
var x = window.open('', '', 'width=600,height=800,location=no,toolbar=0');
x.document.body.innerHTML = html;