1

テキストのブロックを再フォーマットする Spiceworks 用のプラグインを開発しています。残念ながら、これは Firefox でのみ機能し、Chrome や IE では機能しません。

plugin.includeStyles();
function log(msg) {
  throw new Error(msg);
}
SPICEWORKS.app.helpdesk.ticket.ready(function(){
  console.log('###Start function###');
  console.log('###URL###');
  var url = jQuery("li.custom")[2].lastElementChild.firstChild.wholeText;

  //Check to see if category is project.
  for(var i=0;i<jQuery("li.custom").length;i++)
  {
    if (jQuery("li.custom")[i].lastElementChild.firstChild.wholeText == "Project")
    {
        for(var u=0;u<jQuery("li.custom").length;u++)
        {
          if (jQuery("li.custom")[u].lastElementChild.firstChild.wholeText.contains("http"))
          {
            jQuery("li.custom")[u].innerHTML = '<a href="'+url+'" target="_blank"><span class="projectLink">Project Link</span></a>';
          }
       }
    }
  }
});​

Chrome は、9 行目に「Uncaught TypeError: Cannot read property 'lastElementChild' of undefined」というエラーがあることを示しています (var url = ...) 。これは、さまざまなブラウザーの表示を比較したスクリーンショットです。

異なるブラウザ間で一貫した表示を行うにはどうすればよいですか?

4

0 に答える 0