native.js 913 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. window["displayMenu"] = function() {
  2. document.getElementById(R.id.context).classList.add(R.klass.opened);
  3. };
  4. window["hideMenu"] = function() {
  5. document.getElementById(R.id.context).classList.remove(R.klass.opened);
  6. };
  7. window["toggleMenu"] = function() {
  8. toggleMenu();
  9. };
  10. window["setChannelFavorite"] = function(chanId, val) {
  11. var channel = DATA.context.getChannel(chanId);
  12. if (channel) {
  13. if (val)
  14. starChannel(channel);
  15. else
  16. unstarChannel(channel);
  17. } else {
  18. console.error("Channel " +chanId +" not found");
  19. }
  20. };
  21. window["onSmsPermissionUpdated"] = function(enabled) {
  22. if ("__native" in window && enabled) {
  23. var response = JSON.parse(__native.getStatic());
  24. if (response) {
  25. DATA.update(response);
  26. }
  27. }
  28. };
  29. /** @return {boolean} */
  30. function isNative() {
  31. return !!("__native" in window);
  32. }