tdatelier 发表于 2017-3-2 14:20:54

Mdict 转 Stardict 遇到问题

本帖最后由 tdatelier 于 2017-3-2 14:25 编辑

有些 Mdict 字典有子字条锚定,使用 <href="entry://ABC#abcedgg">
转到 stardict 后,点击,只能转到 ABC ,无法滚动到abcedgg。我把 js

// jump to word with link started with "entry://"
    // TODO: have to ignore in-page jump
    $('#definition').on('click', 'a', function(e) {
      var href = $(this).attr('href');
      if (href && href.substring(0, 8) === 'bword://') {
      var word = href.substring(8);
      // TODO: remove '#' to get jump target
      if (word.charAt(0) !== '#') {
          word = word.replace(/(^[/\\])|([/]$)/, '');

          $('#word').val(word);
          $('#btnLookup').click();
      } else {
          var currentUrl = location.href;
          location.href = word;                     //Go to the target element.
          history.replaceState(null,null,currentUrl); //Don't like hashes. Changing it back.      
      }
      return false;
      }
})

放到字典目录,也无效,发邮件给 Dictionary Universal 没有回复,官网资料很少。
不知这个有什么办法解决?

kyletruman 发表于 2017-3-2 15:04:25

帖子中的代码最好放到代码编辑器<>中,不然复制时一堆乱码;短消息中则不能将代码插到代码编辑器<>中,否则你发出去的所有代码完全消失成<{:4_107:}

EarthWorm 发表于 2017-8-31 17:14:57

兄弟, 你目前成功了做出 StarDict 的锚跳了吗?

我认为你一开始用的 <a href="entry://ABC#abcedgg">ABC</a> 是不起作用的, 你点击 ABC 之所以会跳到相应词条, 那是 Dictionary Universal 自带的功能 (一般词典软件都自带点按查词的)

我也很想知道在 StarDict 里如何实现精确的定位锚跳... 不知论坛是否有高人知道...
页: [1]
查看完整版本: Mdict 转 Stardict 遇到问题