PropertyguruAssist

one button click -> simplify propertyguru listing info for easily copy / paste

当前为 2023-06-22 提交的版本,查看 最新版本

// ==UserScript==
// @name         PropertyguruAssist
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  one button click -> simplify propertyguru listing info for easily copy / paste
// @author       EnginePlus
// @match        https://*.propertyguru.com.sg/listing/*
// @grant        none
// @resource     customCSS https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
// @require      https://greasyfork.org/scripts/27254-clipboard-js/code/clipboardjs.js?version=174357
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js
// ==/UserScript==

(function() {
    'use strict';
    var title    = $(document).attr("title");
    var arr      = title.split(',');
    //The Jade, 9 Bukit Batok Central Link, 3 Bedrooms, 1755 Sqft, Condos & Apartments for Sale, by Chan Yong Jie (Bob), S$ 1,620,000, 21559901
    //Lake Grande, 2 Jurong Lake Link, 2 Bedrooms, 667 sqft, N SALE, by Tan Chee Kiong, 24402533
    var url      = window.location.href;
    var project  = arr[0];
    //var address = arr[1];
    var bdr_num  = arr[2];
    var size     = arr[3];
    var agent    = arr[5];
    var price    = $(".price .amount").text(); //var price    = $(".element-label.price").attr("content");
    var details  = $("table tbody").text();
    var info     = details.slice(details.indexOf("TOP"), details.indexOf("Listed On"));
    info         = info.replace('TOP', '');
    info         = info.replace('Total Units', ' / ');
    info         = info.replace('Tenure', ' / ');
   //var info     = $(".condo-profile-box__details .property-attr .value-block").text();
   //info = info.replace(/\s+/g,""); // remove all space
   //info = info.replace('hold', ' / units: ');
   //info = info.replace('Lease', ' ');
   //info = info.replace('Free', 'Freehold');
   //info = info.slice(0,4) + ' / ' + info.slice(4);
  // alert(info);

    var phone    = $('.card-body a').attr("href");
    phone        = phone.slice(phone.indexOf("="), phone.indexOf("&"));
    phone        = phone.replace('=', '+');
    agent = agent.replace('by ','');
    var clipbard_text = url + '	'
                        + project + ' [' + info + '] '
                        + ', ' + bdr_num + ', ' + size + ', ' + price +'	'
                        + agent + ' ' + phone;
    //alert(agent_phone);
    var clipboard = new Clipboard('.btn');
    var title_text = ' <button style="font-size:13px;background-color: #eeeee4" class="btn" data-clipboard-text="' + clipbard_text + '">点我复制 url / listing info / agent + phone </button>';
    $("h1").append(title_text);

    // Your code here...
})();