HCI/auxil/_minted-hci_CloudMan_wolfma.../94D50D21CB16EAC05CCB82CCCE4...

15 lines
1.5 KiB
Plaintext

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kd}{function} \PYG{n+nx}{sendProfilePost}\PYG{p}{()} \PYG{p}{\PYGZob{}}
\PYG{k+kd}{var} \PYG{n+nx}{body} \PYG{o}{=} \PYG{n+nb}{document}\PYG{p}{.}\PYG{n+nx}{getElementById}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}fb\PYGZhy{}write\PYGZhy{}post\PYGZdq{}}\PYG{p}{).}\PYG{n+nx}{value}\PYG{p}{;}
\PYG{n+nx}{FB}\PYG{p}{.}\PYG{n+nx}{api}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}/me/feed\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}post\PYGZsq{}}\PYG{p}{,} \PYG{p}{\PYGZob{}} \PYG{n+nx}{message}\PYG{o}{:} \PYG{n+nx}{body} \PYG{p}{\PYGZcb{},}
\PYG{k+kd}{function} \PYG{p}{(}\PYG{n+nx}{response}\PYG{p}{)} \PYG{p}{\PYGZob{}}
\PYG{k}{if} \PYG{p}{(}\PYG{o}{!}\PYG{n+nx}{response} \PYG{o}{||} \PYG{n+nx}{response}\PYG{p}{.}\PYG{n+nx}{error}\PYG{p}{)} \PYG{p}{\PYGZob{}}
\PYG{n+nx}{alert}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}Error occured\PYGZsq{}}\PYG{p}{);}
\PYG{n+nx}{console}\PYG{p}{.}\PYG{n+nx}{log}\PYG{p}{(}\PYG{n+nx}{response}\PYG{p}{.}\PYG{n+nx}{error}\PYG{p}{);}
\PYG{p}{\PYGZcb{}} \PYG{k}{else} \PYG{p}{\PYGZob{}}
\PYG{n+nx}{alert}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}Post ID: \PYGZsq{}} \PYG{o}{+} \PYG{n+nx}{response}\PYG{p}{.}\PYG{n+nx}{id}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{},} \PYG{p}{\PYGZob{}} \PYG{n+nx}{scope}\PYG{o}{:} \PYG{l+s+s1}{\PYGZsq{}public\PYGZus{}profile,email,publish\PYGZus{}actions\PYGZsq{}} \PYG{p}{\PYGZcb{});}
\PYG{p}{\PYGZcb{}}
\end{Verbatim}