Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling tweaks #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rockstar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# Install as extension
1. Create a folder on your hard drive called "rockstar". Download the files to the "rockstar" folder.
2. Open Chrome.
3. Go to the Extensions tab.
4. Click to enable Developer Mode. (It will prompt you about this every time you restart Chrome.)
3. Click on the Chrome menu button
4. Go to "More Tools"
3. Click "Extensions"
4. In the upper right of the screen toggle on "Developer Mode". (This will prompt you about this every time you restart Chrome.)
5. Drag the "rockstar" folder to the Chrome Extensions tab.

see also https://gabrielsroka.github.io/rockstar
Expand Down
17 changes: 14 additions & 3 deletions rockstar/rockstar.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
.popup {
#rockstar-popup {
position: absolute;
z-index: 1000;
left: 4px;
top: 4px;
background-color: white;
background-color: white;
padding: 8px;
border: 1px solid #ddd;
}
margin: 16px 16px 12px 16px;
}

.rs-api-explorer {
text-align: center;
}

.fa-compass {
height: 8px;
width: 8px;
vertical-align: baseline !important;
}
14 changes: 7 additions & 7 deletions rockstar/rockstar.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@

// API functions
function apiExplorer() {
createDivA("API Explorer", mainPopup, function () {
// fa-compass icon from Font Awesome, see also: https://fontawesome.com/license
createDivA('<svg focusable="false" data-prefix="fas" data-icon="compass" class="svg-inline--fa fa-compass fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M225.38 233.37c-12.5 12.5-12.5 32.76 0 45.25 12.49 12.5 32.76 12.5 45.25 0 12.5-12.5 12.5-32.76 0-45.25-12.5-12.49-32.76-12.49-45.25 0zM248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm126.14 148.05L308.17 300.4a31.938 31.938 0 0 1-15.77 15.77l-144.34 65.97c-16.65 7.61-33.81-9.55-26.2-26.2l65.98-144.35a31.938 31.938 0 0 1 15.77-15.77l144.34-65.97c16.65-7.6 33.8 9.55 26.19 26.2z"></path></svg> API Explorer', mainPopup, function () {
var apiPopup = createPopup("API Explorer");
var form = apiPopup[0].appendChild(document.createElement("form"));
form.innerHTML = "<select id=method><option>GET<option>POST<option>PUT<option>DELETE</select> " +
Expand Down Expand Up @@ -918,7 +919,7 @@
}).fail(jqXHR => $(results).html("<br>Status: " + jqXHR.status + " " + jqXHR.statusText + "<br><br>Error:<pre>" + JSON.stringify(jqXHR.responseJSON, null, 4) + "</pre>"));
return false; // Cancel form submit.
};
});
}, "", "rs-api-explorer");
}
function formatJSON() {
let pre = document.getElementsByTagName("pre")[0]; // Don't use jQuery.
Expand Down Expand Up @@ -1000,9 +1001,8 @@
if (xsrf.length) $.ajaxSetup({headers: {"X-Okta-XsrfToken": xsrf.text()}});
}
function createPopup(title) {
var popup = $(`<div style='position: absolute; z-index: 1000; top: 0px; max-height: calc(100% - 28px); max-width: calc(100% - 28px); padding: 8px; margin: 4px; overflow: auto; ` +
`background-color: white; border: 1px solid #ddd;'>` +
`${title}<div style='display: block; float: right;'><a href='https://gabrielsroka.github.io/rockstar/' target='_blank' rel='noopener' style='padding: 4px'>?</a> ` +
var popup = $(`<div id='rockstar-popup'>` +
`<span class='title'>${title}</span><div style='display: block; float: right;'><a href='https://gabrielsroka.github.io/rockstar/' target='_blank' rel='noopener' style='padding: 4px'>?</a> ` +
`<a onclick='document.body.removeChild(this.parentNode.parentNode)' style='cursor: pointer; padding: 4px'>X</a></div><br><br></div>`).appendTo(document.body);
return $("<div></div>").appendTo(popup);
}
Expand All @@ -1012,8 +1012,8 @@
function createPrefixA(prefix, html, parent, clickHandler) {
$(`${prefix}<a style='cursor: pointer'>${html}</a>`).appendTo(parent).click(clickHandler);
}
function createDivA(html, parent, clickHandler, aParts = "") {
$(`<div><a style='cursor: pointer' ${aParts}>${html}</a></div>`).appendTo(parent).click(clickHandler);
function createDivA(html, parent, clickHandler, aParts = "", cls="anchor") {
$(`<div class='${cls}'><a style='cursor: pointer' ${aParts}>${html}</a></div>`).appendTo(parent).click(clickHandler);
}
function getLinks(linkHeader) {
var headers = linkHeader.split(", ");
Expand Down