من حاسوب الى هاتف

للحاسوب

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/583351/1857923/%D9%85%D9%86%20%D8%AD%D8%A7%D8%B3%D9%88%D8%A8%20%D8%A7%D9%84%D9%89%20%D9%87%D8%A7%D8%AA%D9%81.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Force Mobile View
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  تصفح المواقع بنسخة الهاتف وتفعيل ميزات اللمس
// @author       Yassir
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/Class==

(function() {
    'use strict';

    // 1. تغيير الـ User-Agent لتبدو وكأنك تستخدم هاتف آيفون أو أندرويد
    const mobileUA = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1";
    
    Object.defineProperty(navigator, 'userAgent', {
        get: function () { return mobileUA; }
    });

    // 2. تفعيل ميزات اللمس (Touch Events) التي تحتاجها ميزات الهاتف في المواقع
    if ('maxTouchPoints' in navigator) {
        Object.defineProperty(navigator, 'maxTouchPoints', { get: () => 5 });
    }
    if ('msMaxTouchPoints' in navigator) {
        Object.defineProperty(navigator, 'msMaxTouchPoints', { get: () => 5 });
    }

    // 3. محاكاة دعم اللمس في المستند
    window.Ontouchstart = true;
})();