When adding links to Bio by javascript, why do I get a "No changes were made" popup?

+5 votes
421 views
Hi,

I've written a bit of js code in TamperMonkey to mark up the ArkivDigital and Riksarkiv-links in a bio -- but when this runs, I get the "No changes" popup.

The changes (compared to the original) are substantial ... Is this a bug? Is there a way to circumvent it?

mvh /staffan
in WikiTree Tech by Staffan Bergh G2G1 (1.5k points)
retagged by Steven Harris

It just is like that when you do not type the text. Type something in the  Explain your changes:box and it will work fine

Thanks, but adding text to that box by javascript does not make a difference. So -- not a work-round. 

I *think* that Louis meant type - you know, old-fashioned fingers-on-the-keyboard type instead of adding an Explain Your Changes note via javascript.wink

After you add some script, you can go to the end of the sentence and hit the space bar, the added space will count as a change and it will save.
The point of the exercise is to *not* type stuff that can be done by a program ...

But it obviously can't be done by a program...

... the changes can *so* be done by a program (other changes, too, in fact, and I have scripts for that, too), and I get to hit the Save button.

The problem appears to be (per the answer by [[Horace-19]]) that the code under the Save button does rely on something that only happens when something special is done to the edit form. A better solution (as hinted in the link in the answer), would be to actually check if a change has happened ...
Very cool and glad to hear it confirmed that this is not considered a bot.  Would love to see more how such tools can be used to aid in the work here.

4 Answers

+8 votes
 
Best answer
I would need to see your JS code to help more. Do you see the changes if you hit preview?

Looking with debugger, if you set in JS page variable changesMade to 1 after you make changes, it will save the profile.
by Aleš Trtnik G2G6 Pilot (808k points)
selected by Staffan Bergh

Aha! A magic word! Thanks, that did it (and sorry [Horace-19], you lost the "Best answer" star, I'm afraid!).

The code is nothing special -- I added a test that the regex replaces did actually change something, so as to not abuse the changesMade variable:

    function addHrefs() {

        var j = jQuery.noConflict();

        var t = j("#wpTextbox1").val()

        var t2 = t.replace(/\(bildid: (?<id>[A-Z]\d+_\d+)\)/g, "(bildid: [https://sok.riksarkivet.se/bildvisning/$<id> $<id>])")

        t2 = t2.replace(/\(AID: (?<id>v\d+(\.b\d+(\.s\d+)?)?)\)/g, "(AID: [http://www.arkivdigital.se/aid/show/$<id> $<id>])")

        if (t2 !== t) {

            j("#wpTextbox1").val(t2)

            j("#wpSummary").val("Linked to Riksarkivet/ArkivDigital")

            changesMade = 1;

        }

    }

+8 votes

Issue discussed here

https://www.sitepoint.com/detect-html-form-changes/

The key part might be where it says "if a form value is updated using JavaScript, the onchange event handler won't be fired".

by Living Horace G2G6 Pilot (634k points)

Tried a few work-rounds for the not-fired on-change event handler, from StackOverflow mostly, and can't get it to work. I suspect there is more to the problem ... I suppose I'll have to use the work-rounds frown

+5 votes

The point of the exercise is to *not* type stuff that can be done by a program ...

What you are talking about is a Bot. It is a violation of WikiTree's Terms of Service to run a bot from a member's personal account.

by Steven Harris G2G6 Pilot (750k points)
(1) This is nothing like a bot.  It doesn't communicate with the server at all.

(2) Running a bot is not a violation.

It's a piece of javascript, in my browser, attached to a button also constructed as a part of the same script. I

  1. hit the button ("Links!")
  2. check that what my JS did to the bio looks good
  3. hit the Save button (and it's here it sez "No change")
So, as already said, not a 'bot, only a piece of software (much) better than me at editing the bio in a correct and consistent way.
As long as there is a member confirming and saving the change, it's not a bot. But if you are confirming it, adding a character or two shouldn't be a big deal, right?

Well, it's a work-round, and a fairly low-overhead one at that, I'll give you that. But it would be nicer not to have to ... wink

Thanks for that Chris, this will open a whole new operating experience for me!
Really you can not type in the change box and say what changed? I do not understand that - you have some shortcut to add things to the profile - take a few seconds and explain it

Sure, I'm able to type in the change box, and I'm able to edit things into links by tapping at my keyboard -- but why should I? With the help of a tool such as TamperMonkey I can write a small amount of code to do that repetitive, pretty un-creative and un-inspiring task for me -- and then use the saved energy and creativity on more inspiring tasks.

+4 votes
I have the same problem when using my speech-to-text software, Dragon. But it only rejects as "no changes made" when I enter something in the data fields. I normally hit the space bar a couple of times and it will allow me to save. Text entered by Dragon into the biography section does register and allows me to save with no problems.
by Shirley Dalton G2G6 Pilot (533k points)

Related questions

+6 votes
3 answers
158 views asked Jul 24, 2020 in WikiTree Tech by Florian Straub G2G6 Pilot (199k points)
+10 votes
3 answers
327 views asked Jun 3, 2020 in WikiTree Tech by Andrew Sielen G2G Crew (980 points)
+9 votes
1 answer
+5 votes
1 answer
+7 votes
2 answers
160 views asked May 20, 2018 in The Tree House by William Arbuthnot of Kittybrewster G2G6 Pilot (183k points)
+19 votes
1 answer

WikiTree  ~  About  ~  Help Help  ~  Search Person Search  ~  Surname:

disclaimer - terms - copyright

...