Guest User

Untitled

a guest
Jul 17th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // adjust background transparency for window if needed
  2. if (Titanium.platform == "win32" &&
  3. Titanium.UI.currentWindow.getTransparency() < 1)
  4. {
  5. var color = "#" + Titanium.UI.currentWindow.getTransparencyColor();
  6. function replaceTransparent(srcStyle, destStyle)
  7. {
  8. if (!destStyle) destStyle = srcStyle;
  9. if (srcStyle.background == "transparent")
  10. {
  11. destStyle.background = color;
  12. }
  13. if (srcStyle.backgroundColor == "transparent")
  14. {
  15. destStyle.backgroundColor = color;
  16. }
  17. }
  18.  
  19. replaceTransparent(document.body.style);
  20. // also check external stylesheets, but still modify the DOM (hurray)
  21. for (var i = 0; i < document.styleSheets.length; i++)
  22. {
  23. for (var j = 0; j < document.styleSheets[i].cssRules.length; j++)
  24. {
  25. var rule = document.styleSheets[i].cssRules[j];
  26. if (rule.selectorText != "body") continue;
  27.  
  28. replaceTransparent(rule.style, document.body.style);
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment