added: simple web clipper
This commit is contained in:
		
							parent
							
								
									6050442bc8
								
							
						
					
					
						commit
						f83944444f
					
				| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					javascript: (function()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						var notesurl = "";
 | 
				
			||||||
 | 
						var content = document.title + "\n" + document.location;
 | 
				
			||||||
 | 
						window.open("https://" + notesurl + "?c=" + encodeURIComponent(content), "_blank", "popup,width=100,height=100");
 | 
				
			||||||
 | 
					})();
 | 
				
			||||||
							
								
								
									
										27
									
								
								main.js
								
								
								
								
							
							
						
						
									
										27
									
								
								main.js
								
								
								
								
							| 
						 | 
					@ -34,6 +34,7 @@ var pending = false;
 | 
				
			||||||
var settings = null;
 | 
					var settings = null;
 | 
				
			||||||
var tags = null;
 | 
					var tags = null;
 | 
				
			||||||
var titlemap = {};
 | 
					var titlemap = {};
 | 
				
			||||||
 | 
					var clip = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var stat =
 | 
					var stat =
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -1179,6 +1180,12 @@ function loadstorage()
 | 
				
			||||||
	var title = params.get("n");
 | 
						var title = params.get("n");
 | 
				
			||||||
	var line = params.get("l");
 | 
						var line = params.get("l");
 | 
				
			||||||
	var tags = params.get("t");
 | 
						var tags = params.get("t");
 | 
				
			||||||
 | 
						clip = params.get("c");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (clip)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							title = "bookmarks";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (currentnote)
 | 
						if (currentnote)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -1193,6 +1200,12 @@ function loadstorage()
 | 
				
			||||||
			currentnote = {title: title, content: newcontent, pos: newcontent.length};
 | 
								currentnote = {title: title, content: newcontent, pos: newcontent.length};
 | 
				
			||||||
			localdata.unshift(currentnote);
 | 
								localdata.unshift(currentnote);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (clip)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								hat = headerandtext(currentnote);
 | 
				
			||||||
 | 
								var dt = timestamp().substr(0,10);
 | 
				
			||||||
 | 
								currentnote.content = hat.header + dt + " " + clip + "\n\n" + hat.text;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (currentnote)
 | 
						if (currentnote)
 | 
				
			||||||
| 
						 | 
					@ -1202,6 +1215,16 @@ function loadstorage()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			gotoline(line);
 | 
								gotoline(line);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (clip)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								colored.hidden = true;
 | 
				
			||||||
 | 
								var msg = document.createElement("div");
 | 
				
			||||||
 | 
								msg.innerText = "Clipping...";
 | 
				
			||||||
 | 
								msg.setAttribute("style", "width:100px;height:100px;top:0;left:0");
 | 
				
			||||||
 | 
								notepage.appendChild(msg);
 | 
				
			||||||
 | 
								saved = false;
 | 
				
			||||||
 | 
								save();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -1809,6 +1832,10 @@ function setsaved()
 | 
				
			||||||
	unsavedmark.hidden = true;
 | 
						unsavedmark.hidden = true;
 | 
				
			||||||
	saved = true;
 | 
						saved = true;
 | 
				
			||||||
	lastsaved = timestamp();
 | 
						lastsaved = timestamp();
 | 
				
			||||||
 | 
						if (clip)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							close();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function save()
 | 
					function save()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue