Skip to content

Commit

Permalink
fixed chromium display bug, added notelinks but commented them out ag…
Browse files Browse the repository at this point in the history
…ain for release
  • Loading branch information
shatting committed Jul 3, 2011
1 parent 7665942 commit aba606e
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 62 deletions.
2 changes: 1 addition & 1 deletion javascripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var extData = {
API : true,
CM : true,
Timestamp : true,
GA : true,
GA : false,
alertExc : true
},

Expand Down
2 changes: 1 addition & 1 deletion javascripts/lib/codemirror1/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var mac = /Mac/.test(navigator.platform);
// this if Opera gets their act together, make the version check more
// broad if they don't.
var brokenOpera = window.opera && /Version\/10.[56]/.test(navigator.userAgent);
// TODO remove this once WebKit 533 becomes less common.
// remove this once WebKit 533 becomes less common.
var slowWebkit = /AppleWebKit\/533/.test(navigator.userAgent);

// Make sure a string does not contain two consecutive 'collapseable'
Expand Down
50 changes: 27 additions & 23 deletions javascripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,8 +1247,8 @@ function SNEditor() {
$(".CodeMirror-wrapping").attr("id","cmwrapper");

$("#cmwrapper").css("position","");
$("#cmwrapper").css("height","");
$("#cmiframe").attr("tabindex","7");
$("#cmwrapper").css("height","");
$("#cmiframe").attr("tabindex","2");

this.dirty={content: false, tags: false, pinned: false};
}
Expand Down Expand Up @@ -1369,6 +1369,10 @@ SNEditor.prototype.initialize = function() {
if (that.codeMirror.lastLine() == that.codeMirror.cursorLine())
$editbox.scrollTop($editbox.scrollTop() + 20);
break;
case 191: // #-key
//alert(JSON.stringify(that.codeMirror.cursorCoords(true)))
//dropdown(that.codeMirror,["asd","dfg","asdkj"]);
break;
}
});

Expand Down Expand Up @@ -1423,7 +1427,7 @@ SNEditor.prototype.initialize = function() {

var note = that.note;
if (that.dirty.content) {
that.saveCaretScroll();
//that.saveCaretScroll();
that.codeMirror.setCode(note.content);
that.restoreCaretScroll();
}
Expand Down Expand Up @@ -1473,23 +1477,23 @@ SNEditor.prototype.initialize = function() {
openURLinTab(url,event.shiftKey || event.altKey);
});

$(".sn-link-note",$editbox).die();
$(".sn-link-note",$editbox).live("click",function(event) {
if (event.ctrlKey) {
_gaq.push(['_trackEvent', 'popup', 'linkclicked_unhot']);
return;
}
var title = this.textContent.trim().substr(1);
snHelpers.getHeadings(true,function(headings) {
var titles = headings.filter(function(h) { return h.title == title; });
if (titles.length == 1) {
if (extData.isTab && snEditor.note)
snEditor.saveCaretScroll();

snEditor.setNote(titles[0]);
}
});
});
// $(".sn-link-note",$editbox).die();
// $(".sn-link-note",$editbox).live("click",function(event) {
// if (event.ctrlKey) {
// _gaq.push(['_trackEvent', 'popup', 'linkclicked_unhot']);
// return;
// }
// var title = this.textContent.trim().substr(1);
// snHelpers.getHeadings(true,function(headings) {
// var titles = headings.filter(function(h) {return h.title == title;});
// if (titles.length == 1) {
// if (extData.isTab && snEditor.note)
// snEditor.saveCaretScroll();
//
// snEditor.setNote(titles[0]);
// }
// });
// });

// bind ctrl link disable
$editbox.bind('keydown', function(event) {
Expand Down Expand Up @@ -1737,11 +1741,11 @@ SNEditor.prototype.setNote = function(note, options) {
}

// set content
snHelpers.getHeadings(false,function(headings) {
that.codeMirror.setParser("SimpleParser", {headings: headings});
//snHelpers.getHeadings(false,function(headings) {
// that.codeMirror.setParser("SimpleParser", {headings: headings});
//console.log(headings(notes))
that.codeMirror.setCode(inputcontent);
})
//})

// set pinned
this.setPintoggle(this.note.systemtags.indexOf("pinned")>=0);
Expand Down
28 changes: 14 additions & 14 deletions javascripts/simplenoteParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ var SimpleParser = Editor.Parser = (function() {
// return urlinfo;
// }

function noteLinkLookAhead(source,consume) {
for (var i = 0; i<config.headings.length; i++) {
var title = config.headings[i].title;
var match = source.lookAheadRegex(new RegExp("^#" + RegExp.escape(title),"i"),consume);
if (match)
return match;
}
}
// function noteLinkLookAhead(source,consume) {
// for (var i = 0; i<config.headings.length; i++) {
// var title = config.headings[i].title;
// var match = source.lookAheadRegex(new RegExp("^#" + RegExp.escape(title),"i"),consume);
// if (match)
// return match;
// }
// }

function normal(source, setState) {
var url;
Expand All @@ -47,17 +47,17 @@ var SimpleParser = Editor.Parser = (function() {
return "sn-link";
}

var notelink = noteLinkLookAhead(source,true);
if (notelink) {
return "sn-link-note";
}
// var notelink = noteLinkLookAhead(source,true);
// if (notelink) {
// return "sn-link-note";
// }

while(!url && !source.endOfLine()) {
source.nextWhileMatches(/[^h\n\s#]/);
if (!source.endOfLine()) {
url = source.lookAheadRegex(urlRe, false);
notelink = noteLinkLookAhead(source, false);
if (url || notelink)
//notelink = noteLinkLookAhead(source, false);
if (url)
return "text";
else {
source.next();
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Syncpad for Simplenote",
"version": "1.8.6",
"version": "1.8.6.1",
"minimum_chrome_version": "5.0.316.0",
"description": "__MSG_description__",
"default_locale": "en",
Expand Down
15 changes: 8 additions & 7 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
</div>
</div>
<div id="note">
<div class="toolbarbutton" id="backtoindex" title="Back to notes (alt-b). [alt-x to close popup]" tabindex="8"></div>
<div class="toolbarbutton" id="wraptoggle" title="Toggle wordwrap (alt-w)" tabindex="7"></div>
<div class="toolbarbutton" id="popout" title="Open Syncpad in a browser tab (alt-o)" tabindex="6"></div>
<div class="toolbarbutton" id="print" title="" tabindex="5"></div>
<div class="toolbarbutton" id="trash" title="Send note to trash (ctrl-alt-d)" tabindex="4"></div>
<div class="toolbarbutton" id="pintoggle" title="Pin this note to always show on top (alt-p)" tabindex="3"></div>
<div class="toolbarbutton" id="revert" title="Revert note to state before opening (alt-r)" tabindex="2"></div>
<div class="toolbarbutton" id="backtoindex" title="Back to notes (alt-b). [alt-x to close popup]"></div>
<div class="toolbarbutton" id="wraptoggle" title="Toggle wordwrap (alt-w)"></div>
<div class="toolbarbutton" id="popout" title="Open Syncpad in a browser tab (alt-o)"></div>
<div class="toolbarbutton" id="print" title=""></div>
<div class="toolbarbutton" id="trash" title="Send note to trash (ctrl-alt-d)"></div>
<div class="toolbarbutton" id="pintoggle" title="Pin this note to always show on top (alt-p)"></div>
<div class="toolbarbutton" id="revert" title="Revert note to state before opening (alt-r)"></div>
</div>
<script type="text/javascript">
head.js("javascripts/lib/jquery-1.6.1.min.js",
Expand All @@ -47,6 +47,7 @@
,"javascripts/lib/jquery.autoSuggest.js"
,"javascripts/common.js"
,"javascripts/simplenoteSM.js"
//,"javascripts/dropdown.js"
,"javascripts/popup.js");
</script>
</body>
Expand Down
22 changes: 7 additions & 15 deletions stylesheets/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,11 @@ div.statusicon-clickable:hover {
/* note div */

.CodeMirror-wrapping {
padding: 1px;
padding-top: 5px;
padding-left: 5px;
border-radius: 12px 0px 0px 0px;
border: 1px solid #999;
''border: 1px solid rgba(0, 0, 0, 0.3);
''box-shadow: 0 1px 0 #fff;
''margin-left: 2px;
''margin-right: 2px;
margin-top: 4px;
margin-top: 4px;
position: absolute;
bottom: 2px;
top: 32px;
Expand All @@ -370,16 +367,11 @@ div.statusicon-clickable:hover {
outline: none;
}

/*#tags {
padding: 4px 0px 4px 34px;
display: inline;
.cm-iframe {
position: absolute;
right: 240px;
left: 2px;
font-size: 13px;
margin-left: 2px;
background: transparent url(/images/tag_dunkel.png) no-repeat 10px 50%;
}*/
-webkit-box-sizing: border-box;
padding-right: 6px;
}

div#note .toolbarbutton {
display:inline;
Expand Down

0 comments on commit aba606e

Please sign in to comment.