Skip to content

Commit

Permalink
Firefox 15にてタグ補完ができない問題を修正(XMLクラスが制限されたためDOM利用へ変更/他利用箇所は未修正)
Browse files Browse the repository at this point in the history
  • Loading branch information
to committed Aug 29, 2012
1 parent 79fc27c commit 4d06a95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 41 deletions.
6 changes: 2 additions & 4 deletions xpi/chrome/content/library/01_utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -1788,10 +1788,8 @@ function $x(exp, context, multi) {
return null;
}

function convertToDOM(xml){
var elm = currentDocument().createElementNS(HTML_NS, 'span');
elm.innerHTML = xml.toXMLString();
return elm.childNodes[0];
function convertToDOM(text){
return new DOMParser().parseFromString(text.replace(/xmlns=["'].*?["']/g,''), 'text/xml');
}

function convertToHTMLDocument(html, doc) {
Expand Down
10 changes: 5 additions & 5 deletions xpi/chrome/content/library/20_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1996,22 +1996,22 @@ models.register({
charset : 'utf-8',
sendContent : ps
}).addCallback(function(res){
return convertToXML(res.responseText);
return convertToDOM(res.responseText);
});
},

getKanaReadings : function(str){
return this.parse({
sentence : str,
response : 'reading',
}).addCallback(function(res){
return list(res.ma_result.word_list.word.reading);
}).addCallback(function(dom){
return $x('//reading/text()', dom, true);
});
},

getRomaReadings : function(str){
return this.getKanaReadings(str).addCallback(function(rs){
return rs.join('\u0000').toRoma().split('\u0000');
return this.getKanaReadings(str).addCallback(function(readings){
return readings.join('\u0000').toRoma().split('\u0000');
});
},
});
Expand Down
32 changes: 0 additions & 32 deletions xpi/chrome/content/library/40_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,38 +69,6 @@ function SlidePanel(elmPanel){
return panel;
}

// current / entries / per / max
function Pagebar(opt){
var total = Math.ceil(opt.entries/opt.per);
opt.max = opt.max || opt.entries;
var step = total <= opt.max ? 1 : total/opt.max;

var tds = <></>;
var pages = {};
for(var i=1 ; i<total ; i+=step)
pages[Math.ceil(i)]=true;
pages[opt.current] = pages[total] = true;

if(opt.current!=1)
tds+=<td class="pagination" value={opt.current-1}></td>

keys(pages).sort(function(a,b){return a-b}).forEach(function(page){
tds+=<td class={(page==opt.current)? 'current' : ''} value={page}>{page}</td>
})

if(opt.current!=total)
tds+=<td class="pagination" value={opt.current+1}></td>

var elmPagebar = convertToDOM(<table id="pagebar"><tr>{tds}</tr></table>);
connect(elmPagebar, 'onclick', function(e){
var target = e.target();
if(hasElementClass(target, 'current')) return;

signal(elmPagebar, 'onChange', target.getAttribute('value'));
})
return elmPagebar;
}


var QuickPostForm = {
show : function(ps, position, message){
Expand Down

0 comments on commit 4d06a95

Please sign in to comment.