Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. ty.dulst.actionRename = function(old, newString) {
  2. ty.dulst.cardsInterface.cardCollection.each(function(card) {
  3. var changeThisCard;
  4. var effects = card.get("effects");
  5. if (effects && effects.length) {
  6. effects.forEach(function(effect) {
  7. if (effect.action.primary == old) {
  8. effect.action.primary = newString;
  9. changeThisCard = true;
  10. }
  11. });
  12. }
  13.  
  14. if (changeThisCard) {
  15. console.log("attempting to update", card.get("title"));
  16. card.save("effects", effects, {
  17. error: function() {},
  18. success: function() {
  19. console.log(
  20. "updated",
  21. card.get("title"),
  22. "from",
  23. old,
  24. "to",
  25. newString
  26. );
  27. }
  28. });
  29. }
  30. });
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement