Guest User

Untitled

a guest
Oct 15th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. /**
  2. * Resolve Message
  3. *
  4. * required jQuery.
  5. *
  6. * Ex.
  7. * <body onload="MessageResolver.load('resource', 'Resource_Ja');">
  8. * <h1 class="resource">label.title</h1>
  9. * ...
  10. * <input type="button" class="resource" value="label.submit"/>
  11. * ...
  12. */
  13. var MessageResolver = {
  14. /**
  15. * replace message
  16. */
  17. load : function(targetClass, namespace) {
  18. $("." + targetClass).each(function() {
  19. if ($(this).is(":input")) {
  20. $(this).val(eval(namespace + "." + $(this).val()));
  21. } else {
  22. $(this).text(eval(namespace + "." + $(this).text()));
  23. }
  24. });
  25. }
  26. };
Add Comment
Please, Sign In to add comment