TradeMe List View Enforcer

Forces the list view!

当前为 2015-10-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name TradeMe List View Enforcer
  3. // @namespace http://www.girlza.com/
  4. // @include http://www.trademe.co.nz/*
  5. // @description Forces the list view!
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
  7. // @grant GM_addStyle
  8. // @version 0.21
  9. // ==/UserScript==
  10. function getParameterByName(name) {
  11. name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
  12. var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
  13. results = regex.exec(location.search);
  14. return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
  15. }
  16.  
  17. function doMe(){
  18. $( document ).ready(function() {
  19. document.getElementById('listViewTab').click()
  20. });}
  21.  
  22. if (document.getElementById('listingLayout') != null) {
  23. var x = document.getElementById('listingLayout').value
  24. if (x.toUpperCase() == 'GALLERY') {
  25. if (document.getElementById('listViewTab') != null) {
  26. doMe()
  27. }
  28. }
  29. } else if (document.getElementById('ListingsTitle_galleryViewTab_icon_a') != null) {
  30. var v = getParameterByName('v');
  31. var w = document.location.toString().substring(document.location.toString().length - 9)
  32. if (v.toUpperCase() != "GALLERY" && w.toUpperCase() != "V-GALLERY" && document.getElementById("ListingsTitle_galleryViewTab_icon_a").classList.contains('btn-checked')) {
  33. window.location.href = document.getElementById("ListingsTitle_listViewTab_icon_a").href
  34. //doMe()
  35. }
  36.  
  37. } else if (document.getElementById("ListingsTitle_ListingViewBar_listViewTab_icon_a") != null) {
  38. if (document.getElementById("ListingsTitle_ListingViewBar_listViewTab_icon_a").href == "") {
  39. //already in list view
  40. } else {
  41. window.location.href = document.getElementById("ListingsTitle_ListingViewBar_listViewTab_icon_a").href
  42. }
  43. } else if (document.getElementById("ListingViewBar_listViewTab_icon_a") != null) {
  44. if (document.getElementById("ListingViewBar_listViewTab_icon_a").href == "") {
  45. //already in list view
  46. } else {
  47. window.location.href = document.getElementById("ListingViewBar_listViewTab_icon_a").href
  48. }
  49. }
  50.