html 页面注释器

发布于 2024-10-28 09:42:29 字数 1016 浏览 0 评论 0原文

我必须写一个网页注释器。 我的要求如下:

1)给定一组页面,我想有效地注释它们(在浏览器中,在知道如何渲染 HTML 的外部应用程序中等)

2)我选择(突出显示,激活)手动输入一串文本,然后出现下拉菜单,允许从一组选项中进行选择

3) 之后,迭代器出现(就像在浏览器中按 ctrl+F 进行搜索一样),我希望能够导航在上一步中选择的字符串,在同一页上

4)给出了具有接口的字符串比较函数:给定两个字符串,它输出 1 或 0,具体取决于字符串匹配

5)当我按下迭代器按钮时,我会移动到所选字符串的下一个匹配,然后应该出现一个消息框(或者我可以确认它是真正匹配的任何其他内容)

6)确认它是真正匹配后,应该修改页面的文本,例如当前的比赛被特殊标签包围 (例如 <<< optionX >> 匹配文本 <<< /optionX >> ),其中 optionX 是根据第一步中选择的值定义的(下拉菜单)

5)当在页面上找到所有匹配项(由比较函数定义)时,我想在同一页面上标记另一个文本字符串,然后通过查找所有匹配项,确认其中一些匹配项并修改来重复该过程相应的页面源

6) 那么修改后的页面应该存储在本地驱动器上

问题: 您能建议什么是正确的工具来做到这一点吗?

1)可以使用javascript并在浏览器中工作吗?如果是,需要什么方法,是否有任何有用的库可以做到这一点,或者至少涵盖上面描述的一些功能

2)最好构建一个自定义桌面应用程序,在特殊框架中呈现页面,并有适当的按钮来导航、确认等(考虑 python 或 C#),以及哪些类和库可以提供帮助

[更新]:

我知道如何处理页面的内容,但我很好奇如何制作注释者使用起来很舒服,如何与用户建立正确的对话框:拥有所有糖果的方法,例如用户可见的下拉菜单和迭代器,确认对话框等。

目标是用它来注释很多页面,因此接口应该是高效的。我是一名研究人员(这不是您可能想的那样的家庭作业,我只是以正式的方式描述了需要什么),并且我在编写面向用户的应用程序方面的经验很差。

先感谢您!

I have to write a web page annotator.
And my requirements are the following:

1) given a set of pages, I want to annotate them efficiently (in a browser, in an external application that knows how to render HTML, etc.)

2) I select (highlight, make active) manually a string of text, and dropdown menu appears that allows to select from a set of options

3) after that the iterator appears (like in a browser when pressed ctrl+F to search) and I want to be able to navigate through matches of the string, selected in the previous step, on the same page

4) comparison function on strings is given that has interface: given two strings it outputs either 1 or 0, depending on strings match

5) when I press iterator button, i move to the next match for selected string, and then a message box should appear (or any other thing where i can confirm that it is a true match)

6) having confirmed that it is a true match, the text of a page should be modified such that current match became surrounded by special tag
(for instance <<< optionX >>> matched text <<< /optionX >>> ), where optionX is defined based on a value selected in the first step (dropdown menu)

5) when all matches (defined by comparison function) are found on a page, I would like to mark another string of text on the same page and then repeat the process, by finding all the matches, confirming some of them, and modifying page source correspondingly

6) then a modified page should be stored on a local drive

QUESTIONS:
Can you please suggest what is the right tool to do that?

1)Is it OK to use javascript and work in a browser. If yes, what methods are required for that and are there any useful libraries that do just that, or at least cover some functionality described above

2) May be is it better to build a custom desktop app, that renders a page in a special frame, and have appropriate buttons to navigate, confirm etc. (python or C# are considered), and again what classes and libraries can help

[UPDATE]:

I know how to work with the content of a page, but I am curious how to make it comfortable for annotators to use, how to build the right dialog with the user: ways to have all candies such as dropdown menus and iterator that is visible for users, dialog for confirmation etc.

The goal is to annotate a lot of pages with that, therefore interface should be efficient. I am a researcher (and this is not a homework as you might think, i just described what is needed in a formal way ) and I have only poor experience writing user oriented apps.

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多彩岁月 2024-11-04 09:42:29

这绝对是网络浏览器的工作。您可以使用 JQuery 来搜索和修改 html 页面。此示例将查找所有出现的 homework 并将文本更改为 <<作业>>

$("*").each(function () { 
  if ($(this).children().length == 0) { 
    $(this).text($(this).text().replace('homework','<< homework >>')); 
  } 
});

This is definitely a web browsers job. You can use JQuery to search and modify a html page. This example will find all occurrences of homework and change the text to << homework >>

$("*").each(function () { 
  if ($(this).children().length == 0) { 
    $(this).text($(this).text().replace('homework','<< homework >>')); 
  } 
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文