mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 02:17:59 +01:00
added simple style guide in HACKING file
This commit is contained in:
26
HACKING
Normal file
26
HACKING
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
== Coding Style ==
|
||||||
|
In gerneral: Just look at other source code!
|
||||||
|
We try to be quite consistent, but of course, that's not always possible.
|
||||||
|
|
||||||
|
=== The most important style issues are: ===
|
||||||
|
* Use 4 spaces to indent things, no tabs, not 2, nor 8 spaces. If you use vim,
|
||||||
|
this should be taken care of automatically by the modeline.
|
||||||
|
|
||||||
|
* Use " for enclosing strings instead of ', unless using ' avoids escaping of lots of "
|
||||||
|
Example: alert("foo") instead of alert('foo');
|
||||||
|
|
||||||
|
* Exactly one space after if/for/while/etc. and after a comma, but none after a parenthesis
|
||||||
|
or after a function call:
|
||||||
|
for (pre, contition, post)
|
||||||
|
but:
|
||||||
|
alert("bla");
|
||||||
|
|
||||||
|
* Opening curly brackets { must be on a new line, unless it is used in a closure:
|
||||||
|
myFunction ()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
but:
|
||||||
|
setTimeout(function () {
|
||||||
|
...
|
||||||
|
});
|
||||||
@@ -83,18 +83,21 @@ function Hints() //{{{
|
|||||||
Y: Mode("Yank hint description", function (elem) util.copyToClipboard(elem.textContent || "", true), extended)
|
Y: Mode("Yank hint description", function (elem) util.copyToClipboard(elem.textContent || "", true), extended)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implement ';F' hint sequences. This function handles on element of the hint sequence.
|
// Used to open multiple hints
|
||||||
function hintSequenceElement(elem)
|
function hintSequenceElement(elem)
|
||||||
{
|
{
|
||||||
// Want to always open sequence hints in background
|
// Want to always open sequence hints in background
|
||||||
// (remember: NEW_BACKGROUND_TAB and NEW_TAB semantics assume
|
// (remember: NEW_BACKGROUND_TAB and NEW_TAB semantics assume
|
||||||
// that loadInBackground=true)
|
// that loadInBackground=true)
|
||||||
if( options.getPref("browser.tabs.loadInBackground") )
|
if (options.getPref("browser.tabs.loadInBackground"))
|
||||||
buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB);
|
buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB);
|
||||||
else
|
else
|
||||||
buffer.followLink(elem, liberator.NEW_TAB);
|
buffer.followLink(elem, liberator.NEW_TAB);
|
||||||
|
|
||||||
// Move to next element in sequence
|
// Move to next element in sequence
|
||||||
|
// TODO: Maybe we find a *simple* way to keep the hints displayed rather than
|
||||||
|
// showing them again, or is this short flash actually needed as a "usability
|
||||||
|
// feature"? --mst
|
||||||
hints.show("F");
|
hints.show("F");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user