JackHaxor

tag_by_ID.php

Jan 22nd, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1.  
  2. javascript:
  3.  
  4. var currentLocation = window.location.href;
  5. var string_url = currentLocation.split("/");
  6. function fail(){
  7. alert("Bạn phải ở đúng trang đã");
  8. }
  9. function failMobile(){
  10. alert("Không hỗ trợ cho điện thoại");
  11. }
  12. function failPhotos(){
  13. alert("Không tag được trên ảnh");
  14. }
  15. function failUID(){
  16. alert("Nhập sai số ID");
  17. }
  18. function redirect(id_post) {
  19. fail();
  20. window.location.href = "http://fb.com/"+id_post;
  21. }
  22. function getGroup(){
  23. try{
  24. var div = document.getElementsByClassName("coverWrap");
  25. var id = div[0].dataset.referrerid;
  26. if(id!="null") return 1;
  27. else return 0;
  28. }
  29. catch (e){
  30. return 0;
  31. }
  32. }
  33. function getAllUrlParams() {
  34. var queryString = currentLocation ? currentLocation.split('?')[1] : window.location.search.slice(1);
  35. var obj = {};
  36. if (queryString) {
  37. queryString = queryString.split('#')[0];
  38. var arr = queryString.split('&');
  39. for (var i=0; i<arr.length; i++) {
  40. var a = arr[i].split('=');
  41. var paramNum = undefined;
  42. var paramName = a[0].replace(/\[\d*\]/, function(v) {
  43. paramNum = v.slice(1,-1);
  44. return '';
  45. });
  46. var paramValue = typeof(a[1])==='undefined' ? true : a[1];
  47. paramName = paramName.toLowerCase();
  48. if (obj[paramName]) {
  49. if (typeof obj[paramName] === 'string') {
  50. obj[paramName] = [obj[paramName]];
  51. }
  52. if (typeof paramNum === 'undefined') {
  53. obj[paramName].push(paramValue);
  54. }
  55. else {
  56. obj[paramName][paramNum] = paramValue;
  57. }
  58. }
  59. else {
  60. obj[paramName] = paramValue;
  61. }
  62. }
  63. }
  64. return obj;
  65. }
  66. function getPost(){
  67. try{
  68. if(currentLocation.indexOf("m.facebook") !== -1){
  69. failMobile();
  70. return 1;
  71. }
  72. else if(currentLocation.indexOf("/permalink/") !== -1){
  73. var id = string_url[6];
  74. return id;
  75. }
  76. else if(currentLocation.indexOf("videos") !== -1){
  77. var id = string_url[string_url.length-2];
  78. var check = getGroup();
  79. if(check!=0){
  80. redirect(id);
  81. return 1;
  82. }
  83. else{
  84. return id;
  85. }
  86. }
  87. else if(currentLocation.indexOf("photo") !== -1){
  88. var check = getGroup();
  89. if(check!=0){
  90. var set = getAllUrlParams().set;
  91. var string = set.split(".");
  92. var id = string[1];
  93. redirect(id);
  94. return 1;
  95. }
  96. else{
  97. failPhotos();
  98. return 1;
  99. }
  100. }
  101. else if(currentLocation.indexOf("posts") !== -1){
  102. var set = string_url[string_url.length-1];
  103. var string = set.split("?");
  104. var id = string[0];
  105. return id;
  106. }
  107. return 0;
  108. }
  109. catch (e){
  110. return 0;
  111. }
  112. }
  113. function isNumber(n) {
  114. return !isNaN(parseFloat(n)) && isFinite(n);
  115. }
  116. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
  117. return typeof obj;
  118. } : function(obj) {
  119. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  120. };
  121. var id_post = getPost();
  122. if(id_post!=0 && id_post!=1 && isNumber(id_post)==true){
  123. var uid = prompt('Nhập số ID Facebook người muốn tag');
  124. if(isNumber(uid)){
  125. var text = prompt('Nhập nội dung muốn nhắn');
  126. addCmt();
  127. }
  128. else{
  129. failUID();
  130. }
  131. }
  132. else if(id_post!=1){
  133. fail();
  134. }
  135.  
  136.  
  137.  
  138. function addCmt() {
  139. request('https://www.facebook.com/ufi/add/comment/?dpr=1', {
  140. ft_ent_identifier: id_post,
  141. comment_text: '@[' + uid + ':0] '+text,
  142. av: getUserID(),
  143. __user: getUserID(),
  144. __a: 1,
  145. fb_dtsg: getUserToken(),
  146. source: 2,
  147. client_id: '1489983090155:3363757627',
  148. session_id: '84d81e4'
  149. });
  150. }
  151.  
  152. function request(url, data) {
  153. fetch(url, {
  154. method: 'POST',
  155. credentials: 'include',
  156. body: JSONtoFormData(data)
  157. }).then(function(response) {
  158. if(response.ok) {
  159. window.scrollBy(0,5000);
  160. }
  161. });
  162. }
  163.  
  164. function JSONtoFormData(json) {
  165. if ((typeof json === 'undefined' ? 'undefined' : _typeof(json)) !== 'object') {
  166. if (typeof json === 'string') {
  167. try {
  168. json = JSON.parse(json);
  169. } catch (e) {
  170. return false;
  171. }
  172. } else {
  173. return false;
  174. }
  175. }
  176.  
  177. var formData = new FormData();
  178. Object.keys(json).map(function(key) {
  179. formData.append(key, json[key]);
  180. });
  181.  
  182. return formData;
  183. }
  184.  
  185. function getUserID() {
  186. if (typeof require !== 'function') return null;
  187. try {
  188. return require('CurrentUserInitialData').USER_ID || document.cookie.match(/c_user=([0-9]+)/)[1];
  189. } catch (e) {
  190. return null;
  191. }
  192. }
  193.  
  194. function getUserToken() {
  195. if (typeof require !== 'function') return null;
  196. try {
  197. return require('DTSGInitialData').token || document.querySelector('[name="fb_dtsg"]').value;
  198. } catch (e) {
  199. return null;
  200. }
  201. }
Advertisement
Add Comment
Please, Sign In to add comment