PropertyguruAssist

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

当前为 2022-04-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         PropertyguruAssist
// @namespace    http://tampermonkey.net/
// @version      0.1
// @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
    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    = $(".element-label.price").attr("content");
    var top_year = $(".completion-year .value-block").text();
    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    = $('.agent-phone .agent-phone-number').text();
    phone = phone.slice(13, 13+13);
    agent = agent.replace('by ','');
    var clipbard_text = url + '	'
                        + project + ' [' + info + '] '
                        + ', ' + bdr_num + ', ' + size + ', S$: ' + price +'	'
                        + agent + ' ' + phone;
    //alert(agent_phone);
    var clipboard = new Clipboard('.btn');
    var title_text = ' <button style="font-size:13px" class="btn" data-clipboard-text="' + clipbard_text + '">点我复制 url / listing info / agent + phone </button>';
    $("h1").append(title_text);

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