Skip to content
This repository has been archived by the owner on Dec 21, 2017. It is now read-only.

Commit

Permalink
Compatibility with Brackets Sprint 16
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisKehrig committed Nov 14, 2012
1 parent c944778 commit 8a4b803
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
14 changes: 7 additions & 7 deletions debugger.less
Expand Up @@ -24,7 +24,7 @@
&:after {
content: "";
border-width: 0 14px 0px 2px;
-webkit-border-image: url(img/breakpointBorder.png) 0 14 0 2;
-webkit-border-image: url("img/breakpointBorder.png") 0 14 0 2;
}
}
}
Expand All @@ -42,7 +42,7 @@
left: -28px;
width: 28px;
height: 14px;
background-image: url(img/programCounterBorder.png);
background-image: url("img/programCounterBorder.png");
background-position: right center;
background-repeat: no-repeat;
}
Expand Down Expand Up @@ -75,19 +75,19 @@
opacity: 0.5;
}
button.pause {
background-image: url(img/debuggerPause.png);
background-image: url("img/debuggerPause.png");
}
button.stepInto {
background-image: url(img/debuggerStepInto.png);
background-image: url("img/debuggerStepInto.png");
}
button.stepOut {
background-image: url(img/debuggerStepOut.png);
background-image: url("img/debuggerStepOut.png");
}
button.stepOver {
background-image: url(img/debuggerStepOver.png);
background-image: url("img/debuggerStepOver.png");
}
button.resume {
background-image: url(img/debuggerContinue.png);
background-image: url("img/debuggerContinue.png");
}
// .tabs class is taken by Bootstrap
.toolbar-tabs {
Expand Down
46 changes: 29 additions & 17 deletions main.js
Expand Up @@ -66,27 +66,37 @@ define(function (require, exports, module) {
return script.url;
}

/** Find this extension's directory relative to the brackets root */
function _extensionDirForBrowser() {
var bracketsIndex = window.location.pathname;
var bracketsDir = bracketsIndex.substr(0, bracketsIndex.lastIndexOf('/') + 1);
var extensionDir = bracketsDir + require.toUrl('./');

return extensionDir;
/** Find the URL to this extension's directory */
function _extensionDirUrl() {
var url = brackets.platform === "win" ? "file:///" : "file://localhost";
url += require.toUrl("./").replace(/\.\/$/, "");

return url;
}

/** Loads a less file as CSS into the document */
function _loadLessFile(file, dir) {
var result = $.Deferred();

// Load the Less code
$.get(dir + file, function (code) {
// Parse it
var parser = new less.Parser({ filename: file, paths: [dir] });
parser.parse(code, function onParse(err, tree) {
console.assert(!err, err);
// Convert it to CSS and append that to the document head
$style = $("<style>").text(tree.toCSS()).appendTo(window.document.head);
});
});
$.get(dir + file)
.done(function (code) {
// Parse it
var parser = new less.Parser({ filename: file, paths: [dir] });
parser.parse(code, function onParse(err, tree) {
console.assert(!err, err);
// Convert it to CSS and append that to the document head
var $node = $("<style>").text(tree.toCSS()).appendTo(window.document.head);
console.log($node.text());
result.resolve($node);
});
})
.fail(function (request, error) {
result.reject(error);
})
;

return result.promise();
}

/** Event Handlers *******************************************************/
Expand Down Expand Up @@ -148,7 +158,9 @@ define(function (require, exports, module) {
LiveDevelopment.enableAgent("edit");

// load styles
_loadLessFile("debugger.less", _extensionDirForBrowser());
_loadLessFile("debugger.less", _extensionDirUrl()).done(function ($node) {
$style = $node;
});

// init modules
Debugger.init();
Expand Down

0 comments on commit 8a4b803

Please sign in to comment.