Code Monkey home page Code Monkey logo

Comments (3)

mvolz avatar mvolz commented on August 25, 2024

The main issue is that we need to open VE, and then select the proper citation. This could be done by open VE with a GET arg, and then by executing Javascript on the open page. However, figuring out where exactly in the linear model the selected citation is might be a bit tricky... see: https://www.mediawiki.org/wiki/VisualEditor/API/Data_Model/Surface Inside VE, we need to know where the selection is in the linear model, and that is generated from the HTML, and I'm not sure how to do this; perhaps it's possible to get from parsoid?

from citationhunt.

eggpi avatar eggpi commented on August 25, 2024

Hi @mvolz! I know absolutely nothing about VE, so let's see if I understand your ideas...

This could be done by open VE with a GET arg, and then by executing Javascript on the open page.

I skimmed the documentation a bit, but saw no references to opening VE with a query parameter, or to passing it a script to run. Is this something that's already possible? Can you please point me to the relevant docs?

Inside VE, we need to know where the selection is in the linear model, and that is generated from the HTML

So if we manage to run JS in VE, we'll get access to the linear model through the VE API, and the corresponding HTML will just be the page itself, right?

I suppose the hackish way would be to craft some heuristic to match the snippet as displayed in Citation Hunt with one of the DOM elements in the page (it's always going to be a paragraph and we know what section it's in, we can try some matching based on the text), then look that up in the linear model. Does this make some sense? I'm hand-waving a lot here :)

Thanks for your input!

from citationhunt.

mvolz avatar mvolz commented on August 25, 2024

To open VE you just need to do: https://en.wikipedia.org/wiki/SomePage?veaction=edit

And then yes, we'll get access to the linear model and also the whole library because it's all front-end javascript. You can kind of see what interacting with it looks like here: https://www.mediawiki.org/wiki/VisualEditor/Gadgets#Code_snippets

I think actually the easiest/hackish way to do it is just search for the text of the citation in the page. At the bottom of that gadgets link someone has actually written a search and replace gadget so you could probably adapt that code lot: https://en.wikipedia.org/wiki/User:%D7%A2%D7%A8%D7%9F/veReplace.js

Except instead of replacing, you just need to select it and that should open up the dialog.

from citationhunt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.